diff --git a/xbmc/ack/include/ack/core/atomic_int.h b/xbmc/ack/include/ack/core/atomic_int.h index 82f0caf1373c1..d4a3d56e53c10 100644 --- a/xbmc/ack/include/ack/core/atomic_int.h +++ b/xbmc/ack/include/ack/core/atomic_int.h @@ -20,6 +20,7 @@ class ACK_CORE_API AtomicInt bool ref(); bool deref(); bool testAndSet(long expectedValue, long newValue); + long fetchAndStore(long newValue); long add(long valueToAdd); long sub(long valueToSub); }; diff --git a/xbmc/ack/include/ack/core/core.h b/xbmc/ack/include/ack/core/core.h index 3359cdaf69219..e2d31be9fcaf4 100644 --- a/xbmc/ack/include/ack/core/core.h +++ b/xbmc/ack/include/ack/core/core.h @@ -1,6 +1,7 @@ #pragma once #include "ack/core/core_global.h" #include "ack/core/abstract_core.h" +#include "ack/core/services/abstract_service_factory.h" #include "ack/pointer/pointer.h" #include @@ -8,7 +9,6 @@ namespace ack { namespace core { class AbstractService; -class AbstractServiceFactory; class ACK_CORE_API Core : public AbstractCore @@ -18,7 +18,7 @@ class ACK_CORE_API Core private: bool m_initialized; bool m_shutdown; - //typedef std::list ServiceFactories; + typedef std::list ServiceFactories; public: Core(); virtual ~Core(); diff --git a/xbmc/ack/include/ack/core/invoke_count.h b/xbmc/ack/include/ack/core/invoke_count.h index 18dc516cb683b..8794a4a6ed7ed 100644 --- a/xbmc/ack/include/ack/core/invoke_count.h +++ b/xbmc/ack/include/ack/core/invoke_count.h @@ -19,7 +19,7 @@ class ACK_CORE_API InvokeCount //! Invoke finished void leave(); bool isLocked(); - void waitFor(); + bool waitFor(); }; } // namespace core diff --git a/xbmc/ack/include/ack/core/services/abstract_service_factory.h b/xbmc/ack/include/ack/core/services/abstract_service_factory.h index 0a0affca70946..69049645b0569 100644 --- a/xbmc/ack/include/ack/core/services/abstract_service_factory.h +++ b/xbmc/ack/include/ack/core/services/abstract_service_factory.h @@ -3,7 +3,7 @@ namespace boost { namespace uuids { -class uuid; +struct uuid; } } @@ -19,8 +19,8 @@ class AbstractServiceFactory public: virtual AbstractService* create(const boost::uuids::uuid& aUuid) = 0; virtual void destroy(AbstractService* servicePtr) = 0; - UuidList uuidsList() const = 0; - bool canCreate(const boost::uuids::uuid& aUuid) const = 0; + virtual UuidsList uuidsList() const = 0; + virtual bool canCreate(const boost::uuids::uuid& aUuid) const = 0; virtual ~AbstractServiceFactory() {} }; diff --git a/xbmc/ack/include/ack/core/services/service_factory.h b/xbmc/ack/include/ack/core/services/service_factory.h index 2a307cb48790a..50c80f64ee4f7 100644 --- a/xbmc/ack/include/ack/core/services/service_factory.h +++ b/xbmc/ack/include/ack/core/services/service_factory.h @@ -1,93 +1,93 @@ -#pragma once -#include "ack/for_each_type.h" -#include "ack/pointer/pointer.h" -#include "ack/core/services/detail/service_creator.h" - -#include -#include - - -namespace ack { -namespace core { - -template -class ServiceFactory -{ -private: - typedef Pointer CreatorPtr; - typedef boost::unordered_map Creators; - - class Generator - { - Creators& m_creators; - public: - Generator(Creators& aCreators) - : m_creators(aCreators) - { - } - template - void operator()() - { - m_creators.insert( std::make_pair( Type::rootUuid() - , CreatorPtr( new DefaultServiceCreator() ) ) ); - } - }; - - explicit BaseServiceFactory(const BaseServiceFactory &); - Creators m_creators; -private: - AbstractServiceCreator* find(const boost::uuids::uuid& aUuid) - { - Creators::iterator it = m_creators.find(servicePtr->rootUuid()); - if (it != m_creators.end()) - return it->second.get(); - return 0; - } -protected: - inline Creators& creators() - { - return m_creators; - } -public: - ServiceFactory() - { - ::algorithm::for_each_type(Generator(creators())); - } - virtual ~ServiceFactory() {} - virtual AbstractService* createService(const boost::uuids::uuid& aUuid) - { - AbstractServiceCreator* cPtr = find(servicePtr->rootUuid()); - if (cPtr) - return cPtr->create(); - return 0; - } - virtual void destroy(AbstractService* servicePtr) - { - if (servicePtr) - { - AbstractServiceCreator* cPtr = find(servicePtr->rootUuid()); - if (cPtr) - cPtr->destroy(servicePtr); - servicePtr = 0; - } - } - UuidList uuidsList() const - { - UuidList list; - for (Creators::const_iterator it = m_creators.begin(); it != m_creators.end(); ++it) - list.push_back(it->first); - return list; - } - bool canCreate(const boost::uuids::uuid& aUuid) const - { - return (m_creators.find(aUuid) != m_creators.end()); - } -}; - -} // namespace core -} // namespace ack - - +#pragma once +#include "ack/for_each_type.h" +#include "ack/pointer/pointer.h" +#include "ack/core/services/detail/service_creator.h" + +#include +#include + + +namespace ack { +namespace core { + +template +class ServiceFactory +{ +private: + typedef Pointer CreatorPtr; + typedef boost::unordered_map Creators; + + class Generator + { + Creators& m_creators; + public: + Generator(Creators& aCreators) + : m_creators(aCreators) + { + } + template + void operator()() + { + m_creators.insert( std::make_pair( Type::rootUuid() + , CreatorPtr( new DefaultServiceCreator() ) ) ); + } + }; + + explicit BaseServiceFactory(const BaseServiceFactory &); + Creators m_creators; +private: + AbstractServiceCreator* find(const boost::uuids::uuid& aUuid) + { + Creators::iterator it = m_creators.find(servicePtr->rootUuid()); + if (it != m_creators.end()) + return it->second.get(); + return 0; + } +protected: + inline Creators& creators() + { + return m_creators; + } +public: + ServiceFactory() + { + ::algorithm::for_each_type(Generator(creators())); + } + virtual ~ServiceFactory() {} + virtual AbstractService* createService(const boost::uuids::uuid& aUuid) + { + AbstractServiceCreator* cPtr = find(servicePtr->rootUuid()); + if (cPtr) + return cPtr->create(); + return 0; + } + virtual void destroy(AbstractService* servicePtr) + { + if (servicePtr) + { + AbstractServiceCreator* cPtr = find(servicePtr->rootUuid()); + if (cPtr) + cPtr->destroy(servicePtr); + servicePtr = 0; + } + } + virtual UuidsList uuidsList() const + { + UuidsList list; + for (Creators::const_iterator it = m_creators.begin(); it != m_creators.end(); ++it) + list.push_back(it->first); + return list; + } + virtual bool canCreate(const boost::uuids::uuid& aUuid) const + { + return (m_creators.find(aUuid) != m_creators.end()); + } +}; + +} // namespace core +} // namespace ack + + #define IMPLEMENT_SERVICE_FACTORY(FactoryClassName, ServicesTypeList) \ \ class FactoryClassName\