/* * 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"); _userHost = lProperties["app.user.host"]; } 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(); } } /* namespace DDServerInterface */ } /* namespace AMDA */