IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
ProviderManager.h
1 // ProviderManager.h:
3 // ------------------
4 //
15 
16 #ifndef __IPSDKCORE_PROVIDERMANAGER_H__
17 #define __IPSDKCORE_PROVIDERMANAGER_H__
18 
19 // suppression warnings
20 // warning C4275: non dll-interface class 'boost::noncopyable_::noncopyable' used as base for dll-interface class 'ipsdk::core::ProviderManager'
21 // warning C4251: 'ipsdk::core::ProviderManager::_providerPriorityColl' : class 'std::map<_Kty,_Ty>' needs to have dll-interface to be used by clients of class 'ipsdk::core::ProviderManager'
22 #pragma warning (push)
23 #pragma warning (disable : 4275 4251)
24 
27 #include <boost/noncopyable.hpp>
28 #include <boost/thread/mutex.hpp>
29 #include <boost/thread/condition_variable.hpp>
30 
31 namespace ipsdk {
32 namespace core {
33 
36 
37 class IPSDKCORE_API ProviderManager : public boost::noncopyable
38 {
39 public:
43  ~ProviderManager();
45 
46 // methods
47 public:
49  bool isInit() const;
50 
52  void init();
53 
60  void addProvider(const ActionProviderPtr& pActionProvider,
61  bool bPushBack);
62 
65  void removeProvider(const ActionProviderPtr& pActionProvider);
66 
70  void askForNewAction(ActionRequestPtr& pActionRequest);
71 
74  void requestTermination();
75 
77  void clear();
78 
80  const ProviderPriorityColl& getProviderPriorityColl() const;
81 
82 // attributes
83 protected:
86 
89 
92  bool volatile _bTerminateRequested;
93 
95  mutable boost::mutex _mutex;
96 
98  boost::condition_variable _condition;
99 
101  bool _bInit;
102 };
103 
106 
107 inline bool
109 {
110  return _bInit;
111 }
112 
115 
116 } // end of namespace core
117 } // end of namespace ipsdk
118 
119 #pragma warning (pop)
120 
121 #endif // __IPSDKCORE_PROVIDERMANAGER_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
ipUInt32 volatile _nbPendingProviders
counter indicating number of pending providers
Definition: ProviderManager.h:88
Predefined types used for execution thread management.
ProviderPriorityColl _providerPriorityColl
collection of execution providers ordered by priority
Definition: ProviderManager.h:85
Definition of import/export macro for library.
std::map< ePriority, ProviderList > ProviderPriorityColl
collection of execution providers ordered by priority
Definition: ThreadManagerTypes.h:49
#define IPSDKCORE_API
Import/Export macro for library IPSDKCore.
Definition: IPSDKCoreExports.h:27
boost::condition_variable _condition
condition variable used to wake up execution threads
Definition: ProviderManager.h:98
boost::shared_ptr< BaseActionRequest > ActionRequestPtr
shared pointer for action requests
Definition: ActionRequestTypes.h:52
bool _bInit
object initialization flag
Definition: ProviderManager.h:101
Class allowing to manager providers execution with respect to their priority.
Definition: ProviderManager.h:37
boost::mutex _mutex
mutex allowing to protect concurrent accesses to object
Definition: ProviderManager.h:95
boost::shared_ptr< BaseActionProvider > ActionProviderPtr
shared pointer to action provider
Definition: ActionProviderTypes.h:58
bool isInit() const
retrieve object initialization flag
Definition: ProviderManager.h:108
bool volatile _bTerminateRequested
Definition: ProviderManager.h:92
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53