Gaudi Framework, version v22r0

Home   Generated: 9 Feb 2011

ParserActions.h

Go to the documentation of this file.
00001 // $Id: ParserActions.h,v 1.2 2007/05/24 14:41:21 hmd Exp $
00002 // ============================================================================
00003 // CVS tag $Name:  $
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/version.hpp>
00017 #if BOOST_VERSION >= 103800
00018 // FIXME: Move to the new boost::spirit::classic namespace
00019 #if !defined(BOOST_SPIRIT_USE_OLD_NAMESPACE)
00020 #define BOOST_SPIRIT_USE_OLD_NAMESPACE
00021 #endif
00022 #include <boost/spirit/include/phoenix1.hpp>
00023 #else
00024 #include <boost/spirit/phoenix.hpp>
00025 #endif
00026 // ============================================================================
00027 // Boost.conversion
00028 // ============================================================================
00029 #include <boost/lexical_cast.hpp>
00030 // ============================================================================
00031 namespace Gaudi
00032 {
00033   namespace Parsers
00034   {
00035     template <class T>
00036     class PushBackImpl
00037     {
00038       T&data;
00039      public:
00040       PushBackImpl(T &x):data(x){}
00041       template <class Arg>
00042         struct result{
00043           typedef void type;
00044         };
00045 
00046       template <class Arg>
00047         void eval(const Arg &x)const{
00048         data().push_back(x[phoenix::tuple_index<0>()]);
00049       }
00050     };
00051     template <class T,typename IT>
00052     class PushBackRefImpl
00053     {
00054       T& data;
00055       IT item;
00056      public:
00057       PushBackRefImpl(T &x,IT it):data(x),item(it){}
00058       template <class Arg>
00059         struct result{
00060           typedef void type;
00061         };
00062 
00063       template <class Arg>
00064       void eval(const Arg & /*x*/ )const{
00065         data().push_back(item);
00066       }
00067     };
00068 
00069     template <class T>
00070       class AssignBoolToStringImpl
00071       {
00072         T &data;
00073       public:
00074         AssignBoolToStringImpl(T &x):data(x){}
00075         template <class Arg>
00076           struct result{
00077             typedef void type;
00078           };
00079 
00080         template <class Arg>
00081         void eval(const Arg &x)const{
00082           data() = x[phoenix::tuple_index<0>()]?"1":"0";
00083         }
00084     };
00085 
00086     template <class T>
00087     inline typename phoenix::actor<PushBackImpl<T> > PushBack(T &x) {
00088       return PushBackImpl<T> (x);
00089     }
00090     template <class T,typename IT>
00091     inline typename phoenix::actor<PushBackRefImpl<T,IT> > PushBack(T &x,IT it) {
00092       return PushBackRefImpl<T,IT> (x,it);
00093     }
00094 
00095     template <class T> inline typename phoenix::actor<AssignBoolToStringImpl<T> > AssignBoolToString(T &x){
00096       return AssignBoolToStringImpl<T> (x);
00097     }
00098   } // end of namespace Parsers
00099 } // end of namespace Gaudi
00100 
00101 // ============================================================================
00102 // The END
00103 // ============================================================================
00104 #endif // JOBOPTIONSSVC_PARSERACTIONS_H
00105 // ============================================================================
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Wed Feb 9 16:25:02 2011 for Gaudi Framework, version v22r0 by Doxygen version 1.6.2 written by Dimitri van Heesch, © 1997-2004