inlib
1.2.0
|
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved. 00002 // See the file inlib.license for terms. 00003 00004 #ifndef inlib_sg_action 00005 #define inlib_sg_action 00006 00007 #ifdef INLIB_MEM 00008 #include "../mem" 00009 #endif 00010 00011 #include <ostream> 00012 00013 namespace inlib { 00014 namespace sg { 00015 00016 class action { 00017 //public: 00018 static const std::string& s_class() { 00019 static const std::string s_v("inlib::sg::action"); 00020 return s_v; 00021 } 00022 public: 00023 //virtual void* cast(const std::string&) const = 0; 00024 public: 00025 action(std::ostream& a_out) 00026 :m_out(a_out) 00027 { 00028 #ifdef INLIB_MEM 00029 mem::increment(s_class().c_str()); 00030 #endif 00031 } 00032 virtual ~action(){ 00033 #ifdef INLIB_MEM 00034 mem::decrement(s_class().c_str()); 00035 #endif 00036 } 00037 protected: 00038 action(const inlib::sg::action& a_from) 00039 :m_out(a_from.m_out) 00040 { 00041 #ifdef INLIB_MEM 00042 mem::increment(s_class().c_str()); 00043 #endif 00044 } 00045 inlib::sg::action& operator=(const inlib::sg::action&){return *this;} 00046 public: 00047 std::ostream& out() {return m_out;} 00048 //void reset() { 00049 //} 00050 protected: 00051 std::ostream& m_out; 00052 }; 00053 00054 }} 00055 00056 #endif