+private:
+ class FunctionCommand : public Command
+ {
+ public:
+ FunctionCommand( command_t fun )
+ : f_(fun) {}
+
+ virtual bool operator()(const SGPropertyNode * arg) { return (*f_)(arg); }
+ private:
+ command_t f_;
+ };
+
+ template< class ObjPtr, typename MemFn >
+ class MethodCommand : public Command
+ {
+ public:
+ MethodCommand( const ObjPtr& pObj, MemFn pMemFn ) :
+ pObj_(pObj), pMemFn_(pMemFn) {}
+
+ virtual bool operator()(const SGPropertyNode * arg)
+ {
+ return ((*pObj_).*pMemFn_)(arg);
+ }
+ private:
+ ObjPtr pObj_;
+ MemFn pMemFn_;
+ };
+
+ /**
+ * Helper template functions.
+ */
+
+ template< class ObjPtr, typename MemFn >
+ Command* make_functor( const ObjPtr& pObj, MemFn pMemFn )
+ {
+ return new MethodCommand<ObjPtr,MemFn>(pObj, pMemFn );
+ }
+
+public:
+ /**
+ * Default constructor (sets instance to created item)
+ */
+ SGCommandMgr ();