Jpp  18.2.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Friends | List of all members
JEEP::JProperties Class Reference

Utility class to parse parameter values. More...

#include <JProperties.hh>

Inheritance diagram for JEEP::JProperties:
std::map< std::string, JPropertiesElement > JLANG::JEquationParameters JEEP::JMessage< JProperties > JAANET::JFluxMapParser JCOMPAREHISTOGRAMS::JResultTitle JCOMPAREHISTOGRAMS::JTestSummary::JTestSummaryHelper JDETECTOR::JDetectorHeader::JDetectorHeaderHelper JDETECTOR::JDetectorParametersHelper JDETECTOR::JPMTParameters::JPMTParametersHelper JOSCPROB::JOscChannel::JOscChannelHelper JOSCPROB::JOscParametersInterface< T >::JOscParametersHelper

Classes

class  JFileReader
 Auxiliary class to handle input from file. More...
 

Public Types

typedef std::map< std::string,
JPropertiesElement
JMap_t
 

Public Member Functions

 JProperties (const int debug=0)
 Constructor. More...
 
 JProperties (const JEquationParameters &parameters, const int debug=0)
 Constructor. More...
 
template<class T >
void put (const std::string &key, T &object)
 Put object at given key. More...
 
JPropertiesjoin (const JProperties &properties)
 Join properties objects. More...
 
bool read (const JEquation &equation)
 Read equation. More...
 
bool read (const std::string &buffer)
 Read from input string. More...
 
std::istream & read (std::istream &in)
 Read from input stream. More...
 
std::istream & read (std::istream &in, const std::string &format)
 Read from input stream according given format. More...
 
template<class T >
std::istream & read (std::istream &in, T __begin, T __end)
 Read from input stream according given format. More...
 
std::ostream & write (std::ostream &out) const
 Write the current parameter values. More...
 
std::ostream & write (std::ostream &out, const std::string &format)
 Write to output stream according given format. More...
 
template<class T >
std::ostream & write (std::ostream &out, T __begin, T __end)
 Write to output stream according given format. More...
 
std::string sed (const std::string &format, const std::string &prefix="", const std::string &postfix="")
 Stream editing of input format. More...
 
template<class T >
const TgetValue (const std::string &key) const
 Get value. More...
 
template<class T >
TgetValue (const std::string &key)
 Get value. More...
 
template<class T >
void setValue (const std::string &key, const T &value)
 Set value. More...
 
std::string getString (const std::string &key) const
 Get string value. More...
 
std::ostream & print (std::ostream &out) const
 Print the current parameter values. More...
 
const JEquationParametersgetEquationParameters () const
 Get equation parameters. More...
 
void setEquationParameters (const JEquationParameters &buffer)
 Set equation parameters. More...
 
const char getDefaultSeparator () const
 Get default separator character. More...
 
const std::stringgetSeparator () const
 Get separator characters. More...
 
std::stringgetSeparator ()
 Get separator characters. More...
 
void setSeparator (const std::string &sep)
 Set separator character(s). More...
 
const char getDefaultEndOfLine () const
 Get default end of line character. More...
 
const char getPreferredEndOfLine (const unsigned int index) const
 Get preferred end of line character. More...
 
const std::stringgetEndOfLine () const
 Get end of line characters. More...
 
std::stringgetEndOfLine ()
 Get end of line characters. More...
 
void setEndOfLine (const std::string &eol)
 Set end of line characters. More...
 
const char getDefaultDivision () const
 Get default division character. More...
 
const std::stringgetDivision () const
 Get division characters. More...
 
std::stringgetDivision ()
 Get division characters. More...
 
void setDivision (const std::string &div)
 Set division characters. More...
 
const char getDefaultSkipLine () const
 Get default skip line character. More...
 
const std::stringgetSkipLine () const
 Get skip line characters. More...
 
std::stringgetSkipLine ()
 Get skip line characters. More...
 
void setSkipLine (const std::string &skip)
 Set skip line characters. More...
 
void setBrackets (const char left, const char right)
 Set brackets. More...
 
char getLeftBracket () const
 Get left bracket. More...
 
