Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/sg/action is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_sg_action
0005 #define tools_sg_action
0006 
0007 #ifdef TOOLS_MEM
0008 #include "../mem"
0009 #endif
0010 
0011 #include "../S_STRING"
0012 #include "../scast"
0013 
0014 #include <ostream>
0015 
0016 namespace tools {
0017 namespace sg {
0018 
0019 class action {
0020 public:
0021   TOOLS_SCLASS(tools::sg::action)
0022 public:
0023   virtual void* cast(const std::string& a_class) const {
0024     if(void* p = cmp_cast<action>(this,a_class)) return p;
0025     return 0;
0026   }
0027   virtual const std::string& s_cls() const = 0;
0028 public:
0029   action(std::ostream& a_out)
0030   :m_out(a_out)
0031   {
0032 #ifdef TOOLS_MEM
0033     mem::increment(s_class().c_str());
0034 #endif
0035   }
0036   virtual ~action(){
0037 #ifdef TOOLS_MEM
0038     mem::decrement(s_class().c_str());
0039 #endif
0040   }
0041 protected:
0042   action(const action& a_from)
0043   :m_out(a_from.m_out)
0044   {
0045 #ifdef TOOLS_MEM
0046     mem::increment(s_class().c_str());
0047 #endif
0048   }
0049   action& operator=(const action&){return *this;}
0050 public:
0051   std::ostream& out() const {return m_out;}
0052   //void reset() {
0053   //}
0054 protected:
0055   std::ostream& m_out;
0056 };
0057 
0058 #include "../HEADER"
0059 
0060 #define TOOLS_ACTION(a__class,a__sclass,a__parent)\
0061   TOOLS_HEADER(a__class,a__sclass,a__parent)\
0062   virtual tools::sg::action* copy() const {return new a__class(*this);}
0063 
0064 #define TOOLS_ACTION_NO_COPY(a__class,a__sclass,a__parent)\
0065   TOOLS_HEADER(a__class,a__sclass,a__parent)
0066 
0067 }}
0068 
0069 #endif