VirtualInstrumentManager.hh 1.41 KB
/*
 * VirtualInstrumentManager.hh
 *
 *  Created on: Jan 17, 2013
 *      Author: f.casimir
 */

#ifndef VIRTUALINSTRUMENTMANAGER_HH_
#define VIRTUALINSTRUMENTMANAGER_HH_

#include <string>
#include <map>

#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>

#include "dsgpatt_Singleton.hh"

namespace AMDA {
	namespace DDServerInterface {

		class VirtualInstrument;
		typedef boost::weak_ptr<VirtualInstrument>  VirtualInstrumentWPtr;
		typedef boost::shared_ptr<VirtualInstrument>  VirtualInstrumentSPtr;

		/**
		 * @class VirtualInstrumentManager
		 * @brief This Singleton contains and maintain a set of VirtualInstrument object with key as VIName.
		 */
		class VirtualInstrumentManager : public ::Singleton<VirtualInstrumentManager> {
		public:

			typedef std::map<std::string,VirtualInstrumentWPtr> VirtualInstrumentMap;

			// Design pattern
			friend class Singleton<VirtualInstrumentManager>;

			/**
			 * @brief If the VI not exist, create it.
			 * @return a SharedPtr on a VirtualInstrument.
			 */
			VirtualInstrumentSPtr getVirtualInstrument(const std::string& pVirtualInstrumentName);

			const char* getUserHost();

		private:
			VirtualInstrumentManager();
			virtual ~VirtualInstrumentManager();

			VirtualInstrumentMap _virtualInstrumentMap; /*!< VirtualInstrument list */
			std::string _userHost;
		};

	} /* namespace DDServerInterface */
} /* namespace AMDA */
#endif /* VIRTUALINSTRUMENTMANAGER_HH_ */