Blame view

src/ParamGetImpl/LocalFileInterface/VirtualInstrumentManager.hh 1.69 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * 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_ */