Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

slotbuffer_v1.h

Go to the documentation of this file.
00001 
00002 #ifndef header_slotbuffer_v1
00003 #define header_slotbuffer_v1
00004 
00005 #include <vector>
00006 
00007 template <class PARAM1>
00008 class CL_SlotBuffer_v1
00009 {
00010 public:
00011         struct Params
00012         {
00013                 PARAM1 p1;
00014         };
00015 
00016 // Construction:
00017 public:
00018         CL_SlotBuffer_v1()
00019         {
00020         }
00021 
00022         CL_SlotBuffer_v1(CL_Signal_v1<PARAM1> &signal)
00023         {
00024                 connect(signal);
00025         }
00026 
00027 // Attributes:
00028 public:
00029         operator bool()
00030         {
00031                 return !params.empty();
00032         }
00033 
00034         int size()
00035         {
00036                 return params.size();
00037         }
00038 
00039         Params &operator[](int index)
00040         {
00041                 return params[index];
00042         }
00043 
00044 // Operations:
00045 public:
00046         void connect(CL_Signal_v1<PARAM1> &signal)
00047         {
00048                 slot = signal.connect(CL_CreateSlot(this, &CL_SlotBuffer_v1::callback));
00049         }
00050 
00051         void disconnect(CL_Signal_v1<PARAM1> &signal)
00052         {
00053                 signal.disconnect(slot);
00054         }
00055 
00056 // Implementation:
00057 private:
00058         void callback(PARAM1 p1)
00059         {
00060                 Params p;
00061                 p.p1 = p1;
00062 
00063                 params.push_back(p);
00064         }
00065 
00066         std::vector<Params> params;
00067         CL_Slot slot;
00068 };
00069 
00070 #endif

Generated at Wed Apr 4 19:54:03 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001