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

Universal product identifier (UPI). More...

#include <JUPI_t.hh>

Inheritance diagram for JDATABASE::JUPI_t:
JDATABASE::JPBS_t std::vector< int > JDETECTOR::JHVCalibration_t JDETECTOR::JPMTThresholdCalibration_t

Public Member Functions

 JUPI_t ()
 Default constructor. More...
 
 JUPI_t (const JPBS_t &pbs)
 Constructor. More...
 
 JUPI_t (const JPBS_t &pbs, const std::string &variant, const int version, const int number)
 Constructor. More...
 
 JUPI_t (const std::string &upi)
 Constructor. More...
 
const JUPI_tgetUPI () const
 Get UPI. More...
 
const std::string & getVariant () const
 Get variant. More...
 
int getVersion () const
 Get version. More...
 
int getNumber () const
 Get serial number. More...
 
std::string toString () const
 Convert UPI. More...
 
 ClassDefNV (JUPI_t, 1)
 
const JPBS_tgetPBS () const
 Get PBS. More...
 
bool is_valid () const
 Check validity. More...
 
 ClassDefNV (JPBS_t, 1)
 

Static Public Attributes

static const char SEPARATOR = '/'
 Separator between PBS, variant and version. More...
 
static const char DOT = '.'
 Separator between PBS values. More...
 

Protected Attributes

std::string variant
 
int version
 
int number
 

Friends

bool operator== (const JUPI_t &first, const JUPI_t &second)
 Equality. More...
 
bool operator< (const JUPI_t &first, const JUPI_t &second)
 Less-than operator. More...
 
std::istream & operator>> (std::istream &in, JUPI_t &object)
 Read UPI from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JUPI_t &object)
 Write UPI to output stream. More...
 

Detailed Description

Universal product identifier (UPI).

The UPI consists of a PBS, variant, version and serial number.
The corresponding ASCII format reads "<int>[.<int>]*/<variant>/<int>.<int>".

Definition at line 29 of file JUPI_t.hh.

Constructor & Destructor Documentation

JDATABASE::JUPI_t::JUPI_t ( )
inline

Default constructor.

Definition at line 41 of file JUPI_t.hh.

41  :
42  JPBS_t (),
43  variant(),
44  version(-1),
45  number (-1)
46  {}
JPBS_t()
Default constructor.
Definition: JPBS_t.hh:39
std::string variant
Definition: JUPI_t.hh:250
JDATABASE::JUPI_t::JUPI_t ( const JPBS_t pbs)
inline

Constructor.

Parameters
pbsPBS

Definition at line 54 of file JUPI_t.hh.

54  :
55  JPBS_t (pbs),
56  variant(),
57  version(-1),
58  number (-1)
59  {}
JPBS_t()
Default constructor.
Definition: JPBS_t.hh:39
std::string variant
Definition: JUPI_t.hh:250
JDATABASE::JUPI_t::JUPI_t ( const JPBS_t pbs,
const std::string &  variant,
const int  version,
const int  number 
)
inline

Constructor.

Parameters
pbsPBS
variantvariant
versionversion
numberserial number

Definition at line 70 of file JUPI_t.hh.

73  :
74  JPBS_t (pbs),
77  number (number)
78  {}
JPBS_t()
Default constructor.
Definition: JPBS_t.hh:39
std::string variant
Definition: JUPI_t.hh:250
JDATABASE::JUPI_t::JUPI_t ( const std::string &  upi)
inline

Constructor.

Parameters
upiUPI

Definition at line 86 of file JUPI_t.hh.

87  {
88  std::istringstream(upi) >> *this;
89  }

Member Function Documentation

const JUPI_t& JDATABASE::JUPI_t::getUPI ( ) const
inline

Get UPI.

Returns
UPI

Definition at line 97 of file JUPI_t.hh.

98  {
99  return static_cast<const JUPI_t&>(*this);
100  }
Universal product identifier (UPI).
Definition: JUPI_t.hh:29
const std::string& JDATABASE::JUPI_t::getVariant ( ) const
inline

Get variant.

Returns
variant

Definition at line 108 of file JUPI_t.hh.

109  {
110  return variant;
111  }
std::string variant
Definition: JUPI_t.hh:250
int JDATABASE::JUPI_t::getVersion ( ) const
inline

Get version.

Returns
version

Definition at line 119 of file JUPI_t.hh.

120  {
121  return version;
122  }
int JDATABASE::JUPI_t::getNumber ( ) const
inline

Get serial number.

Returns
serial number

Definition at line 130 of file JUPI_t.hh.

131  {
132  return number;
133  }
std::string JDATABASE::JUPI_t::toString ( ) const
inline

Convert UPI.

Returns
UPI

Definition at line 141 of file JUPI_t.hh.

142  {
143  std::ostringstream os;
144 
145  os << *this;
146 
147  return os.str();
148  }
JDATABASE::JUPI_t::ClassDefNV ( JUPI_t  ,
 
)
const JPBS_t& JDATABASE::JPBS_t::getPBS ( ) const
inlineinherited

