nidas v1.2.3
|
#include <Project.h>
Classes | |
class | MyDictionary |
Public Member Functions | |
Project () | |
virtual | ~Project () |
void | parseXMLConfigFile (const std::string &xmlfilepath) |
Convenient method to fill this Project instance from the configuration in the XML file at xmlfilepath , using the nidas::core::parseXMLConfigFile() function. | |
void | setName (const std::string &val) |
const std::string & | getName () const |
void | setSystemName (const std::string &val) |
const std::string & | getSystemName () const |
void | setConfigVersion (const std::string &val) |
const std::string & | getConfigVersion () const |
void | setConfigName (const std::string &val) |
const std::string & | getConfigName () const |
void | setFlightName (const std::string &val) |
const std::string & | getFlightName () const |
void | addSite (Site *val) |
const std::list< Site * > & | getSites () const |
int | getMaxSiteNumber () const |
Convenience function to return the maximum site number. | |
int | getMinSiteNumber () const |
void | addServer (DSMServer *srvr) |
A Project has one or more DSMServers. | |
const std::list< DSMServer * > & | getServers () const |
std::list< DSMServer * > | findServers (const std::string &hostname) const |
Look for a server for this project that either has no name or whose name matches hostname. | |
DSMServer * | findServer (const nidas::util::Inet4Address &addr) const |
const DSMConfig * | findDSM (const nidas::util::Inet4Address &addr) const |
Find a DSM whose name corresponds to a given IP address. | |
const DSMConfig * | findDSM (const std::string &name) const |
Find a DSMConfig in any site in this project whose name matches the given hostname . | |
const DSMConfig * | findDSM (unsigned int id) const |
Find a DSM matching id;. | |
std::list< nidas::core::FileSet * > | findServerSampleOutputStreamFileSets (const std::string &name) const |
Find SampleOutputStreamFileSets belonging to SampleArchivers of DSMServers whose name matches the argument name. | |
std::list< nidas::core::FileSet * > | findServerSampleOutputStreamFileSets () const |
Call findServerSampleOutputStreamFileSets(name) passing the nodename returned by uname(2). | |
std::list< nidas::core::FileSet * > | findSampleOutputStreamFileSets (const std::string &dsmName) const |
Find SampleOutputStreamFileSets belonging to the given DSM. | |
std::list< nidas::core::FileSet * > | findSampleOutputStreamFileSets () const |
Find SampleOutputStreamFileSets of all DSMs. | |
DSMSensor * | findSensor (dsm_sample_id_t id) const |
DSMSensor * | findSensor (const SampleTag *tag) const |
Site * | findSite (int stationNumber) const |
Find a Site with the given station number. | |
Site * | findSite (const std::string &name) const |
Find a Site with the given name. | |
dsm_sample_id_t | getUniqueSampleId (unsigned int dsmid) |
Get a temporary unique sample id for a given DSM id. | |
void | setSensorCatalog (SensorCatalog *val) |
SensorCatalog * | getSensorCatalog () const |
void | setDSMCatalog (DSMCatalog *val) |
DSMCatalog * | getDSMCatalog () const |
void | setServiceCatalog (ServiceCatalog *val) |
ServiceCatalog * | getServiceCatalog () const |
DSMServerIterator | getDSMServerIterator () const |
DSMServiceIterator | getDSMServiceIterator () const |
ProcessorIterator | getProcessorIterator () const |
SiteIterator | getSiteIterator () const |
DSMConfigIterator | getDSMConfigIterator () const |
SensorIterator | getSensorIterator () const |
SampleTagIterator | getSampleTagIterator () const |
VariableIterator | getVariableIterator () const |
void | initSensors () |
Initialize all sensors for a Project. | |
void | initSensors (Site *site) |
Initialize all sensors for a given Site. | |
void | initSensors (DSMConfig *dsm) |
Initialize all sensors for a given dsm. | |
const Parameter * | getParameter (const std::string &name) const |
void | fromDOMElement (const xercesc::DOMElement *) |
xercesc::DOMElement * | toDOMParent (xercesc::DOMElement *parent, bool complete) const |
xercesc::DOMElement * | toDOMElement (xercesc::DOMElement *node, bool complete) const |
std::string | expandString (const std::string &input) const |
Utility function to expand ${TOKEN} or $TOKEN fields in a string with their value from getTokenValue(). | |
bool | getTokenValue (const std::string &token, std::string &value) const |
Implement a lookup for tokens that I know about, like $PROJECT, and $SYSTEM. | |
const Dictionary & | getDictionary () const |
void | setDataset (const Dataset &val) |
const Dataset & | getDataset () const |
void | disableAutoconfig (bool disable) |
When true, autoconfig elements in the config document are removed before realizing the Project with fromDOMElement(). | |
Static Public Member Functions | |
static Project * | getInstance () |
Project is a singleton. | |
static void | destroyInstance () |
Destory the singleton. | |
static const XMLCh * | getNamespaceURI () |
Protected Member Functions | |
void | addParameter (Parameter *val) |
Add a parameter to this Project. | |
Private Member Functions | |
void | removeAutoConfig (xercesc::DOMNode *node, bool bumpRecursion=false) |
Scan the DOM and pull out any <autoconfig> tags, as well as change the autoconfig classes back to DSMSerialSensor, or isff.PropVane as needed, and remove porttype attributes. | |
Project (const Project &) | |
Copy not supported. | |
Project & | operator= (const Project &) |
Assignment not supported. | |
Private Attributes | |
std::string | _name |
std::string | _sysname |
std::string | _configVersion |
std::string | _configName |
Name of XML file that this project was initialized from. | |
std::string | _flightName |
nidas::core::Project::MyDictionary | _dictionary |
std::list< Site * > | _sites |
SensorCatalog * | _sensorCatalog |
DSMCatalog * | _dsmCatalog |
ServiceCatalog * | _serviceCatalog |
std::list< DSMServer * > | _servers |
nidas::util::Mutex | _lookupLock |
std::map< dsm_sample_id_t, const DSMConfig * > | _dsmById |
nidas::util::Mutex | _sensorMapLock |
std::map< dsm_sample_id_t, DSMSensor * > | _sensorById |
std::map< int, Site * > | _siteByStationNumber |
std::map< std::string, Site * > | _siteByName |
std::set< dsm_sample_id_t > | _usedIds |
int | _maxSiteNumber |
int | _minSiteNumber |
std::list< Parameter * > | _parameters |
List of pointers to Parameters. | |
Dataset | _dataset |
The current dataset. | |
bool | _disableAutoconfig |
Static Private Attributes | |
static Project * | _instance = 0 |
static XMLCh * | namespaceURI = 0 |
Project::Project | ( | ) |
References _instance.
Referenced by getInstance().
|
virtual |
References _dsmCatalog, _instance, _parameters, _sensorCatalog, _servers, _serviceCatalog, _sites, and nidas::core::getSample().
Copy not supported.
The main problem with a supporting a copy constructor is that one would need a clone for all the DSMSensors, which would be hard to get and keep correct. Instead of copying/cloning a project, create a new one and initialize it from a DOMElement.
Add a parameter to this Project.
Project will then own the pointer and will delete it in its destructor.
References _parameters.
Referenced by fromDOMElement().
References _lookupLock, _maxSiteNumber, _minSiteNumber, _siteByName, _siteByStationNumber, _sites, nidas::core::getSample(), nidas::util::Mutex::lock(), and nidas::util::Mutex::unlock().
Referenced by fromDOMElement().
|
static |
Destory the singleton.
References _instance.
Referenced by main(), AutoProject::~AutoProject(), and nidas::core::NidasApp::~NidasApp().
When true, autoconfig elements in the config document are removed before realizing the Project with fromDOMElement().
References _disableAutoconfig, and nidas::core::getSample().
Referenced by nidas::core::DSMEngine::initialize().
|
inline |
Utility function to expand ${TOKEN} or $TOKEN fields in a string with their value from getTokenValue().
If curly brackets are not used, then the TOKEN should be delimited by a '/', a '.' or the end of string, e.g.: xxx/yyy/$ZZZ.dat
References _dictionary, and nidas::core::Dictionary::expandString().
const DSMConfig * Project::findDSM | ( | const nidas::util::Inet4Address & | addr | ) | const |
Find a DSM whose name corresponds to a given IP address.
References DLOG, getDSMConfigIterator(), nidas::util::Inet4Address::getHostAddress(), nidas::core::getSample(), nidas::core::DSMConfigIterator::hasNext(), and WLOG.
Referenced by findDSM(), findSampleOutputStreamFileSets(), and nidas::core::DSMEngine::initialize().
Find a DSMConfig in any site in this project whose name matches the given hostname
.
If the hostname is fully qualified, then the match is attempted against the long name first and then the shortened name, with everything past the first '.' removed.
If there is only one DSM in the project config, then that DSM is always returned.
DSMEngine uses this method to look up it's DSMConfig instance on startup, based on the current hostname setting.
References DLOG, findDSM(), nidas::core::getSample(), getSites(), and WLOG.
Find a DSM matching id;.
References _dsmById, _lookupLock, DLOG, nidas::core::getSample(), getSiteIterator(), nidas::core::SiteIterator::hasNext(), nidas::util::Mutex::lock(), and nidas::util::Mutex::unlock().
list< nidas::core::FileSet * > Project::findSampleOutputStreamFileSets | ( | ) | const |
Find SampleOutputStreamFileSets of all DSMs.
References nidas::core::DSMConfig::findSampleOutputStreamFileSets(), getDSMConfigIterator(), nidas::core::getSample(), and nidas::core::DSMConfigIterator::hasNext().
list< nidas::core::FileSet * > Project::findSampleOutputStreamFileSets | ( | const std::string & | dsmName | ) | const |
Find SampleOutputStreamFileSets belonging to the given DSM.
References findDSM(), and nidas::core::getSample().
References findSensor(), and nidas::core::SampleTag::getId().
DSMSensor * Project::findSensor | ( | dsm_sample_id_t | id | ) | const |
References _sensorById, _sensorMapLock, nidas::core::getSample(), getSiteIterator(), nidas::core::SiteIterator::hasNext(), nidas::util::Mutex::lock(), and nidas::util::Mutex::unlock().
Referenced by findSensor().
DSMServer * Project::findServer | ( | const nidas::util::Inet4Address & | addr | ) | const |
References getDSMServerIterator(), and nidas::core::getSample().
Referenced by findServers().
Look for a server for this project that either has no name or whose name matches hostname.
Look for a server for this project that whose name matches my hostname.
If none found, remove any domain names and try again. Then search the project Sites.
If none found, remove any domain names and try again. If still none found return any configured servers with no name.
References findServer(), getDSMServerIterator(), nidas::core::DSMServer::getName(), and nidas::core::getSample().
Referenced by findServerSampleOutputStreamFileSets().
list< nidas::core::FileSet * > Project::findServerSampleOutputStreamFileSets | ( | ) | const |
Call findServerSampleOutputStreamFileSets(name) passing the nodename returned by uname(2).
nidas::util::Exception |
References findServerSampleOutputStreamFileSets(), nidas::core::getSample(), and WLOG.
Referenced by findServerSampleOutputStreamFileSets().
list< nidas::core::FileSet * > Project::findServerSampleOutputStreamFileSets | ( | const std::string & | name | ) | const |
Find SampleOutputStreamFileSets belonging to SampleArchivers of DSMServers whose name matches the argument name.
If no DSMServer names exactly match, then return the filesets corresponding to a DSMServer with an empty name.
References findServers(), nidas::core::SampleOutput::getIOChannel(), nidas::core::SampleIOProcessor::getOutputs(), and nidas::core::getSample().
Find a Site with the given name.
References _lookupLock, _siteByName, and nidas::core::getSample().
Find a Site with the given station number.
References _lookupLock, _siteByStationNumber, and nidas::core::getSample().
nidas::util::InvalidParameterException |
Implements nidas::core::DOMable.
References _dictionary, _disableAutoconfig, _maxSiteNumber, addParameter(), addServer(), addSite(), nidas::core::DOMObjectFactory::createObject(), nidas::core::Parameter::createParameter(), getName(), nidas::core::getSample(), ILOG, LogSchemeFromDOMElement(), removeAutoConfig(), setConfigName(), setConfigVersion(), setDSMCatalog(), setName(), setSensorCatalog(), setServiceCatalog(), and setSystemName().
Referenced by nidas::core::DSMEngine::initialize(), and parseXMLConfigFile().
|
inline |
References _configName.
|
inline |
References _configVersion.
|
inline |
References _dictionary.
|
inline |
References _dsmCatalog.
DSMConfigIterator Project::getDSMConfigIterator | ( | ) | const |
Referenced by findDSM(), and findSampleOutputStreamFileSets().
DSMServerIterator Project::getDSMServerIterator | ( | ) | const |
Referenced by findServer(), and findServers().
DSMServiceIterator Project::getDSMServiceIterator | ( | ) | const |
const string & Project::getFlightName | ( | ) | const |
References _flightName, _lookupLock, and nidas::core::getSample().
|
static |
Project is a singleton.
References _instance, and Project().
Referenced by nidas::dynld::StatisticsProcessor::addRequestedSampleTag(), AutoProject::AutoProject(), nidas::dynld::RawSampleService::connect(), nidas::dynld::raf::SyncRecordSource::connect(), nidas::dynld::XMLConfigService::connected(), nidas::dynld::UDPSampleOutput::connected(), nidas::dynld::raf::CVIProcessor::connectSource(), nidas::dynld::isff::WisardMote::createSampleTag(), nidas::core::NearestResampler::ctorCommon(), nidas::core::SampleTag::fromDOMElement(), nidas::core::Variable::fromDOMElement(), nidas::core::SampleIOProcessor::fromDOMElement(), nidas::core::SampleOutputBase::fromDOMElement(), nidas::core::NidasApp::getProject(), nidas::dynld::UDPSampleOutput::getProjectDOM(), nidas::dynld::isff::WindOrienter::handleParameter(), nidas::dynld::ParoSci_202BG_P::init(), nidas::dynld::ParoSci_202BG_T::init(), nidas::dynld::raf::SyncServer::initProject(), nidas::dynld::raf::SyncServer::initSensors(), main(), nidas::core::NearestResamplerAtRate::NearestResamplerAtRate(), nidas::dynld::isff::Wind3D::parseParameters(), ARLIngest::prepareHeaderIds(), nidas::core::SampleScanner::readBuffer(), DataStats::run(), DmdA2dCk::run(), DataPrep::run(), ExtractFast2D::run(), ExtractDMT::run(), nidas::dynld::XMLConfigService::Worker::run(), nidas::core::SampleAverager::SampleAverager(), nidas::core::SampleAverager::SampleAverager(), nidas::core::SampleAverager::SampleAverager(), nidas::core::HeaderSource::setDefaults(), nidas::core::FileSet::setDir(), nidas::core::FileSet::setFileName(), and nidas::dynld::SampleInputStream::setIOChannel().
|
inline |
Convenience function to return the maximum site number.
References _maxSiteNumber.
|
inline |
References _minSiteNumber.
|
inline |
References _name.
Referenced by SampleCounter::collectMetadata(), fromDOMElement(), nidas::core::Project::MyDictionary::getTokenValue(), and toDOMElement().
References nidas::core::DOMable::namespaceURI.
Referenced by nidas::dynld::UDPSampleOutput::getProjectDOM(), nidas::core::Dataset::toDOMElement(), nidas::core::ProjectConfig::toDOMElement(), nidas::core::Dataset::toDOMParent(), nidas::core::Datasets::toDOMParent(), nidas::core::ProjectConfig::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::DSMSensor::toDOMParent(), toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::Site::toDOMParent(), nidas::core::ServerSocket::toDOMParent(), nidas::core::Variable::toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
References _parameters, and nidas::core::getSample().
ProcessorIterator Project::getProcessorIterator | ( | ) | const |
SampleTagIterator Project::getSampleTagIterator | ( | ) | const |
Referenced by getUniqueSampleId().
|
inline |
References _sensorCatalog.
SensorIterator Project::getSensorIterator | ( | ) | const |
Referenced by nidas::core::DSMServer::getSensorIterator().
References _servers.
|
inline |
References _serviceCatalog.
SiteIterator Project::getSiteIterator | ( | ) | const |
Referenced by findDSM(), findSensor(), and toDOMElement().
References _sites.
Referenced by findDSM(), initSensors(), initSensors(), and initSensors().
|
inline |
References _sysname.
Referenced by nidas::core::Project::MyDictionary::getTokenValue().
|
inline |
Implement a lookup for tokens that I know about, like $PROJECT, and $SYSTEM.
For other tokens, look them up in the process environment.
References _dictionary, and nidas::core::Project::MyDictionary::getTokenValue().
dsm_sample_id_t Project::getUniqueSampleId | ( | unsigned int | dsmid | ) |
Get a temporary unique sample id for a given DSM id.
This id can be used for identifying derived samples during processing, when they are passed between SampleSources and SampleClients. The value of these ids is not saved anywhere, and so they are meant to be used for temporary connections, not for archived samples.
References _sensorMapLock, _usedIds, GET_DSM_ID, GET_SPS_ID, nidas::core::SampleTag::getId(), nidas::core::getSample(), getSampleTagIterator(), PLOG, SET_DSM_ID, and SET_SHORT_ID.
VariableIterator Project::getVariableIterator | ( | ) | const |
void Project::initSensors | ( | ) |
Initialize all sensors for a Project.
nidas::util::IOException |
References nidas::core::getSample(), and getSites().
Referenced by nidas::core::DSMServer::scheduleServices().
Initialize all sensors for a given dsm.
nidas::util::IOException |
References nidas::core::getSample(), and getSites().
Initialize all sensors for a given Site.
Initialize all sensors for a Site.
nidas::util::IOException |
References nidas::core::getSample(), and getSites().
Assignment not supported.
See comments about copy constructor.
Convenient method to fill this Project instance from the configuration in the XML file at xmlfilepath
, using the nidas::core::parseXMLConfigFile() function.
nidas::core::XMLException |
References fromDOMElement(), nidas::core::getSample(), nidas::core::parseXMLConfigFile(), and nidas::core::XMLImplementation::terminate().
Scan the DOM and pull out any <autoconfig> tags, as well as change the autoconfig classes back to DSMSerialSensor, or isff.PropVane as needed, and remove porttype attributes.
References nidas::core::getSample(), ILOG, removeAutoConfig(), and VLOG.
Referenced by fromDOMElement(), and removeAutoConfig().
References _configName, and nidas::core::getSample().
Referenced by fromDOMElement(), and nidas::core::DSMEngine::initialize().
References _configVersion, and nidas::core::getSample().
Referenced by fromDOMElement().
References _dataset, and nidas::core::getSample().
|
inline |
References _dsmCatalog, and nidas::core::getSample().
Referenced by fromDOMElement().
References _flightName, and nidas::core::getSample().
References _name, and nidas::core::getSample().
Referenced by fromDOMElement().
|
inline |
References _sensorCatalog, and nidas::core::getSample().
Referenced by fromDOMElement().
|
inline |
References _serviceCatalog, and nidas::core::getSample().
Referenced by fromDOMElement().
References _sysname, and nidas::core::getSample().
Referenced by fromDOMElement().
|
virtual |
xercesc::DOMException |
Reimplemented from nidas::core::DOMable.
References getName(), nidas::core::getSample(), getSiteIterator(), nidas::core::SiteIterator::hasNext(), and nidas::core::Site::toDOMParent().
Referenced by toDOMParent().
|
virtual |
xercesc::DOMException |
Reimplemented from nidas::core::DOMable.
References nidas::core::DOMable::getNamespaceURI(), and toDOMElement().
|
private |
Name of XML file that this project was initialized from.
Referenced by getConfigName(), and setConfigName().
|
private |
Referenced by getConfigVersion(), and setConfigVersion().
|
private |
The current dataset.
Referenced by getDataset(), and setDataset().
|
private |
Referenced by expandString(), fromDOMElement(), getDictionary(), and getTokenValue().
|
private |
Referenced by disableAutoconfig(), and fromDOMElement().
|
mutableprivate |
Referenced by findDSM().
|
private |
Referenced by getDSMCatalog(), setDSMCatalog(), and ~Project().
|
mutableprivate |
Referenced by getFlightName(), and setFlightName().
|
staticprivate |
Referenced by destroyInstance(), getInstance(), Project(), and ~Project().
|
mutableprivate |
Referenced by addSite(), findDSM(), findSite(), findSite(), and getFlightName().
|
private |
Referenced by addSite(), fromDOMElement(), and getMaxSiteNumber().
|
private |
Referenced by addSite(), and getMinSiteNumber().
|
private |
List of pointers to Parameters.
Referenced by addParameter(), getParameter(), and ~Project().
|
mutableprivate |
Referenced by findSensor().
|
private |
Referenced by getSensorCatalog(), setSensorCatalog(), and ~Project().
|
mutableprivate |
Referenced by findSensor(), and getUniqueSampleId().
|
private |
Referenced by addServer(), getServers(), and ~Project().
|
private |
Referenced by getServiceCatalog(), setServiceCatalog(), and ~Project().
|
private |
Referenced by addSite(), and findSite().
Referenced by addSite(), and findSite().
|
private |
Referenced by addSite(), getSites(), and ~Project().
|
private |
Referenced by getSystemName(), and setSystemName().
|
private |
Referenced by getUniqueSampleId().
|
staticprivateinherited |
Referenced by nidas::core::DOMable::getNamespaceURI().