Jpp  19.0.0
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::JProxy< T, true > Class Template Reference

Template specialisation of JProxy for fundamental data type. More...

#include <JParser.hh>

Public Member Functions

 JProxy (const std::string &option, const T &value)
 Constructor. More...
 
 JProxy (const T &value)
 Constructor. More...
 
const TgetValue () const
 Get actual value. More...
 
const std::string & getOption () const
 Get option. More...
 
const TgetCustom () const
 Get custom value. More...
 
 operator const T & () const
 Type conversion operator. More...
 
JProxyoperator= (const JProxy &object)
 Assignment operator. More...
 
JProxyoperator= (const T &value)
 Assignment to a value. More...
 

Protected Attributes

T __value
 
std::string __option
 
T __custom
 

Friends

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

Detailed Description

template<class T>
class JPARSER::JProxy< T, true >

Template specialisation of JProxy for fundamental data type.

Definition at line 131 of file JParser.hh.

Constructor & Destructor Documentation

template<class T >
JPARSER::JProxy< T, true >::JProxy ( const std::string &  option,
const T value 
)
inline

Constructor.

Parameters
optiontextual value
valuecustom value

Definition at line 140 of file JParser.hh.

140  :
141  __value (),
142  __option(option),
143  __custom(value)
144  {}
template<class T >
JPARSER::JProxy< T, true >::JProxy ( const T value)
inline

Constructor.

Parameters
valueactual value

Definition at line 152 of file JParser.hh.

152  :
153  __value (value),
154  __option(),
155  __custom()
156  {}

Member Function Documentation

template<class T >
const T& JPARSER::JProxy< T, true >::getValue ( ) const
inline

Get actual value.

Returns
value

Definition at line 164 of file JParser.hh.

165  {
166  return __value;
167  }
template<class T >
const std::string& JPARSER::JProxy< T, true >::getOption ( ) const
inline

Get option.

Returns
option

Definition at line 175 of file JParser.hh.

176  {
177  return __option;
178  }
template<class T >
const T& JPARSER::JProxy< T, true >::getCustom ( ) const
inline

Get custom value.

Returns
value

Definition at line 186 of file JParser.hh.

187  {
188  return __custom;
189  }
template<class T >
JPARSER::JProxy< T, true >::operator const T & ( ) const
inline

Type conversion operator.

Returns
object

Definition at line 197 of file JParser.hh.

198  {
199  return __value;
200  }
template<class T >
JProxy& JPARSER::JProxy< T, true >::operator= ( const JProxy< T, true > &  object)
inline

Assignment operator.

Note that only the actual value is assigned.

Parameters
objectobject
Returns
this object

Definition at line 211 of file JParser.hh.

212  {
213  __value = object.__value;
214 
215  return *this;
216  }
template<class T >
JProxy& JPARSER::JProxy< T, true >::operator= ( const T value)
inline

Assignment to a value.

Parameters
valuevalue
Returns
this object

Definition at line 225 of file JParser.hh.

226  {
227  __value = value;
228 
229  return *this;
230  }

Friends And Related Function Documentation

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

Read option from input.

Parameters
ininput stream
objectoption
Returns
input stream

Definition at line 240 of file JParser.hh.

241  {
242  using namespace std;
243 
244  string buffer;
245 
246  if (getline(in, buffer)) {
247 
248  if (buffer == object.__option) {
249 
250  object.__value = object.__custom;
251 
252  } else {
253 
254  istringstream is(buffer);
255 
256  is >> object.__value;
257 
258  in.setstate(is.rdstate());
259  }
260  }
261 
262  return in;
263  }
is
Definition: JDAQCHSM.chsm:167
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
then fatal The output file must have the wildcard in the e g root fi 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:48
template<class T >
std::ostream& operator<< ( std::ostream &  out,
const JProxy< T, true > &  object 
)
friend

Write options to output.

Parameters
outoutput stream
objectoption
Returns
output stream

Definition at line 273 of file JParser.hh.

274  {
275  return out << object.__value;
276  }

Member Data Documentation

template<class T >
T JPARSER::JProxy< T, true >::__value
protected

Definition at line 279 of file JParser.hh.

template<class T >
std::string JPARSER::JProxy< T, true >::__option
protected

Definition at line 280 of file JParser.hh.

template<class T >
T JPARSER::JProxy< T, true >::__custom
protected

Definition at line 281 of file JParser.hh.


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