00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef RESOURCEPOOL_NOOPCOMMANDWRAPPER_HH
00025 #define RESOURCEPOOL_NOOPCOMMANDWRAPPER_HH
00026
00027 #include "mm/gc_ptr.hh"
00028 #include "util/Clone.hh"
00029
00030 namespace fatalmind {
00031
00037 template<class CommandType>
00038 class NoopCommandWrapper: public CommandType
00039 {
00040 protected:
00041 private:
00042 gc_ptr<CommandType> m;
00043
00044 NoopCommandWrapper(const NoopCommandWrapper& rho)
00045 : CommandType(rho)
00046 , m(rho.m)
00047 {
00048 }
00049 public:
00050 NoopCommandWrapper(const CommandType& a_m)
00051 : CommandType(a_m)
00052 , m(a_m.template clone<CommandType>())
00053 {
00054 };
00055 virtual ~NoopCommandWrapper() {
00056 }
00057
00058 virtual void execute(typename CommandType::pool_type::resource_t& r) {
00059
00060 }
00061
00062 const CommandType& getCommandRef() const {
00063 return *m.get();
00064 }
00065
00066 virtual void outputoperator(std::ostream& s) const {
00067 s << "NoopCommandWrapper[";
00068 m->outputoperator(s);
00069 s << ']';
00070 }
00071 protected:
00072 virtual Clone* DoClone() const {
00073 return new NoopCommandWrapper(*this);
00074 }
00075
00076 };
00077
00078 }
00079 #endif