char & getLeftBracket ()
 Get left bracket. More...
 
char getRightBracket () const
 Get right bracket. More...
 
char & getRightBracket ()
 Get right bracket. More...
 
const char getDefaultWhiteSpace () const
 Get default white space character. More...
 
const std::stringgetWhiteSpace () const
 Get white space characters. More...
 
std::stringgetWhiteSpace ()
 Get white space characters. More...
 
void setWhiteSpace (const std::string &ws)
 Set white space characters. More...
 
const std::stringgetComment () const
 Get comment string. More...
 
std::stringgetComment ()
 Get comment string. More...
 
void setComment (const std::string &comment)
 Set comment string. More...
 
JEquationParametersjoin (const JEquationParameters &value)
 Join equation parameters. More...
 
bool isSeparator (const char c) const
 Test for separator character. More...
 
bool isEndOfLine (const char c) const
 Test for end of line character. More...
 
bool isDivision (const char c) const
 Test for division character. More...
 
bool isSkipLine (const char c) const
 Test for skip line character. More...
 
bool isLeftBracket (const char c) const
 Test for left bracket character. More...
 
bool isRightBracket (const char c) const
 Test for right bracket character. More...
 
bool isWhiteSpace (const char c) const
 Test for white space character. More...
 

Static Public Member Functions

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). More...
 

Static Public Attributes

static int debug
 

Protected Attributes

std::string sep
 
std::string eol
 
std::string div
 
std::string skip
 
char left
 
char right
 
std::string ws
 
std::string comment
 

Friends

std::istream & operator>> (std::istream &in, JProperties &properties)
 Stream input. More...
 
std::ostream & operator<< (std::ostream &out, const JProperties &properties)
 Stream output. More...
 

Detailed Description

Utility class to parse parameter values.

The mapping between a parameter (of any type) and a value has to be defined in the user's program, e.g.

ifstream in(filename.c_str());
int integer_value;
double double_value;
string string_value;
zap.insert(make_property(integer_value)); // key == parameter name
zap.insert(make_property(double_value)); // key == parameter name
zap["mies"] = string_value;
zap.read(in);
zap.write(cout);

Definition at line 497 of file JProperties.hh.

Member Typedef Documentation

Definition at line 504 of file JProperties.hh.

Constructor & Destructor Documentation

JEEP::JProperties::JProperties ( const int  debug = 0)
inline

Constructor.

Parameters
debugdebug level

Definition at line 621 of file JProperties.hh.

621  :
622  JMap_t(),
624  {
625  this->debug = debug;
626  }
std::map< std::string, JPropertiesElement > JMap_t
Definition: JProperties.hh:504
JEquationParameters()
Default constructor.
JEEP::JProperties::JProperties ( const JEquationParameters parameters,
const int  debug = 0 
)
inline

Constructor.

Parameters
parametersequation parameters
debugdebug level

Definition at line 635 of file JProperties.hh.

636  :
637  JMap_t(),
638  JEquationParameters(parameters)
639  {
640  this->debug = debug;
641  }
std::map< std::string, JPropertiesElement > JMap_t
Definition: JProperties.hh:504
JEquationParameters()
Default constructor.

Member Function Documentation

static std::string JEEP::JProperties::getKey ( const std::string buffer,
const std::string sep 
)
inlinestatic

Utility method to strip off all leading characters from a string until specified character(s).

Parameters
bufferinput string
seplast character(s) to strip
Returns
modified string

Definition at line 516 of file JProperties.hh.

517  {
518  using namespace std;
519 
520  const size_type pos = buffer.find_last_of(sep);
521 
522  if (pos != string::npos)
523  return buffer.substr(pos + 1);
524  else
525  return buffer;
526  }
template<class T >
void JEEP::JProperties::put ( const std::string key,
T object 
)
inline

Put object at given key.

Parameters
keykey
objectobject

Definition at line 651 of file JProperties.hh.

652  {
653  this->insert(value_type(key, JPropertiesElement(object)));
654  }
The property value class.
Definition: JProperties.hh:293
JProperties& JEEP::JProperties::join ( const JProperties properties)
inline

