Jpp  17.1.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
JACOUSTICS::JDetectorMechanics Struct Reference

Auxiliary data structure for mechanical model parameters of strings in a given detector. More...

#include <JMechanics.hh>

Inheritance diagram for JACOUSTICS::JDetectorMechanics:
std::map< int, JMechanics >

Public Types

enum  { WILD_CARD = -1 }
 

Public Member Functions

void load (const std::string &file_name)
 Load mechanical model parameters from file. More...
 
void load (const int id)
 Load mechanical model parameters for given detector identifier. More...
 
const JMechanicsoperator() (const int string) const
 Get mechanical parameters for given string. More...
 

Static Public Member Functions

static std::string getFilename (const int id)
 Get file name with mechanical model parameters for given detector identifier. More...
 

Public Attributes

JComment comment
 

Friends

std::istream & operator>> (std::istream &in, JDetectorMechanics &object)
 Read detector mechanics from input. More...
 
std::ostream & operator<< (std::ostream &out, const JDetectorMechanics &object)
 Write detector mechanics to output. More...
 

Detailed Description

Auxiliary data structure for mechanical model parameters of strings in a given detector.

Note that the JDetectorMechanics::WILD_CARD acts as default value for the string number.

Definition at line 110 of file JMechanics.hh.

Member Enumeration Documentation

anonymous enum
Enumerator
WILD_CARD 

wild card for string number.

Definition at line 113 of file JMechanics.hh.

113  {
114  WILD_CARD = -1 //!< wild card for string number.
115  };
wild card for string number.
Definition: JMechanics.hh:114

Member Function Documentation

static std::string JACOUSTICS::JDetectorMechanics::getFilename ( const int  id)
inlinestatic

Get file name with mechanical model parameters for given detector identifier.

Note that the environment variable LD_LIBRARY_PATH is used to obtain the path of the targeted file.

Parameters
iddetector identifier
Returns
file name

Definition at line 126 of file JMechanics.hh.

127  {
128  using namespace std;
129  using namespace JPP;
130 
131  const string file_name = MAKE_STRING("mechanics_" << FILL(8,'0') << id << ".txt");
132 
133  return getFullFilename(LD_LIBRARY_PATH, file_name);
134  }
static const char *const LD_LIBRARY_PATH
Nick names of environment variables.
Definition: JeepToolkit.hh:34
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:127
Auxiliary data structure for sequence of same character.
Definition: JManip.hh:328
std::string getFullFilename(const std::string &variable, const std::string &file_name)
Get full file name (see JEEP::getPath).
Definition: JeepToolkit.hh:253
void JACOUSTICS::JDetectorMechanics::load ( const std::string &  file_name)
inline

Load mechanical model parameters from file.

Parameters
file_namefile name

Definition at line 142 of file JMechanics.hh.

143  {
144  std::ifstream in(file_name.c_str());
145 
146  in >> *this;
147 
148  in.close();
149  }
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
void JACOUSTICS::JDetectorMechanics::load ( const int  id)
inline

Load mechanical model parameters for given detector identifier.

Parameters
iddetector identifier

Definition at line 157 of file JMechanics.hh.

158  {
159  load(getFilename(id));
160  }
void load(const std::string &file_name)
Load mechanical model parameters from file.
Definition: JMechanics.hh:142
static std::string getFilename(const int id)
Get file name with mechanical model parameters for given detector identifier.
Definition: JMechanics.hh:126
const JMechanics& JACOUSTICS::JDetectorMechanics::operator() ( const int  string) const
inline

Get mechanical parameters for given string.

Parameters
stringstring number
Returns
mechanical parameters

Definition at line 169 of file JMechanics.hh.

170  {
171  static const JMechanics mechanics;
172 
173  const_iterator p;
174 
175  if ((p = this->find(string)) != this->end())
176  return p->second;
177  else if ((p = this->find(WILD_CARD)) != this->end())
178  return p->second;
179  else
180  return mechanics;
181  }
wild card for string number.
Definition: JMechanics.hh:114
Auxiliary data structure for parameters of mechanical model.
Definition: JMechanics.hh:39

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JDetectorMechanics object 
)
friend

Read detector mechanics from input.

Parameters
ininput stream
objectdetector mechanics
Returns
input stream

Definition at line 191 of file JMechanics.hh.

192  {
193  using namespace JPP;
194 
195  JStringStream is(in);
196 
197  if (getFileStatus(is.str().c_str())) {
198  is.load();
199  }
200 
201  object.clear();
202 
203  is >> object.comment;
204 
205  int string;
206  JMechanics mechanics;
207 
208  while (is >> string >> mechanics) {
209  object[string] = mechanics;
210  }
211 
212  return in;
213  }
is
Definition: JDAQCHSM.chsm:167
static JStat getFileStatus
Function object for file status.
Definition: JStat.hh:173
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
Auxiliary data structure for parameters of mechanical model.
Definition: JMechanics.hh:39
std::ostream& operator<< ( std::ostream &  out,
const JDetectorMechanics object 
)
friend

Write detector mechanics to output.

Parameters
outoutput stream
objectdetector mechanics
Returns
output stream

Definition at line 223 of file JMechanics.hh.

224  {
225  using namespace std;
226 
227  out << object.comment;
228 
229  for (JDetectorMechanics::const_iterator i = object.begin(); i != object.end(); ++i) {
230  out << setw(4) << i->first << ' ' << i->second << endl;
231  }
232 
233  return out;
234  }

Member Data Documentation

JComment JACOUSTICS::JDetectorMechanics::comment

Definition at line 236 of file JMechanics.hh.


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