CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/DetectorDescription/Parser/src/DDLMap.h

Go to the documentation of this file.
00001 #ifndef DDL_Map_H
00002 #define DDL_Map_H
00003 
00004 #include "DetectorDescription/Parser/src/DDXMLElement.h"
00005 #include "DetectorDescription/Core/interface/DDMap.h"
00006 
00007 #include <vector>
00008 #include <map>
00009 #include <string>
00010 
00011 // Boost parser, spirit, for parsing the std::vector elements.
00012 #include "boost/spirit/include/classic.hpp"
00013 
00014 namespace boost { namespace spirit { namespace classic { } } }
00015 
00016 class Mapper : public boost::spirit::classic::grammar<Mapper> {
00017 public:
00018   Mapper() { };
00019   ~Mapper() { };
00020   template <typename ScannerT> struct definition;
00021 };
00022 
00023 class MapPair {
00024 public:
00025   MapPair() { };
00026   ~MapPair() { };
00027   void operator()(char const* str, char const* end) const;
00028 };
00029 
00030 class MapMakeName {
00031 public:
00032   MapMakeName() { };
00033   ~MapMakeName() { };
00034   void operator()(char const* str, char const* end) const;
00035 };
00036 
00037 class MapMakeDouble {
00038 public:
00039   MapMakeDouble() { };
00040   ~MapMakeDouble() { };
00041   void operator()(char const* str, char const* end) const;
00042 };
00043 
00045 
00058 class DDLMap : public DDXMLElement
00059 {
00060   friend class MapPair;
00061   friend class MapMakeName;
00062   friend class MapMakeDouble;
00063 
00064 public:
00065 
00066   DDLMap( DDLElementRegistry* myreg );
00067 
00068   virtual ~DDLMap( void );
00069 
00070   void preProcessElement( const std::string& name, const std::string& nmspace, DDCompactView& cpv );
00071 
00072   void processElement( const std::string& name, const std::string& nmspace, DDCompactView& cpv );
00073 
00074   ReadMapType<std::map<std::string,double> > & getMapOfMaps( void );
00075 
00076 private:
00077   dd_map_type pMap;
00078   ReadMapType<std::map<std::string,double> > pMapMap;
00079   double pDouble;
00080   std::string pName;
00081   std::string pNameSpace;
00082 
00083   void errorOut( const char* str );
00084 
00085   void do_pair( char const* str, char const* end );
00086 
00087   void do_makeName( char const* str, char const* end );
00088 
00089   void do_makeDouble( char const* str, char const* end );
00090 };
00091 
00092 #endif