Jpp  17.2.1-pre0
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
JPARSER::JOption< T > Class Template Reference

Auxiliary class to handle optional I/O. More...

#include <JParser.hh>

Public Member Functions

 JOption ()
 Default constructor. More...
 
 JOption (const T &value)
 Constructor. More...
 
bool getStatus () const
 Get status. More...
 
 operator const T & () const
 Type conversion operator. More...
 
const JOption< T > & operator= (const T &value)
 Assignment to a value. More...
 
Tclone () const
 Get clone of this object. More...
 

Protected Attributes

bool __status
 
T __value
 

Friends

std::istream & operator>> (std::istream &in, JOption &object)
 Read option from input. More...
 
std::ostream & operator<< (std::ostream &out, const JOption &object)
 Write options to output. More...
 

Detailed Description

template<class T>
class JPARSER::JOption< T >

Auxiliary class to handle optional I/O.

Definition at line 123 of file JParser.hh.

Constructor & Destructor Documentation

template<class T >
JPARSER::JOption< T >::JOption ( )
inline

Default constructor.

Definition at line 128 of file JParser.hh.

128  :
129  __status(false),
130  __value()
131  {}
template<class T >
JPARSER::JOption< T >::JOption ( const T value)
inline

Constructor.

Definition at line 137 of file JParser.hh.

137  :
138  __status(false),
139  __value(value)
140  {}

Member Function Documentation

template<class T >
bool JPARSER::JOption< T >::getStatus ( ) const
inline

Get status.

Returns
status

Definition at line 148 of file JParser.hh.

149  {
150  return __status;
151  }
template<class T >
JPARSER::JOption< T >::operator const T & ( ) const
inline

Type conversion operator.

Returns
object

Definition at line 159 of file JParser.hh.

160  {
161  return __value;
162  }
template<class T >
const JOption<T>& JPARSER::JOption< T >::operator= ( const T value)
inline

Assignment to a value.

Parameters
valuevalue
Returns
this object

Definition at line 171 of file JParser.hh.

172  {
173  __status = true;
174  __value = value;
175 
176  return *this;
177  }
template<class T >
T* JPARSER::JOption< T >::clone ( ) const
inline

Get clone of this object.

Returns
pointer to newly created object if status is okay; else NULL

Definition at line 185 of file JParser.hh.

186  {
187  if (__status)
188  return new T(__value);
189  else
190  return NULL;
191  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T

Friends And Related Function Documentation

template<class T >
std::istream& operator>> ( std::istream &  in,
JOption< T > &  object 
)
friend

Read option from input.

Parameters
ininput stream
objectoption
Returns
input stream

Definition at line 201 of file JParser.hh.

202  {
203  object.__status = true;
204 
205  if (!(in >> object.__value)) {
206  in.clear();
207  }
208 
209  return in;
210  }
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::ostream& operator<< ( std::ostream &  out,
const JOption< T > &  object 
)
friend

Write options to output.

Parameters
outoutput stream
objectoption
Returns
output stream

Definition at line 220 of file JParser.hh.

221  {
222  if (object.__status) {
223  out << object.__value;
224  }
225 
226  return out;
227  }

Member Data Documentation

template<class T >
bool JPARSER::JOption< T >::__status
protected

Definition at line 230 of file JParser.hh.

template<class T >
T JPARSER::JOption< T >::__value
protected

Definition at line 231 of file JParser.hh.


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