ovkCAlgorithmManager.h 1.62 KB
Newer Older
1 2
#ifndef __OpenViBEKernel_Kernel_Algorithm_CAlgorithmManager_H__
#define __OpenViBEKernel_Kernel_Algorithm_CAlgorithmManager_H__
OpenViBE Posse's avatar
OpenViBE Posse committed
3 4 5 6 7

#include "../ovkTKernelObject.h"

#include <map>

8 9 10
#include <boost/thread.hpp> // for mutex
#include <boost/thread/condition.hpp>

OpenViBE Posse's avatar
OpenViBE Posse committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
namespace OpenViBE
{
	namespace Kernel
	{
		class CAlgorithm;
		class CAlgorithmProxy;

		class CAlgorithmManager : public OpenViBE::Kernel::TKernelObject < OpenViBE::Kernel::IAlgorithmManager >
		{
		public:

			CAlgorithmManager(const OpenViBE::Kernel::IKernelContext& rKernelContext);
			virtual ~CAlgorithmManager(void);

			virtual OpenViBE::CIdentifier createAlgorithm(
				const OpenViBE::CIdentifier& rAlgorithmClassIdentifier);
			virtual OpenViBE::boolean releaseAlgorithm(
				const OpenViBE::CIdentifier& rAlgorithmIdentifier);
			virtual OpenViBE::boolean releaseAlgorithm(
				OpenViBE::Kernel::IAlgorithmProxy& rAlgorithm);
			virtual OpenViBE::Kernel::IAlgorithmProxy& getAlgorithm(
				const OpenViBE::CIdentifier& rAlgorithmIdentifier);
			virtual OpenViBE::CIdentifier getNextAlgorithmIdentifier(
				const OpenViBE::CIdentifier& rPreviousIdentifier) const;

			_IsDerivedFromClass_Final_(OpenViBE::Kernel::TKernelObject<OpenViBE::Kernel::IAlgorithmManager>, OVK_ClassId_Kernel_Algorithm_AlgorithmManager);

		protected:

			virtual OpenViBE::CIdentifier getUnusedIdentifier(void) const;

		protected:

			std::map < OpenViBE::CIdentifier, std::pair < OpenViBE::Kernel::CAlgorithm*, OpenViBE::Kernel::CAlgorithmProxy* > > m_vAlgorithm;
45 46

			mutable boost::mutex m_oLock; // Protects the array for threads
OpenViBE Posse's avatar
OpenViBE Posse committed
47 48 49 50
		};
	};
};

51
#endif // __OpenViBEKernel_Kernel_Algorithm_CAlgorithmManager_H__