Join properties objects.

Parameters
propertiesproperties

Definition at line 662 of file JProperties.hh.

663  {
664  JEquationParameters::join(properties);
665 
666  insert(properties.begin(), properties.end());
667 
668  return *this;
669  }
JEquationParameters & join(const JEquationParameters &value)
Join equation parameters.
bool JEEP::JProperties::read ( const JEquation equation)
inline

Read equation.

Parameters
equationequation
Returns
status

Definition at line 678 of file JProperties.hh.

679  {
680  using namespace std;
681 
682  iterator p = find(equation.getKey());
683 
684  DEBUG("Processing key: " << equation.getKey() << ' ' << (p != end()) << endl);
685 
686  if (p != end()) {
687 
688  istringstream is(equation.getValue());
689 
690  if (isDivision(equation.getSeparator())) {
691 
692  if (p->second->is_properties()) {
693 
694  p->second->read(is);
695 
696  } else {
697 
698  ERROR("JProperties::read(): no properties object after division <" << equation.getKey() << ">" << endl);
699  }
700 
701  } else if (isSeparator(equation.getSeparator())) {
702 
703  try {
704  p->second->read(is);
705  }
706  catch(const exception& error) {
707  ERROR("JProperties::read(): read error at key <" << equation.getKey() << "> " << error.what() << endl);
708  }
709 
710  } else {
711 
712  ERROR("JProperties::read(): illegal character following key <" << equation.getKey() << "> " << equation.getSeparator() << endl);
713  }
714 
715  if (p->second.getEndMarker()) {
716  return false;
717  }
718 
719  if (fail(is)) {
720 
721  ERROR("JProperties::read(): error reading data for key <" << equation.getKey() << "> " << equation.getValue() << endl);
722  }
723 
724  } else {
725 
726  WARNING("JProperties::read(): unknown key <" << equation.getKey() << ">" << endl);
727  }
728 
729  return true;
730  }
#define WARNING(A)
Definition: JMessage.hh:65
is
Definition: JDAQCHSM.chsm:167
#define ERROR(A)
Definition: JMessage.hh:66
bool fail(std::istream &in)
Check for stream state.
Definition: JProperties.hh:57
bool isSeparator(const char c) const
Test for separator character.
bool isDivision(const char c) const
Test for division character.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
bool JEEP::JProperties::read ( const std::string buffer)
inline

Read from input string.

Parameters
bufferinput string
Returns
read status

Definition at line 739 of file JProperties.hh.

740  {
741  std::istringstream in(buffer);
742 
743  return !fail(read(in));
744  }
bool read(const JEquation &equation)
Read equation.
Definition: JProperties.hh:678
bool fail(std::istream &in)
Check for stream state.
Definition: JProperties.hh:57
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
Definition: JCanberra.sh:46
std::istream& JEEP::JProperties::read ( std::istream &  in)
inline

Read from input stream.

The input format is:

   [<key><sub>]<key><sep><value><eol>
   [<key><sub>]<key><sep><value><eol>

In this, white spaces are ignored. The reading of key and value pairs is controlled by the JLANG::JEquationFacet class.

Parameters
ininput stream
Returns
input stream

Definition at line 761 of file JProperties.hh.

762  {
763  using namespace std;
764 
765  in.imbue(locale(in.getloc(), new JEquationFacet(*this)));
766 
767  for (JEquation equation; in >> equation && read(equation); ) {}
768 
769  return in;
770  }
bool read(const JEquation &equation)
Read equation.
Definition: JProperties.hh:678
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
Definition: JCanberra.sh:46
std::istream& JEEP::JProperties::read ( std::istream &  in,
const std::string format 
)
inline

Read from input stream according given format.

For each key in the format specification, a corresponding value will be read from the input stream.

Parameters
ininput stream
formatformat
Returns
input stream

Definition at line 783 of file JProperties.hh.

