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