/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 // $Id: ParserActions.h,v 1.2 2007/05/24 14:41:21 hmd Exp $ 00002 // ============================================================================ 00003 // CVS tag $Name: GAUDI_v20r4-pre $ 00004 // ============================================================================ 00005 #ifndef JOBOPTIONSSVC_PARSERACTIONS_H 00006 #define JOBOPTIONSSVC_PARSERACTIONS_H 1 00007 // ============================================================================ 00008 // Include files 00009 // ============================================================================ 00010 // STD & STL 00011 // ============================================================================ 00012 #include <string> 00013 // ============================================================================ 00014 // Boost.Spirit.phoenix 00015 // ============================================================================ 00016 #include <boost/spirit/phoenix.hpp> 00017 // ============================================================================ 00018 // Boost.conversion 00019 // ============================================================================ 00020 #include <boost/lexical_cast.hpp> 00021 // ============================================================================ 00022 namespace Gaudi 00023 { 00024 namespace Parsers 00025 { 00026 template <class T> 00027 class PushBackImpl 00028 { 00029 T&data; 00030 public: 00031 PushBackImpl(T &x):data(x){} 00032 template <class Arg> 00033 struct result{ 00034 typedef void type; 00035 }; 00036 00037 template <class Arg> 00038 void eval(const Arg &x)const{ 00039 data().push_back(x[phoenix::tuple_index<0>()]); 00040 } 00041 }; 00042 template <class T,typename IT> 00043 class PushBackRefImpl 00044 { 00045 T& data; 00046 IT item; 00047 public: 00048 PushBackRefImpl(T &x,IT it):data(x),item(it){} 00049 template <class Arg> 00050 struct result{ 00051 typedef void type; 00052 }; 00053 00054 template <class Arg> 00055 void eval(const Arg & /*x*/ )const{ 00056 data().push_back(item); 00057 } 00058 }; 00059 00060 template <class T> 00061 class AssignBoolToStringImpl 00062 { 00063 T &data; 00064 public: 00065 AssignBoolToStringImpl(T &x):data(x){} 00066 template <class Arg> 00067 struct result{ 00068 typedef void type; 00069 }; 00070 00071 template <class Arg> 00072 void eval(const Arg &x)const{ 00073 data() = x[phoenix::tuple_index<0>()]?"1":"0"; 00074 } 00075 }; 00076 00077 template <class T> 00078 inline typename phoenix::actor<PushBackImpl<T> > PushBack(T &x) { 00079 return PushBackImpl<T> (x); 00080 } 00081 template <class T,typename IT> 00082 inline typename phoenix::actor<PushBackRefImpl<T,IT> > PushBack(T &x,IT it) { 00083 return PushBackRefImpl<T,IT> (x,it); 00084 } 00085 00086 template <class T> inline typename phoenix::actor<AssignBoolToStringImpl<T> > AssignBoolToString(T &x){ 00087 return AssignBoolToStringImpl<T> (x); 00088 } 00089 } // end of namespace Parsers 00090 } // end of namespace Gaudi 00091 00092 // ============================================================================ 00093 // The END 00094 // ============================================================================ 00095 #endif // JOBOPTIONSSVC_PARSERACTIONS_H 00096 // ============================================================================