Blame view

src/ParamGetImpl/DDServerInterface/VirtualInstrumentManager.cc 1.47 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
 * VirtualInstrumentManager.cc
 *
 *  Created on: Jan 17, 2013
 *      Author: f.casimir
 */

#include "VirtualInstrumentManager.hh"
#include "VirtualInstrument.hh"
#include "Properties.hh"

namespace AMDA {
	namespace DDServerInterface {

		VirtualInstrumentManager::VirtualInstrumentManager() {
			AMDA::helpers::Properties lProperties("app.properties");
29bf0a3d   Elena.Budnik   setUserName() cal...
17
18
                        _userHost = lProperties["app.user.host"];			
                        _userName = lProperties["app.user.name"];   
fbe3c2bb   Benjamin Renard   First commit
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
		}

		VirtualInstrumentManager::~VirtualInstrumentManager() {
		}

		VirtualInstrumentSPtr VirtualInstrumentManager::getVirtualInstrument(const std::string& pVirtualInstrumentName) {
			VirtualInstrumentSPtr lResult;
			auto lIt = _virtualInstrumentMap.find(pVirtualInstrumentName);
			if (lIt == _virtualInstrumentMap.end()) {
				lResult = VirtualInstrumentSPtr(new VirtualInstrument(*this,pVirtualInstrumentName));
				_virtualInstrumentMap[pVirtualInstrumentName]=lResult;
			} else {
				lResult = lIt->second.lock();
				if ( ! lResult) {
					_virtualInstrumentMap.erase(lIt);
					lResult = VirtualInstrumentSPtr(new VirtualInstrument(*this,pVirtualInstrumentName));
					_virtualInstrumentMap[pVirtualInstrumentName]=lResult;
				}
			}
			return lResult;
		}

		const char* VirtualInstrumentManager::getUserHost() {
			return _userHost.c_str();
		}
29bf0a3d   Elena.Budnik   setUserName() cal...
44
45
46
47
		
		const char* VirtualInstrumentManager::getUserName() {
			return _userName.c_str();
		}
fbe3c2bb   Benjamin Renard   First commit
48
49
	} /* namespace DDServerInterface */
} /* namespace AMDA */