784  {
785  using namespace std;
786 
787  istringstream is(format);
788 
789  vector<string> buffer;
790 
791  for (string key; is >> key; ) {
792  buffer.push_back(key);
793  }
794 
795  return read(in, buffer.begin(), buffer.end());
796  }
bool read(const JEquation &equation)
Read equation.
Definition: JProperties.hh:678
is
Definition: JDAQCHSM.chsm:167
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
Definition: JCanberra.sh:46
template<class T >
std::istream& JEEP::JProperties::read ( std::istream &  in,
T  __begin,
T  __end 
)
inline

Read from input stream according given format.

For each key in the format specification, a corresponding value will be read from the input stream.

Parameters
ininput stream
__beginbegin of format
__endend of format
Returns
input stream

Definition at line 811 of file JProperties.hh.

812  {
813  using namespace std;
814 
815  for (T i = __begin; i != __end; ++i) {
816 
817  iterator p = find(*i);
818 
819  if (p != end()) {
820 
821  p->second->read(in);
822 
823  } else {
824 
825  WARNING("JProperties::read(): unknown key <" << *i << ">" << endl);
826  }
827  }
828 
829  return in;
830  }
#define WARNING(A)
Definition: JMessage.hh:65
do set_variable OUTPUT_DIRECTORY $WORKDIR T
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
Definition: JCanberra.sh:46
std::ostream& JEEP::JProperties::write ( std::ostream &  out) const
inline

Write the current parameter values.

The output format is

[<key><sub>]<key><sep><value><eol> [<key><sub>]<key><sep><value><eol>

in this, white spaces are omitted.

Parameters
outoutput stream
Returns
output stream

Definition at line 846 of file JProperties.hh.

847  {
848  using namespace std;
849 
850  for (const_iterator i = begin(); i != end(); ++i) {
851 
852  char c = ' ';
853 
854  if (i->second->is_properties()) {
855  c = getDefaultDivision ();
856  } else {
857  c = getDefaultSeparator();
858  }
859 
860  i->second->write(out, (i->first + c).c_str(), getDefaultEndOfLine());
861  }
862 
863  out << flush;
864 
865  return out;
866  }
const char getDefaultSeparator() const
Get default separator character.
const char getDefaultDivision() const
Get default division character.
const char getDefaultEndOfLine() const
Get default end of line character.
$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 &))'
std::ostream& JEEP::JProperties::write ( std::ostream &  out,
const std::string format 
)
inline

Write to output stream according given format.

For each key in the format specification, a corresponding value will be written to the output stream.

Parameters
outoutput stream
formatformat
Returns
output stream

Definition at line 879 of file JProperties.hh.

880  {
881  using namespace std;
882 
883  istringstream is(format);
884 
885  vector<string> buffer;
886 
887  for (string key; is >> key; ) {
888  buffer.push_back(key);
889  }
890 
891  return write(out, buffer.begin(), buffer.end());
892  }
is
Definition: JDAQCHSM.chsm:167
std::ostream & write(std::ostream &out) const
Write the current parameter values.
Definition: JProperties.hh:846
template<class T >
std::ostream& JEEP::JProperties::write ( std::ostream &  out,
T  __begin,
T  __end 
)
inline

Write to output stream according given format.

For each key in the format specification, a corresponding value will be written to the output stream.

Parameters
outoutput stream
__beginbegin of format
__endend of format
Returns
output stream

Definition at line 907 of file JProperties.hh.

908  {
909  using namespace std;
910 
911  for (T i = __begin; i != __end; ++i) {
912 
913  iterator p = find(*i);
914 
915  if (p != end()) {
916 
917  out << getDefaultWhiteSpace();
918 
919  p->second->write(out);
920 
921  } else {
922 
923  WARNING("JProperties::write(): unknown key <" << *i << ">" << endl);
924  }
925  }
926 
927  return out;
928  }
#define WARNING(A)
Definition: JMessage.hh:65
const char getDefaultWhiteSpace() const
Get default white space character.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
std::string JEEP::JProperties::sed ( const std::string format,
const std::string prefix = "",
const std::string postfix = "" 
)
inline

Stream editing of input format.

For each key in the format specification, a corresponding value will be written to the output stream.

