1 #ifndef __JEEP__JPROPERTIES__ 
    2 #define __JEEP__JPROPERTIES__ 
   32 namespace JPP { 
using namespace JEEP; }
 
   45   using JLANG::JComparisonAvailable;
 
   59     return in.bad() || (in.fail() && !in.eof());
 
  134     virtual std::istream& 
read(std::istream& 
in)
 override  
  144       if (!buffer.empty()) {
 
  160     virtual std::ostream& 
write(std::ostream& out,
 
  162                                 const char    postfix)
 const override 
  174     virtual std::ostream& 
write(std::ostream& out)
 const override  
  232     virtual std::istream& 
read(std::istream& 
in)
 override  
  244     virtual std::ostream& 
write(std::ostream& out)
 const override  
  258     virtual std::ostream& 
write(std::ostream& out,
 
  260                                 const char    postfix)
 const override 
  404       std::ostringstream os;
 
  406       get()->
write(os, 
"", 
'\0');
 
  422       std::istringstream 
in(this->toString());
 
  436     operator const T&() 
const 
  438       return getValue<T>();
 
  498     public std::map<std::string, JPropertiesElement>,
 
  520       const size_type pos = buffer.find_last_of(sep);
 
  522       if (pos != string::npos)
 
  523         return buffer.substr(pos + 1);
 
  538         properties(__properties)
 
  569         fileReader.
read(file_name);
 
  596         std::ifstream 
in(file_name.c_str());
 
  636                 const int debug = 0) :
 
  666       insert(properties.begin(), properties.end());
 
  684       DEBUG(
"Processing key: " << equation.
getKey() << 
' ' << (p != end()) << endl);
 
  692           if (p->second->is_properties()) {
 
  698             ERROR(
"JProperties::read(): no properties object after division <" << equation.
getKey() << 
">" << endl);
 
  706           catch(
const exception& error) {
 
  707             ERROR(
"JProperties::read(): read error at key <" << equation.
getKey() << 
"> " << error.what() << endl);
 
  712           ERROR(
"JProperties::read(): illegal character following key <" << equation.
getKey() << 
"> " << equation.
getSeparator() << endl);
 
  715         if (p->second.getEndMarker()) {
 
  721           ERROR(
"JProperties::read(): error reading data for key <" << equation.
getKey() << 
"> " << equation.
getValue() << endl);
 
  726         WARNING(
"JProperties::read(): unknown key <" << equation.
getKey() << 
">" << endl);
 
  741       std::istringstream 
in(buffer); 
 
  767       for (
JEquation equation; in >> equation && 
read(equation); ) {}
 
  787       istringstream 
is(format);
 
  791       for (
string key; is >> key; ) {
 
  792         buffer.push_back(key);
 
  795       return read(in, buffer.begin(), buffer.end());
 
  811     std::istream& 
read(std::istream& 
in, 
T __begin, 
T __end)
 
  815       for (
T i = __begin; 
i != __end; ++
i) {
 
  825           WARNING(
"JProperties::read(): unknown key <" << *
i << 
">" << endl);
 
  846     std::ostream& 
write(std::ostream& out)
 const 
  850       for (const_iterator 
i = begin(); 
i != end(); ++
i) {
 
  854         if (
i->second->is_properties()) {
 
  855           c = getDefaultDivision ();
 
  857           c = getDefaultSeparator();
 
  860         i->second->write(out, (
i->first + c).c_str(), getDefaultEndOfLine());
 
  883       istringstream 
is(format);
 
  887       for (
string key; is >> key; ) {
 
  888         buffer.push_back(key);
 
  891       return write(out, buffer.begin(), buffer.end());
 
  907     std::ostream& 
write(std::ostream& out, 
T __begin, 
T __end)
 
  911       for (
T i = __begin; 
i != __end; ++
i) {
 
  917           out << getDefaultWhiteSpace();
 
  919           p->second->write(out);
 
  923           WARNING(
"JProperties::write(): unknown key <" << *
i << 
">" << endl);
 
  948       string buffer = format;
 
  952         string::size_type ipos = 0;
 
  954         while ((ipos = buffer.find(prefix + 
i->first + postfix, ipos)) != string::npos) {
 
  958           i->second->write(out);
 
  960           buffer.replace(ipos, prefix.length() + 
i->first.length() + postfix.length(), out.str());
 
  977       const_iterator 
i = find(key);
 
  980         return i->second.getValue<
T>();
 
  998         return i->second.getValue<
T>();
 
 1016         return i->second.setValue<
T>(value);
 
 1030       const_iterator 
i = find(key);
 
 1033         return i->second.toString();
 
 1045     std::ostream& 
print(std::ostream& out)
 const 
 1062       return properties.
read(in); 
 
 1075       return properties.
write(out); 
 
 1106     virtual std::istream& 
read(std::istream& 
in)
 override  
 1120     virtual std::ostream& 
write(std::ostream& out, 
 
 1122                                 const char    postfix)
 const override 
 1134     virtual std::ostream& 
write(std::ostream& out)
 const override  
 1181     virtual std::istream& 
read(std::istream& 
in)
 override  
 1197     virtual std::ostream& 
write(std::ostream& out, 
 
 1199                                 const char    postfix)
 const override 
 1201       using namespace std;
 
 1203       for (JProperties::const_iterator 
i = 
object.begin(); 
i != 
object.end(); ++
i) {
 
 1207         if (
i->second->is_properties()) {
 
 1208           c = 
object.getDefaultDivision ();
 
 1210           c = 
object.getDefaultSeparator();
 
 1213         i->second->write(out, (prefix + 
i->first + c).c_str(), postfix);
 
 1228     virtual std::ostream& 
write(std::ostream& out)
 const override  
 1270                                     const int debug = 1)
 
 1272     using namespace JPP;
 
 1292 #define gmake_property(A) JProperties::value_type(JProperties::getKey(#A,".>/:"), JEEP::JPropertiesElement(A)) 
 1293 #define zmake_property(A) JProperties::value_type(#A,                             JEEP::JPropertiesElement(A)) 
Exception for opening of file. 
 
virtual std::ostream & write(std::ostream &out, const char *prefix, const char postfix) const override
Stream output. 
 
const std::string & getKey() const 
Get key. 
 
JProperties(const JEquationParameters ¶meters, const int debug=0)
Constructor. 
 
Exception for reading of file. 
 
bool read(const JEquation &equation)
Read equation. 
 
std::istream & read(std::istream &in, const std::string &format)
Read from input stream according given format. 
 
const std::string & getValue() const 
Get value. 
 
Facet class to specify parsing of equations in currect locale (see class JLANG::JEquation). 
 
virtual std::ostream & write(std::ostream &out, const char *prefix, const char postfix) const override
Stream output. 
 
JEquationParameters & join(const JEquationParameters &value)
Join equation parameters. 
 
virtual std::ostream & write(std::ostream &out) const override
Stream output. 
 
void put(const std::string &key, T &object)
Put object at given key. 
 
bool equals(const JPropertiesElement &element) const 
Equality between property elements. 
 
virtual std::istream & read(std::istream &in) override
Stream input. 
 
virtual std::istream & read(std::istream &in) override
Stream input. 
 
JProperties & getProperties(T &object, const JEquationParameters ¶meters=JEquationParameters(), const int debug=1)
Get properties of a given object. 
 
std::map< std::string, JPropertiesElement > JMap_t
 
Exception when parsing a value. 
 
Template specialisation of JPropertiesTemplateElement for const data type. 
 
friend std::istream & operator>>(std::istream &in, JProperties::JFileReader &fileReader)
Stream input. 
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message. 
 
virtual std::ostream & write(std::ostream &out) const override
Stream output. 
 
virtual std::ostream & write(std::ostream &out, const char *prefix, const char postfix) const override
Stream output. 
 
virtual bool equals(const JPropertiesElementInterface &element) const 
Equality between property element interfaces. 
 
Utility class to parse parameter values. 
 
friend std::istream & operator>>(std::istream &in, JProperties &properties)
Stream input. 
 
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
 
virtual std::istream & read(std::istream &in) override
Stream input. 
 
void setEndMarker(const bool marker)
Set end marker. 
 
Simple data structure to support I/O of equations (see class JLANG::JEquation). 
 
virtual std::istream & read(std::istream &in) override
Stream input. 
 
void setValue(const T &value)
Set value of this JPropertiesElement. 
 
Auxiliary class to handle input from file. 
 
const T & getValue() const 
Get value. 
 
JPropertiesTemplateElement(const JProperties &value)
Constructor. 
 
virtual std::ostream & write(std::ostream &out) const override
Stream output. 
 
std::istream & readObject(std::istream &in, T &object)
Stream input of object. 
 
bool read(const std::string &buffer)
Read from input string. 
 
JPropertiesTemplateElement(const T &value)
Constructor. 
 
JPropertiesTemplateElement(T &value)
Constructor. 
 
General purpose equation class. 
 
virtual std::ostream & write(std::ostream &out, const char *prefix, const char postfix) const override
Stream output. 
 
const T & getValue(const std::string &key) const 
Get value. 
 
std::string sed(const std::string &format, const std::string &prefix="", const std::string &postfix="")
Stream editing of input format. 
 
std::ostream & print(std::ostream &out) const 
Print the current parameter values. 
 
The template JSharedPointer class can be used to share a pointer to an object. 
 
JFileReader(JProperties &__properties)
 
std::ostream & write(std::ostream &out) const 
Write the current parameter values. 
 
std::string getString(const std::string &key) const 
Get string value. 
 
JProperties(const int debug=0)
Constructor. 
 
bool getEndMarker() const 
Get end marker. 
 
virtual bool is_properties() const 
Get properties type. 
 
JPropertiesElement(T &value)
Constructor. 
 
do set_variable OUTPUT_DIRECTORY $WORKDIR T
 
JPropertiesElement & operator=(T &value)
Assignment operator. 
 
virtual bool equals(const JPropertiesElementInterface &element) const override
Equality between property element interfaces. 
 
JProperties & join(const JProperties &properties)
Join properties objects. 
 
Template class for I/O of properties element. 
 
std::istream & read(std::istream &in)
Read from input stream. 
 
virtual bool equals(const JPropertiesElementInterface &element) const override
Equality between property element interfaces. 
 
JFileReader & operator=(const std::string &file_name)
Assignment operator. 
 
virtual bool is_properties() const override
Get properties type. 
 
bool compareObjects(const T &first, const T &second, JBool< true >)
Comparison of comparable objects. 
 
General purpose messaging. 
 
T & getValue(const std::string &key)
Get value. 
 
void setValue(const std::string &key, const T &value)
Set value. 
 
bool fail(std::istream &in)
Check for stream state. 
 
virtual std::ostream & write(std::ostream &out) const =0
Stream output. 
 
friend std::ostream & operator<<(std::ostream &out, const JProperties::JFileReader &fileReader)
Stream output. 
 
std::string toString() const 
Convert to string. 
 
$WORKDIR ev_configure_dqsimulator txt echo process $DQ_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DQ_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
 
The property value class. 
 
Interface for ASCII output using standard streams. 
 
JPropertiesTemplateElement(JProperties::JFileReader &value)
Constructor. 
 
friend std::ostream & operator<<(std::ostream &out, const JProperties &properties)
Stream output. 
 
std::ostream & write(std::ostream &out, const std::string &format)
Write to output stream according given format. 
 
T toValue() const 
Convert to template type. 
 
virtual std::ostream & write(std::ostream &out, const char *prefix, const char postfix) const =0
Stream output. 
 
std::ostream & write(std::ostream &out, T __begin, T __end)
Write to output stream according given format. 
 
const char getSeparator() const 
Get separator. 
 
static std::string getKey(const std::string &buffer, const std::string &sep)
Utility method to strip off all leading characters from a string until specified character(s). 
 
JPropertiesElement()
Default constructor. 
 
virtual std::ostream & write(std::ostream &out) const override
Stream output. 
 
std::istream & read(std::istream &in, T __begin, T __end)
Read from input stream according given format. 
 
void read(const std::string &file_name)
Read properties from file. 
 
Interface for I/O of properties element. 
 
JProperties::JFileReader & object
 
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
 
friend class JPropertiesElement
 
Interface for ASCII output with prefix and postfix using standard streams. 
 
virtual JClass_t * get() const override
Get pointer. 
 
Auxiliary class to define value, reference and pointer types for given data type and category...
 
virtual bool equals(const JPropertiesElementInterface &element) const override
Equality between property element interfaces. 
 
#define DEBUG(A)
Message macros. 
 
Auxiliary class for handling debug parameter within a class. 
 
std::ostream & writeObject(std::ostream &out, const T &object)
Stream output of object.