VirtualInstrumentManager.hh 1.69 KB
/*
 * VirtualInstrumentManager.hh
 *
 *  Created on: Nov 21, 2014
 *      Author: AKKA
 */

#ifndef VIRTUALINSTRUMENTMANAGER_HH_
#define VIRTUALINSTRUMENTMANAGER_HH_

#include "VirtualInstrumentBaseParser.hh"

#include <string>
#include <map>

#include "dsgpatt_Singleton.hh"

namespace AMDA {

namespace LocalFileInterface {

class VirtualInstrument;

/**
 * @class VirtualInstrumentManager
 * @brief This Singleton contains and maintain a set of VirtualInstrument object with key as VIId.
 */
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& pVirtualInstrumentId);

	/*
	 * @brief Get local base path
	 */
	std::string getBasePath(void)
	{
		return _localBasePath;
	}

private:
	VirtualInstrumentManager();

	virtual ~VirtualInstrumentManager();

	/*
	 * @brief Init a new virtual instrument
	 */
	bool initNewVirtualInstrument(VirtualInstrumentSPtr lResult);

	/*
	 * @brief Load info about a given VirtualInstrument in local base
	 */
	bool loadVirtualInstrumentInfo(VirtualInstrumentSPtr lResult);

	/*
	 * @brief Local base path
	 */
	std::string _localBasePath;

	/*
	 * @brief VirtualInstrument map
	 */
	VirtualInstrumentMap _virtualInstrumentMap;

	/*
	 * @brief local base parser
	 */
	boost::shared_ptr<VirtualInstrumentBaseParser> _virtualInstrumentParserSPtr;
};

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