Get PBS.

Returns
PBS

Definition at line 101 of file JPBS_t.hh.

102  {
103  return static_cast<const JPBS_t&>(*this);
104  }
Product breakdown structure (PBS).
Definition: JPBS_t.hh:27
bool JDATABASE::JPBS_t::is_valid ( ) const
inlineinherited

Check validity.

Returns
true if valid; else false

Definition at line 112 of file JPBS_t.hh.

113  {
114  return !this->empty();
115  }
JDATABASE::JPBS_t::ClassDefNV ( JPBS_t  ,
 
)
inherited

Friends And Related Function Documentation

bool operator== ( const JUPI_t first,
const JUPI_t second 
)
friend

Equality.

Parameters
firstfirst UPI
secondsecond UPI
Returns
true if UPIs are equals; else false

Definition at line 158 of file JUPI_t.hh.

159  {
160  return (first.getPBS() == second.getPBS() &&
161  first.getVariant() == second.getVariant() &&
162  first.getVersion() == second.getVersion() &&
163  first.getNumber() == second.getNumber());
164  }
int getNumber() const
Get serial number.
Definition: JUPI_t.hh:130
const std::string & getVariant() const
Get variant.
Definition: JUPI_t.hh:108
const JPBS_t & getPBS() const
Get PBS.
Definition: JPBS_t.hh:101
int getVersion() const
Get version.
Definition: JUPI_t.hh:119
bool operator< ( const JUPI_t first,
const JUPI_t second 
)
friend

Less-than operator.

Parameters
firstfirst UPI
secondsecond UPI
Returns
true if first UPI less then second UPI; else false

Definition at line 174 of file JUPI_t.hh.

175  {
176  if (first.getPBS() == second.getPBS()) {
177 
178  if (first.getVariant() == second.getVariant()) {
179 
180  if (first.getVersion() == second.getVersion())
181  return first.getNumber() < second.getNumber();
182  else
183  return first.getVersion() < second.getVersion();
184 
185  } else {
186 
187  return first.getVariant() < second.getVariant();
188  }
189 
190  } else {
191 
192  return first.getPBS() < second.getPBS();
193  }
194  }
int getNumber() const
Get serial number.
Definition: JUPI_t.hh:130
const std::string & getVariant() const
Get variant.
Definition: JUPI_t.hh:108
const JPBS_t & getPBS() const
Get PBS.
Definition: JPBS_t.hh:101
int getVersion() const
Get version.
Definition: JUPI_t.hh:119
std::istream& operator>> ( std::istream &  in,
JUPI_t object 
)
friend

Read UPI from input stream.

Parameters
ininput stream
objectUPI
Returns
input stream

Definition at line 204 of file JUPI_t.hh.

205  {
206  using namespace std;
207 
208  object = JUPI_t();
209 
210  if (in >> static_cast<JPBS_t&>(object)) {
211 
212  if (!(in.get() == (int) SEPARATOR &&
213  getline(in, object.variant, SEPARATOR) &&
214  in >> object.version &&
215  in.get() == (int) DOT &&
216  in >> object.number)) {
217 
218  in.setstate(ios::failbit);
219  }
220  }
221 
222  return in;
223  }
static const char SEPARATOR
Separator between PBS, variant and version.
Definition: JUPI_t.hh:35
std::string variant
Definition: JUPI_t.hh:250
JUPI_t()
Default constructor.
Definition: JUPI_t.hh:41
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
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
static const char DOT
Separator between PBS values.
Definition: JPBS_t.hh:33
std::ostream& operator<< ( std::ostream &  out,
const JUPI_t object 
)
friend

Write UPI to output stream.

Parameters
outoutput stream
objectUPI
Returns
output stream

Definition at line 233 of file JUPI_t.hh.

234  {
235  using namespace std;
236 
237  ostringstream os; // allow for width formatting
238 
239  os << object.getPBS() << JUPI_t::SEPARATOR
240  << object.getVariant() << JUPI_t::SEPARATOR
241  << object.getVersion() << JUPI_t::DOT
242  << object.getNumber();
243 
244  return out << os.str();
245  }
static const char SEPARATOR
Separator between PBS, variant and version.
Definition: JUPI_t.hh:35
static const char DOT
Separator between PBS values.
Definition: JPBS_t.hh:33

Member Data Documentation

const char JDATABASE::JUPI_t::SEPARATOR = '/'
static

Separator between PBS, variant and version.

Definition at line 35 of file JUPI_t.hh.

std::string JDATABASE::JUPI_t::variant
protected

Definition at line 250 of file JUPI_t.hh.

int JDATABASE::JUPI_t::version
protected

Definition at line 251 of file JUPI_t.hh.

int JDATABASE::JUPI_t::number
protected

Definition at line 252 of file JUPI_t.hh.

const char JDATABASE::JPBS_t::DOT = '.'
staticinherited

Separator between PBS values.

Definition at line 33 of file JPBS_t.hh.


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