Parameters
formatformat
prefixprefix key word
postfixpostfix key word
Returns
output stream

Definition at line 942 of file JProperties.hh.

945  {
946  using namespace std;
947 
948  string buffer = format;
949 
950  for (iterator i = begin(); i != end(); ++i) {
951 
952  string::size_type ipos = 0;
953 
954  while ((ipos = buffer.find(prefix + i->first + postfix, ipos)) != string::npos) {
955 
956  ostringstream out;
957 
958  i->second->write(out);
959 
960  buffer.replace(ipos, prefix.length() + i->first.length() + postfix.length(), out.str());
961  }
962  }
963 
964  return buffer;
965  }
template<class T >
const T& JEEP::JProperties::getValue ( const std::string key) const
inline

Get value.

Parameters
keykey
Returns
value of this JPropertiesElement

Definition at line 975 of file JProperties.hh.

976  {
977  const_iterator i = find(key);
978 
979  if (i != end())
980  return i->second.getValue<T>();
981  else
982  THROW(JPropertiesException, "Key <" << key << "> not found at JPropertiesElement::getValue()");
983  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T >
T& JEEP::JProperties::getValue ( const std::string key)
inline

Get value.

Parameters
keykey
Returns
value of this JPropertiesElement

Definition at line 993 of file JProperties.hh.

994  {
995  iterator i = find(key);
996 
997  if (i != end())
998  return i->second.getValue<T>();
999  else
1000  THROW(JPropertiesException, "Key <" << key << "> not found at JPropertiesElement::getValue()");
1001  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T >
void JEEP::JProperties::setValue ( const std::string key,
const T value 
)
inline

Set value.

Parameters
keykey
valuevalue

Definition at line 1011 of file JProperties.hh.

1012  {
1013  iterator i = find(key);
1014 
1015  if (i != end())
1016  return i->second.setValue<T>(value);
1017  else
1018  THROW(JPropertiesException, "Key <" << key << "> not found at JPropertiesElement::setValue()");
1019  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
do set_variable OUTPUT_DIRECTORY $WORKDIR T
std::string JEEP::JProperties::getString ( const std::string key) const
inline

Get string value.

Parameters
keykey
Returns
value

Definition at line 1028 of file JProperties.hh.

1029  {
1030  const_iterator i = find(key);
1031 
1032  if (i != end())
1033  return i->second.toString();
1034  else
1035  THROW(JPropertiesException, "Key <" << key << "> not found at JPropertiesElement::getString()");
1036  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
std::ostream& JEEP::JProperties::print ( std::ostream &  out) const
inline

Print the current parameter values.

Parameters
outoutput stream
Returns
output stream

Definition at line 1045 of file JProperties.hh.

1046  {
1047  write(out);
1048 
1049  return out;
1050  }
std::ostream & write(std::ostream &out) const
Write the current parameter values.
Definition: JProperties.hh:846
const JEquationParameters& JLANG::JEquationParameters::getEquationParameters ( ) const
inlineinherited

Get equation parameters.

Returns
equation parameters

Definition at line 74 of file JEquationParameters.hh.

75  {
76  return *this;
77  }
void JLANG::JEquationParameters::setEquationParameters ( const JEquationParameters buffer)
inlineinherited

Set equation parameters.

Parameters
bufferequation parameters

Definition at line 85 of file JEquationParameters.hh.

86  {
87  static_cast<JEquationParameters&>(*this) = buffer;
88  }
Simple data structure to support I/O of equations (see class JLANG::JEquation).
const char JLANG::JEquationParameters::getDefaultSeparator ( ) const
inlineinherited

Get default separator character.

Returns
separator between parameter and its value

Definition at line 96 of file JEquationParameters.hh.

97  {
98  if (sep.empty())
99  return '=';
100  else
101  return sep[0];
102  }
const std::string& JLANG::JEquationParameters::getSeparator ( ) const
inlineinherited

Get separator characters.

Returns
separator between parameter and its value

Definition at line 110 of file JEquationParameters.hh.

111  {
112  return sep;
113  }
std::string& JLANG::JEquationParameters::getSeparator ( )
inlineinherited

Get separator characters.

Returns
separator between parameter and its value

Definition at line 121 of file JEquationParameters.hh.

122  {
123  return sep;
124  }
void JLANG::JEquationParameters::setSeparator ( const std::string sep)
inlineinherited

Set separator character(s).

Parameters
sepseparator between parameter and its value

Definition at line 132 of file JEquationParameters.hh.

133  {
134  this->sep = sep;
135  }
const char JLANG::JEquationParameters::getDefaultEndOfLine ( ) const
inlineinherited

Get default end of line character.

Returns
end of line character

Definition at line 143 of file JEquationParameters.hh.

144  {
145  if (eol.empty())
146  return '\n';
147  else
148  return eol[0];
149  }
const char JLANG::JEquationParameters::getPreferredEndOfLine ( const unsigned int  index) const
inlineinherited

Get preferred end of line character.

Parameters
indexindex
Returns
end of line character

Definition at line 158 of file JEquationParameters.hh.

159  {
160  if (eol.empty())
161  return '\n';
162  else if (index < eol.size())
163  return eol[index];
164  else
165  return eol[0];
166  }
const std::string& JLANG::JEquationParameters::getEndOfLine ( ) const
inlineinherited

Get end of line characters.

Returns
end of line characters

Definition at line 174 of file JEquationParameters.hh.

175  {
176  return eol;
177  }
std::string& JLANG::JEquationParameters::getEndOfLine ( )
inlineinherited

Get end of line characters.

Returns
end of line characters

Definition at line 185 of file JEquationParameters.hh.

186  {
187  return eol;
188  }
void JLANG::JEquationParameters::setEndOfLine ( const std::string eol)
inlineinherited

Set end of line characters.

Parameters
eolend of line character

Definition at line 196 of file JEquationParameters.hh.

197  {
198  this->eol = eol;
199  }
const char JLANG::JEquationParameters::getDefaultDivision ( ) const
inlineinherited

Get default division character.

Returns
division character

Definition at line 207 of file JEquationParameters.hh.

208  {
209  if (div.empty())
210  return '.';
211  else
212  return div[0];
213  }
const std::string& JLANG::JEquationParameters::getDivision ( ) const
inlineinherited

Get division characters.

Returns
division characters

Definition at line 221 of file JEquationParameters.hh.

222  {
223  return div;
224  }
std::string& JLANG::JEquationParameters::getDivision ( )
inlineinherited

Get division characters.

Returns
division characters

Definition at line 232 of file JEquationParameters.hh.

233  {
234  return div;
235  }
void JLANG::JEquationParameters::setDivision ( const std::string div)
inlineinherited

Set division characters.

Parameters
divdivision characters

Definition at line 243 of file JEquationParameters.hh.

244  {
245  this->div = div;
246  }
const char JLANG::JEquationParameters::getDefaultSkipLine ( ) const
inlineinherited

Get default skip line character.

Returns
skip line character

Definition at line 254 of file JEquationParameters.hh.

255  {
256  if (skip.empty())
257  return '#';
258  else
259  return skip[0];
260  }
const std::string& JLANG::JEquationParameters::getSkipLine ( ) const
inlineinherited

Get skip line characters.

Returns
skip line characters

Definition at line 268 of file JEquationParameters.hh.

269  {
270  return skip;
271  }
std::string& JLANG::JEquationParameters::getSkipLine ( )
inlineinherited

Get skip line characters.

Returns
skip line characters

Definition at line 279 of file JEquationParameters.hh.

280  {
281  return skip;
282  }
void JLANG::JEquationParameters::setSkipLine ( const std::string skip)
inlineinherited

Set skip line characters.

Parameters
skipskip line characters

Definition at line 290 of file JEquationParameters.hh.

291  {
292  this->skip = skip;
293  }
void JLANG::JEquationParameters::setBrackets ( const char  left,
const char  right 
)
inlineinherited

Set brackets.

Parameters
leftleft bracket
rightright bracket

Definition at line 302 of file JEquationParameters.hh.

303  {
304  this->left = left;
305  this->right = right;
306  }
char JLANG::JEquationParameters::getLeftBracket ( ) const
inlineinherited

Get left bracket.

Returns
left bracket

Definition at line 314 of file JEquationParameters.hh.

315  {
316  return left;
317  }
char& JLANG::JEquationParameters::getLeftBracket ( )
inlineinherited

Get left bracket.

Returns
left bracket

Definition at line 325 of file JEquationParameters.hh.

326  {
327  return left;
328  }
char JLANG::JEquationParameters::getRightBracket ( ) const
inlineinherited

Get right bracket.

Returns
right bracket

Definition at line 336 of file JEquationParameters.hh.

337  {
338  return right;
339  }
char& JLANG::JEquationParameters::getRightBracket ( )
inlineinherited

Get right bracket.

Returns
right bracket

Definition at line 347 of file JEquationParameters.hh.

348  {
349  return right;
350  }
const char JLANG::JEquationParameters::getDefaultWhiteSpace ( ) const
inlineinherited

Get default white space character.

Returns
white space character

Definition at line 358 of file JEquationParameters.hh.

359  {
360  if (ws.empty())
361  return ' ';
362  else
363  return ws[0];
364  }
const std::string& JLANG::JEquationParameters::getWhiteSpace ( ) const
inlineinherited

Get white space characters.

Returns
white space characters

Definition at line 372 of file JEquationParameters.hh.

373  {
374  return ws;
375  }
std::string& JLANG::JEquationParameters::getWhiteSpace ( )
inlineinherited

Get white space characters.

Returns
white space characters

Definition at line 383 of file JEquationParameters.hh.

384  {
385  return ws;
386  }
void JLANG::JEquationParameters::setWhiteSpace ( const std::string ws)
inlineinherited

Set white space characters.

Parameters
wswhite space characters

Definition at line 394 of file JEquationParameters.hh.

395  {
396  this->ws = ws;
397  }
const std::string& JLANG::JEquationParameters::getComment ( ) const
inlineinherited

Get comment string.

Returns
comment string

Definition at line 405 of file JEquationParameters.hh.

406  {
407  return comment;
408  }
std::string& JLANG::JEquationParameters::getComment ( )
inlineinherited

Get comment string.

Returns
comment string

Definition at line 416 of file JEquationParameters.hh.

417  {
418  return comment;
419  }
void JLANG::JEquationParameters::setComment ( const std::string comment)
inlineinherited

Set comment string.

Parameters
commentcomment string

Definition at line 427 of file JEquationParameters.hh.

428  {
429  this->comment = comment;
430  }
JEquationParameters& JLANG::JEquationParameters::join ( const JEquationParameters value)
inlineinherited

Join equation parameters.

Parameters
valueequation parameters

Definition at line 438 of file JEquationParameters.hh.

439  {
440  using namespace std;
441 
442  for (string::const_iterator i = value.sep.begin(); i != value.sep.end(); ++i) {
443  if (!isSeparator(*i)) {
444  sep += *i;
445  }
446  }
447 
448  for (string::const_iterator i = value.eol.begin(); i != value.eol.end(); ++i) {
449  if (!isEndOfLine(*i)) {
450  eol += *i;
451  }
452  }
453 
454  for (string::const_iterator i = value.div.begin(); i != value.div.end(); ++i) {
455  if (!isDivision(*i)) {
456  div += *i;
457  }
458  }
459 
460  for (string::const_iterator i = value.skip.begin(); i != value.skip.end(); ++i) {
461  if (!isSkipLine(*i)) {
462  skip += *i;
463  }
464  }
465 
466  for (string::const_iterator i = value.ws.begin(); i != value.ws.end(); ++i) {
467  if (!isWhiteSpace(*i)) {
468  ws += *i;
469  }
470  }
471 
472  return *this;
473  }
bool isEndOfLine(const char c) const
Test for end of line character.
bool isWhiteSpace(const char c) const
Test for white space character.
bool isSkipLine(const char c) const
Test for skip line character.
bool isSeparator(const char c) const
Test for separator character.
bool isDivision(const char c) const
Test for division character.
bool JLANG::JEquationParameters::isSeparator ( const char  c) const
inlineinherited

Test for separator character.

Parameters
ccharacter
Returns
true if separator; else false

Definition at line 482 of file JEquationParameters.hh.

483  {
484  return sep .find(c) != std::string::npos;
485  }
$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 &))'
bool JLANG::JEquationParameters::isEndOfLine ( const char  c) const
inlineinherited

Test for end of line character.

Parameters
ccharacter
Returns
true if end of line; else false

Definition at line 494 of file JEquationParameters.hh.

494 { return eol .find(c) != std::string::npos; }
$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 &))'
bool JLANG::JEquationParameters::isDivision ( const char  c) const
inlineinherited

