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

Logical location of module. More...

#include <JLocation.hh>

Inheritance diagram for JDETECTOR::JLocation:
JLANG::JComparable< JFirst_t, JSecond_t > JACOUSTICS::JGEOMETRY::JDetector::module_type JACOUSTICS::JHit< JPDF_t > JDETECTOR::JHydrophone JDETECTOR::JModule JDETECTOR::JPMTChannel JCALIBRATE::JFitK40_t< JNullType > JMONITOR::JClusterBuilder

Public Member Functions

 JLocation ()
 Default constructor. More...
 
 JLocation (const int string, const int floor)
 Constructor. More...
 
const JLocationgetLocation () const
 Get location. More...
 
JLocationgetLocation ()
 Get location. More...
 
void setLocation (const JLocation &location)
 Set location. More...
 
std::string toString () const
 Convert module location to string. More...
 
std::string toString (const std::string &fmt, const std::string target="%") const
 Convert module loation to string. More...
 
int getString () const
 Get string number. More...
 
int getFloor () const
 Get floor number. More...
 
bool less (const JLocation &location) const
 Less than method. More...
 

Protected Attributes

int string
 
int floor
 

Friends

std::istream & operator>> (std::istream &in, JLocation &location)
 Read module location from input. More...
 
std::ostream & operator<< (std::ostream &out, const JLocation &location)
 Write module location to output. More...
 
JReaderoperator>> (JReader &in, JLocation &location)
 Read module location from input. More...
 
JWriteroperator<< (JWriter &out, const JLocation &location)
 Write module location to output. More...
 

Detailed Description

Logical location of module.

The logical location of a module consists of a string and floor number.
This class implements the JLANG::JComparable interface.

Definition at line 37 of file JLocation.hh.

Constructor & Destructor Documentation

JDETECTOR::JLocation::JLocation ( )
inline

Default constructor.

Definition at line 44 of file JLocation.hh.

44  :
45  string(-1),
46  floor (-1)
47  {}
JDETECTOR::JLocation::JLocation ( const int  string,
const int  floor 
)
inline

Constructor.

Parameters
stringstring
floorfloor

Definition at line 56 of file JLocation.hh.

58  {
59  this->string = string;
60  this->floor = floor;
61  }

Member Function Documentation

const JLocation& JDETECTOR::JLocation::getLocation ( ) const
inline

Get location.

Returns
location

Definition at line 69 of file JLocation.hh.

70  {
71  return static_cast<const JLocation&>(*this);
72  }
Logical location of module.
Definition: JLocation.hh:37
JLocation& JDETECTOR::JLocation::getLocation ( )
inline

Get location.

Returns
location

Definition at line 80 of file JLocation.hh.

81  {
82  return static_cast<JLocation&>(*this);
83  }
Logical location of module.
Definition: JLocation.hh:37
void JDETECTOR::JLocation::setLocation ( const JLocation location)
inline

Set location.

Parameters
locationlocation

Definition at line 91 of file JLocation.hh.

92  {
93  static_cast<JLocation&>(*this) = location;
94  }
Logical location of module.
Definition: JLocation.hh:37
std::string JDETECTOR::JLocation::toString ( ) const
inline

Convert module location to string.

Returns
string

Definition at line 102 of file JLocation.hh.

103  {
104  return toString("% %");
105  }
std::string toString() const
Convert module location to string.
Definition: JLocation.hh:102
std::string JDETECTOR::JLocation::toString ( const std::string &  fmt,
const std::string  target = "%" 
) const
inline

Convert module loation to string.

The targets target in the format string fmt are consecutively replaced by floor and string.

Parameters
fmtformat
targettarget
Returns
string

Definition at line 118 of file JLocation.hh.

119  {
120  JLANG::JString buffer(fmt);
121 
122  buffer.replace(target, string, 1);
123  buffer.replace(target, floor, 1);
124 
125  return buffer;
126  }
Wrapper class around STL string class.
Definition: JString.hh:27
int JDETECTOR::JLocation::getString ( ) const
inline

Get string number.

Returns
string number

Definition at line 134 of file JLocation.hh.

135  {
136  return string;
137  }
int JDETECTOR::JLocation::getFloor ( ) const
inline

Get floor number.

Returns
floor number

Definition at line 145 of file JLocation.hh.

146  {
147  return floor;
148  }
bool JDETECTOR::JLocation::less ( const JLocation location) const
inline

Less than method.

Parameters
locationmodule location
Returns
true if first location before second location; else false

Definition at line 157 of file JLocation.hh.

158  {
159  if (this->getString() == location.getString())
160  return this->getFloor() < location.getFloor();
161  else
162  return this->getString() < location.getString();
163  }
int getFloor() const
Get floor number.
Definition: JLocation.hh:145
int getString() const
Get string number.
Definition: JLocation.hh:134

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JLocation location 
)
friend

Read module location from input.

Parameters
ininput stream
locationmodule location
Returns
input stream

Definition at line 173 of file JLocation.hh.

174  {
175  in >> location.string;
176  in >> location.floor;
177 
178  return in;
179  }
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
std::ostream& operator<< ( std::ostream &  out,
const JLocation location 
)
friend

Write module location to output.

Parameters
outoutput stream
locationmodule location
Returns
output stream

Definition at line 189 of file JLocation.hh.

190  {
191  using namespace std;
192 
193  out << setw(4) << location.string;
194  out << ' ';
195  out << setw(2) << location.floor;
196 
197  return out;
198  }
JReader& operator>> ( JReader in,
JLocation location 
)
friend

Read module location from input.

Parameters
inreader
locationmodule location
Returns
reader

Definition at line 208 of file JLocation.hh.

209  {
210  in >> location.string;
211  in >> location.floor;
212 
213  return in;
214  }
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
JWriter& operator<< ( JWriter out,
const JLocation location 
)
friend

Write module location to output.

Parameters
outwriter
locationmodule location
Returns
writer

Definition at line 224 of file JLocation.hh.

225  {
226  out << location.string;
227  out << location.floor;
228 
229  return out;
230  }

Member Data Documentation

int JDETECTOR::JLocation::string
protected

Definition at line 234 of file JLocation.hh.

int JDETECTOR::JLocation::floor
protected

Definition at line 235 of file JLocation.hh.


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