Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights 1 // Copyright (C) 2010, Guy Barrand. All rights reserved. 2 // See the file tools.license for terms. 2 // See the file tools.license for terms. 3 3 4 #ifndef tools_rroot_ifac 4 #ifndef tools_rroot_ifac 5 #define tools_rroot_ifac 5 #define tools_rroot_ifac 6 6 7 #include <string> 7 #include <string> 8 #include <map> 8 #include <map> 9 #include <ostream> 9 #include <ostream> 10 10 11 namespace tools { 11 namespace tools { 12 namespace rroot { 12 namespace rroot { 13 class iro; 13 class iro; 14 }} 14 }} 15 15 16 namespace tools { 16 namespace tools { 17 namespace rroot { 17 namespace rroot { 18 18 19 class ifac { 19 class ifac { 20 public: 20 public: 21 typedef std::map<char,void*> args; 21 typedef std::map<char,void*> args; 22 public: 22 public: 23 virtual ~ifac(){} 23 virtual ~ifac(){} 24 public: 24 public: 25 virtual std::ostream& out() const = 0; 25 virtual std::ostream& out() const = 0; 26 virtual iro* create(const std::string& a_cla 26 virtual iro* create(const std::string& a_class,const args&) = 0; 27 public: 27 public: 28 static void* find_args(const args& a_args,ch 28 static void* find_args(const args& a_args,char a_key) { 29 std::map<char,void*>::const_iterator it = 29 std::map<char,void*>::const_iterator it = a_args.find(a_key); 30 if(it==a_args.end()) return 0; 30 if(it==a_args.end()) return 0; 31 return (*it).second; 31 return (*it).second; 32 } 32 } 33 //static char arg_branch() {return 'B';} 33 //static char arg_branch() {return 'B';} 34 static char arg_class() {return 'C';} 34 static char arg_class() {return 'C';} 35 35 36 static std::string* arg_class(const args& a_ 36 static std::string* arg_class(const args& a_args) { 37 void* p = ifac::find_args(a_args,ifac::arg 37 void* p = ifac::find_args(a_args,ifac::arg_class()); 38 if(!p) return 0; 38 if(!p) return 0; 39 return (std::string*)p; 39 return (std::string*)p; 40 } 40 } 41 }; 41 }; 42 42 43 }} 43 }} 44 44 45 #endif 45 #endif