Test for division character.

Parameters
ccharacter
Returns
true if division; else false

Definition at line 503 of file JEquationParameters.hh.

504  {
505  return div .find(c) != std::string::npos;
506  }
$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 &))'
bool JLANG::JEquationParameters::isSkipLine ( const char  c) const
inlineinherited

Test for skip line character.

Parameters
ccharacter
Returns
true if skip line; else false

Definition at line 515 of file JEquationParameters.hh.

516  {
517  return skip.find(c) != std::string::npos;
518  }
$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 &))'
bool JLANG::JEquationParameters::isLeftBracket ( const char  c) const
inlineinherited

Test for left bracket character.

Parameters
ccharacter
Returns
true if left bracket; else false

Definition at line 527 of file JEquationParameters.hh.

528  {
529  return c == left;
530  }
$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 &))'
bool JLANG::JEquationParameters::isRightBracket ( const char  c) const
inlineinherited

Test for right bracket character.

Parameters
ccharacter
Returns
true if right bracket; else false

Definition at line 539 of file JEquationParameters.hh.

540  {
541  return c == right;
542  }
$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 &))'
bool JLANG::JEquationParameters::isWhiteSpace ( const char  c) const
inlineinherited

Test for white space character.

Parameters
ccharacter
Returns
true if white space; else false

