common.h

00001 
00002 #ifndef SLIM_COMMON_H
00003 #define SLIM_COMMON_H
00004 
00005 namespace SMP{
00006 
00007 //typedef void(SLIMGUIComponent::*UINotifCallback)(int, int);
00008 
00009 
00010 //enumeration
00012 enum port_model { DATA_PORT = 0, SIGNAL_PORT };
00013 
00015 enum port_type { INPORT = 0, OUTPORT};
00016 
00017 // abstract base class
00018 class TFunctor
00019 {
00020     public:
00021         virtual ~TFunctor(){};
00022         virtual void operator()(int id, int nc) = 0;
00023 };
00024 
00025 
00026 // derived template class
00027 template <class TClass> class TNotifCallbackFunctor : public TFunctor
00028 {
00029     private:
00030         void (TClass::*fpt)(int, int);   // pointer to member function
00031         TClass* comp;                  // pointer to object
00032 
00033     public:
00034 
00035         // constructor - takes pointer to an object and pointer to a member and stores
00036         // them in two private variables
00037         TNotifCallbackFunctor(TClass* pt2Object, void(TClass::*callback)(int, int))
00038             : comp(pt2Object), fpt(callback)
00039         { }
00040 
00041         // override operator "()"
00042         virtual void operator()(int id, int nc)
00043         { 
00044             (*comp.*fpt)(id, nc);
00045         }            
00046 };
00047 
00048 
00049 }
00050 
00051 #endif

Generated on Fri Aug 31 15:41:42 2007 for SCREAMLinuxMiddleware(SLIM) by  doxygen 1.5.1