Blame view

src/ParamGetImpl/DDServerInterface/VirtualInstrumentManager.cc 3.03 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();
		}
80111081   Benjamin Renard   Add executable am...
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

		int VirtualInstrumentManager::ddErrorToAmdaError(int ddError) {
			if (ddError >= 0)
				return 0;
			switch (ddError) {
				case NOCONNECTION:
					return AMDA_ERROR_NOCONNECTION;
				case TOOMANYREQ:
					return AMDA_ERROR_TOOMANYREQ;
				case REQSENDERR:
					return AMDA_ERROR_REQSENDERR;
				case REPLYRECERR:
					return AMDA_ERROR_REPLYRECERR;
				case NOID:
					return AMDA_ERROR_NOID;
				case NOREFFILE:
					return AMDA_ERROR_NOREFFILE;
				case NOTIMESFILE:
					return AMDA_ERROR_NOTIMESFILE;
				case NOINFOFILE:
					return AMDA_ERROR_NOINFOFILE;
				case NOVAR:
					return AMDA_ERROR_NOVAR;
				case OUTOFTIME:
					return AMDA_ERROR_OUTOFTIME;
				case CACHERR:
					return AMDA_ERROR_CACHERR;
				case CACHTOOREC:
					return AMDA_ERROR_CACHTOOREC;
				case WAITEXTCALL:
					return AMDA_ERROR_WAITEXTCALL;
				case TRYAGAIN:
					return AMDA_ERROR_TRYAGAIN;
				case NODATAATTIME:
					return AMDA_ERROR_NODATAATTIME;
				case GAPISSMALL:
					return AMDA_ERROR_GAPISSMALL;
				case CTIMEISSHIFTED:
					return AMDA_ERROR_CTIMEISSHIFTED;
				case DATAFILEERR:
					return AMDA_ERROR_DATAFILEERR;
				case ENVIRERROR:
					return AMDA_ERROR_ENVIRERROR;
				case NOPOINTER:
					return AMDA_ERROR_NOPOINTER;
				case INTSERERR:
					return AMDA_ERROR_INTSERERR;
				case TIMEINEMPTY:
					return AMDA_ERROR_TIMEINEMPTY;
				case NOEXEC:
					return AMDA_ERROR_NOEXEC;
				case NOPERMISSION:
					return AMDA_ERROR_OPERMISSION;
				case NOHOST:
					return AMDA_ERROR_NOHOST;
				case NOUSERSFILE:
					return AMDA_ERROR_NNOUSERSFILE;
			}
			return AMDA_ERROR_UNKNOWN;
		}
fbe3c2bb   Benjamin Renard   First commit
108
109
	} /* namespace DDServerInterface */
} /* namespace AMDA */