20.10.2013 - Modified PIObject - virtual debugName() for macro piCoutObj, improved timer measurements and timers on Windows
This commit is contained in:
23
piconfig.h
23
piconfig.h
@@ -259,7 +259,30 @@ private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline std::ostream & operator <<(std::ostream & s, const PIConfig::Branch & v) {v.coutt(s, ""); return s;}
|
||||
inline std::ostream & operator <<(std::ostream & s, const PIConfig::Entry & v) {s << v.value(); return s;}
|
||||
|
||||
|
||||
/** \relatesalso PIConfig \relatesalso PIIODevice
|
||||
* \brief Service function. useful for configuring devices
|
||||
* \details Function takes entry name "name", default value "def" and two
|
||||
* \a PIConfig::Entry sections: "em" and their parent "ep". If there is no
|
||||
* parent ep = 0. If "ep" is not null and entry "name" exists in "ep" function
|
||||
* returns this value. Else returns value of entry "name" in section "em" or
|
||||
* "def" if entry doesn`t exists. \n This function useful to read settings
|
||||
* from configuration file in implementation \a PIIODevice::configureDevice() function */
|
||||
template<typename T>
|
||||
T readDeviceSetting(const PIString & name, const T & def, const PIConfig::Entry * em, const PIConfig::Entry * ep) {
|
||||
if (ep != 0) {
|
||||
T ret;
|
||||
bool ex;
|
||||
ret = ep->getValue(name, def, &ex);
|
||||
if (!ex) ret = em->getValue(name, def);
|
||||
return ret;
|
||||
}
|
||||
return em->getValue(name, def);
|
||||
|
||||
}
|
||||
|
||||
#endif // PICONFIG_H
|
||||
|
||||
Reference in New Issue
Block a user