1 #ifndef __ACTIONS_INL_H__
2 #define __ACTIONS_INL_H__
6 #include "stg_locker.h"
8 // Polymorphick action invocation
9 template <class ACTIVE_CLASS, typename DATA_TYPE>
11 void ACTION<ACTIVE_CLASS, DATA_TYPE>::Invoke()
13 (activeClass.*actor)(data);
17 ACTIONS_LIST::ACTIONS_LIST()
20 pthread_mutex_init(&mutex, NULL);
23 // Delete all actions before deleting list
25 ACTIONS_LIST::~ACTIONS_LIST()
29 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
31 parent::iterator it(parent::begin());
32 while (it != parent::end())
38 pthread_mutex_destroy(&mutex);
42 ACTIONS_LIST::parent::iterator ACTIONS_LIST::begin()
44 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
45 return parent::begin();
49 ACTIONS_LIST::parent::iterator ACTIONS_LIST::end()
51 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
56 ACTIONS_LIST::parent::const_iterator ACTIONS_LIST::begin() const
58 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
59 return parent::begin();
63 ACTIONS_LIST::parent::const_iterator ACTIONS_LIST::end() const
65 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
70 bool ACTIONS_LIST::empty() const
72 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
73 return parent::empty();
77 size_t ACTIONS_LIST::size() const
79 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
80 return parent::size();
84 void ACTIONS_LIST::swap(ACTIONS_LIST & list)
86 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
90 template <class ACTIVE_CLASS, typename DATA_TYPE>
92 void ACTIONS_LIST::Enqueue(ACTIVE_CLASS & ac,
93 typename ACTOR<ACTIVE_CLASS, DATA_TYPE>::TYPE a,
96 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
97 push_back(new ACTION<ACTIVE_CLASS, DATA_TYPE>(ac, a, d));
101 void ACTIONS_LIST::InvokeAll()
103 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
107 std::mem_fun(&BASE_ACTION::Invoke)