X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/a500fb72810060e52d87ad2c2e4691531f0bcc5a..479b8853c2ab18c98926a9369a03888021e9b986:/projects/stargazer/actions.inl.h diff --git a/projects/stargazer/actions.inl.h b/projects/stargazer/actions.inl.h deleted file mode 100644 index 7a0bac35..00000000 --- a/projects/stargazer/actions.inl.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef __ACTIONS_INL_H__ -#define __ACTIONS_INL_H__ - -#include - -#include "stg/locker.h" - -// Polymorphick action invocation -template -inline -void ACTION::Invoke() -{ -(activeClass.*actor)(data); -} - -inline -ACTIONS_LIST::ACTIONS_LIST() -{ -} - -// Delete all actions before deleting list -inline -ACTIONS_LIST::~ACTIONS_LIST() -{ -std::lock_guard lock(m_mutex); - -parent::iterator it(parent::begin()); -while (it != parent::end()) - delete *it++; -} - -inline -ACTIONS_LIST::parent::iterator ACTIONS_LIST::begin() -{ -std::lock_guard lock(m_mutex); -return parent::begin(); -} - -inline -ACTIONS_LIST::parent::iterator ACTIONS_LIST::end() -{ -std::lock_guard lock(m_mutex); -return parent::end(); -} - -inline -ACTIONS_LIST::parent::const_iterator ACTIONS_LIST::begin() const -{ -std::lock_guard lock(m_mutex); -return parent::begin(); -} - -inline -ACTIONS_LIST::parent::const_iterator ACTIONS_LIST::end() const -{ -std::lock_guard lock(m_mutex); -return parent::end(); -} - -inline -bool ACTIONS_LIST::empty() const -{ -std::lock_guard lock(m_mutex); -return parent::empty(); -} - -inline -size_t ACTIONS_LIST::size() const -{ -std::lock_guard lock(m_mutex); -return parent::size(); -} - -inline -void ACTIONS_LIST::swap(ACTIONS_LIST & list) -{ -std::lock_guard lock(m_mutex); -parent::swap(list); -} - -template -inline -void ACTIONS_LIST::Enqueue(ACTIVE_CLASS & ac, - typename ACTOR::TYPE a, - DATA_TYPE d) -{ -std::lock_guard lock(m_mutex); -push_back(new ACTION(ac, a, d)); -} - -inline -void ACTIONS_LIST::InvokeAll() -{ -std::lock_guard lock(m_mutex); -std::for_each( - parent::begin(), - parent::end(), - [](auto action){ action->Invoke(); }); -} - -#endif