Definition at line 551 of file JEquationParameters.hh.

552  {
553  return ws .find(c) != std::string::npos;
554  }
$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 &))'

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JProperties properties 
)
friend

Stream input.

Parameters
ininput stream
propertiesproperties
Returns
input stream

Definition at line 1060 of file JProperties.hh.

1061  {
1062  return properties.read(in);
1063  }
bool read(const JEquation &equation)
Read equation.
Definition: JProperties.hh:678
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
Definition: JCanberra.sh:46
std::ostream& operator<< ( std::ostream &  out,
const JProperties properties 
)
friend

Stream output.

Parameters
outoutput stream
propertiesproperties
Returns
output stream

Definition at line 1073 of file JProperties.hh.

1074  {
1075  return properties.write(out);
1076  }
std::ostream & write(std::ostream &out) const
Write the current parameter values.
Definition: JProperties.hh:846

Member Data Documentation

std::string JLANG::JEquationParameters::sep
protectedinherited

Definition at line 557 of file JEquationParameters.hh.

std::string JLANG::JEquationParameters::eol
protectedinherited

Definition at line 558 of file JEquationParameters.hh.

std::string JLANG::JEquationParameters::div
protectedinherited

Definition at line 559 of file JEquationParameters.hh.

std::string JLANG::JEquationParameters::skip
protectedinherited

Definition at line 560 of file JEquationParameters.hh.

char JLANG::JEquationParameters::left
protectedinherited

Definition at line 561 of file JEquationParameters.hh.

char JLANG::JEquationParameters::right
protectedinherited

Definition at line 562 of file JEquationParameters.hh.

std::string JLANG::JEquationParameters::ws
protectedinherited

Definition at line 563 of file JEquationParameters.hh.

std::string JLANG::JEquationParameters::comment
protectedinherited

Definition at line 564 of file JEquationParameters.hh.

int JEEP::JMessage< JProperties >::debug
staticinherited

debug level (default is off).

Definition at line 45 of file JMessage.hh.


The documentation for this class was generated from the following file: