Jpp
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | List of all members
JMARKOV::JPhotonPathReader Class Referenceabstract

#include <JPhotonPathReader.hh>

Inheritance diagram for JMARKOV::JPhotonPathReader:
JIO::JBinaryFileReader< JPhotonPath > JLANG::JAccessibleBinaryInputStream JIO::JStreamReader JIO::JReaderObjectIterator< JPhotonPath > JLANG::JAccessibleObjectIterator< T > JLANG::JAccessibleInputStream JIO::JReader JLANG::JAbstractObjectIterator< T > JLANG::JObjectIterator< T > JLANG::JAccessible JLANG::JAccessible JLANG::JBinaryInput JLANG::JAbstractObjectStatus JLANG::JObjectIterator< T > JLANG::JThrow< JAccessible > JLANG::JThrow< JAccessible >

Public Types

typedef JObjectIterator< T >::pointer_type pointer_type
 

Public Member Functions

virtual void open (const char *file_name)
 Open file. More...
 
virtual bool is_open () const
 Check is file is open. More...
 
virtual void close ()
 Close file. More...
 
virtual bool setObject (JPhotonPath &object)
 Set object. More...
 
virtual bool setObject (T &object)=0
 Set object. More...
 
virtual bool hasNext ()
 Check availability of next element. More...
 
virtual const pointer_typenext ()
 Get next element. More...
 
virtual skip_type skip (const skip_type ns)
 Skip items. More...
 

Static Public Member Functions

static void Throw (const bool option)
 Enable/disable throw option. More...
 
static int Throw (const JException &error, const int value=-1)
 Throw exception or return error. More...
 

Protected Member Functions

virtual bool getStatus () const
 Status of reader. More...
 
virtual void clear ()
 Clear status of reader. More...
 
virtual int read (char *buffer, const int length)
 Read byte array. More...
 
JReaderoperator>> (JSerialisable &object)
 Read serialisable data object. More...
 
JReaderoperator>> (bool &value)
 
JReaderoperator>> (char &value)
 
JReaderoperator>> (unsigned char &value)
 
JReaderoperator>> (short &value)
 
JReaderoperator>> (unsigned short &value)
 
JReaderoperator>> (int &value)
 
JReaderoperator>> (unsigned int &value)
 
JReaderoperator>> (long int &value)
 
JReaderoperator>> (long long int &value)
 
JReaderoperator>> (unsigned long long int &value)
 
JReaderoperator>> (float &value)
 
JReaderoperator>> (double &value)
 
JReaderoperator>> (long double &value)
 
JReaderload (JSerialisable &object)
 Read object. More...
 
template<class T >
JReaderload (T &object)
 Read object. More...
 
 operator bool () const
 Type conversion operator. More...
 
bool operator! () const
 Negated status of this object. More...
 

Protected Attributes

std::istream & in
 
object
 object More...
 
bool has_next
 status More...
 

Static Protected Attributes

static bool do_throw
 throw option More...
 

Private Attributes

pointer_type ps
 

Detailed Description

Definition at line 16 of file JPhotonPathReader.hh.

Member Typedef Documentation

◆ pointer_type

template<class T>
typedef JObjectIterator<T>::pointer_type JLANG::JAbstractObjectIterator< T >::pointer_type
inherited

Definition at line 39 of file JAbstractObjectIterator.hh.

Member Function Documentation

◆ open()

virtual void JLANG::JAccessibleBinaryInputStream::open ( const char *  file_name)
inlinevirtualinherited

Open file.

Parameters
file_namefile name

Reimplemented from JLANG::JAccessibleInputStream.

Definition at line 52 of file JAccessibleBinaryStream.hh.

53  {
54  std::ifstream::open(file_name, std::ios::binary);
55  }

◆ is_open()

virtual bool JLANG::JAccessibleInputStream::is_open ( ) const
inlinevirtualinherited

Check is file is open.

Returns
true if open; else false

Implements JLANG::JAccessible.

Definition at line 53 of file JAccessibleStream.hh.

54  {
55  return std::ifstream::is_open();
56  }

◆ close()

virtual void JLANG::JAccessibleInputStream::close ( )
inlinevirtualinherited

Close file.

Implements JLANG::JAccessible.

Definition at line 77 of file JAccessibleStream.hh.

78  {
80  }

◆ Throw() [1/2]

static void JLANG::JThrow< JAccessible >::Throw ( const bool  option)
inlinestaticinherited

Enable/disable throw option.

Parameters
optiontrue enable; false disable

Definition at line 37 of file JThrow.hh.

38  {
39  do_throw = option;
40  }

◆ Throw() [2/2]

static int JLANG::JThrow< JAccessible >::Throw ( const JException error,
const int  value = -1 
)
inlinestaticinherited

Throw exception or return error.

Parameters
errorexception
valuereturn code
Returns
return code

Definition at line 50 of file JThrow.hh.

51  {
52  using namespace std;
53 
54  if (do_throw) {
55  throw error;
56  }
57 
58  cerr << error.what() << endl;
59 
60  return value;
61  }

◆ getStatus()

virtual bool JIO::JStreamReader::getStatus ( ) const
inlinevirtualinherited

Status of reader.

Returns
status of this reader

Implements JLANG::JAbstractObjectStatus.

Definition at line 43 of file JStreamIO.hh.

44  {
45  return (bool) in;
46  }

◆ clear()

virtual void JIO::JStreamReader::clear ( )
inlinevirtualinherited

Clear status of reader.

Reimplemented from JIO::JReader.

Definition at line 52 of file JStreamIO.hh.

53  {
54  in.clear();
55  }

◆ read()

virtual int JIO::JStreamReader::read ( char *  buffer,
const int  length 
)
inlinevirtualinherited

Read byte array.

Parameters
bufferpointer to byte array
lengthnumber of bytes
Returns
number of bytes read

Implements JLANG::JBinaryInput.

Definition at line 65 of file JStreamIO.hh.

66  {
67  in.read(buffer, length);
68 
69  return in.gcount();
70  }

◆ operator>>() [1/14]

JReader& JIO::JReader::operator>> ( JSerialisable object)
inlineinherited

Read serialisable data object.

Parameters
objectserialisable data object
Returns
JReader

Definition at line 80 of file JSerialisable.hh.

81  {
82  return object.read(*this);
83  }

◆ operator>>() [2/14]

JReader& JIO::JReader::operator>> ( bool &  value)
inlineinherited

Definition at line 86 of file JSerialisable.hh.

86 { read((char*) &value, sizeof(bool)); return *this; }

◆ operator>>() [3/14]

JReader& JIO::JReader::operator>> ( char &  value)
inlineinherited

Definition at line 87 of file JSerialisable.hh.

87 { read((char*) &value, sizeof(char)); return *this; }

◆ operator>>() [4/14]

JReader& JIO::JReader::operator>> ( unsigned char &  value)
inlineinherited

Definition at line 88 of file JSerialisable.hh.

88 { read((char*) &value, sizeof(unsigned char)); return *this; }

◆ operator>>() [5/14]

JReader& JIO::JReader::operator>> ( short &  value)
inlineinherited

Definition at line 89 of file JSerialisable.hh.

89 { read((char*) &value, sizeof(short)); return *this; }

◆ operator>>() [6/14]

JReader& JIO::JReader::operator>> ( unsigned short &  value)
inlineinherited

Definition at line 90 of file JSerialisable.hh.

90 { read((char*) &value, sizeof(unsigned short)); return *this; }

◆ operator>>() [7/14]

JReader& JIO::JReader::operator>> ( int &  value)
inlineinherited

Definition at line 91 of file JSerialisable.hh.

91 { read((char*) &value, sizeof(int)); return *this; }

◆ operator>>() [8/14]

JReader& JIO::JReader::operator>> ( unsigned int &  value)
inlineinherited

Definition at line 92 of file JSerialisable.hh.

92 { read((char*) &value, sizeof(unsigned int)); return *this; }

◆ operator>>() [9/14]

JReader& JIO::JReader::operator>> ( long int &  value)
inlineinherited

Definition at line 93 of file JSerialisable.hh.

93 { read((char*) &value, sizeof(long int)); return *this; }

◆ operator>>() [10/14]

JReader& JIO::JReader::operator>> ( long long int &  value)
inlineinherited

Definition at line 94 of file JSerialisable.hh.

94 { read((char*) &value, sizeof(long long int)); return *this; }

◆ operator>>() [11/14]

JReader& JIO::JReader::operator>> ( unsigned long long int &  value)
inlineinherited

Definition at line 95 of file JSerialisable.hh.

95 { read((char*) &value, sizeof(unsigned long long int)); return *this; }

◆ operator>>() [12/14]

JReader& JIO::JReader::operator>> ( float &  value)
inlineinherited

Definition at line 96 of file JSerialisable.hh.

96 { read((char*) &value, sizeof(float)); return *this; }

◆ operator>>() [13/14]

JReader& JIO::JReader::operator>> ( double &  value)
inlineinherited

Definition at line 97 of file JSerialisable.hh.

97 { read((char*) &value, sizeof(double)); return *this; }

◆ operator>>() [14/14]

JReader& JIO::JReader::operator>> ( long double &  value)
inlineinherited

Definition at line 98 of file JSerialisable.hh.

98 { read((char*) &value, sizeof(long double)); return *this; }

◆ load() [1/2]

JReader& JIO::JReader::load ( JSerialisable object)
inlineinherited

Read object.

Parameters
objectobject
Returns
this reader

Definition at line 107 of file JSerialisable.hh.

108  {
109  return object.read(*this);
110  }

◆ load() [2/2]

template<class T >
JReader& JIO::JReader::load ( T &  object)
inlineinherited

Read object.

Parameters
objectobject
Returns
this reader

Definition at line 120 of file JSerialisable.hh.

121  {
122  return *this >> object;
123  }

◆ operator bool()

JLANG::JAbstractObjectStatus::operator bool ( ) const
inlineinherited

Type conversion operator.

Returns
status of this object

Definition at line 33 of file JAbstractObjectStatus.hh.

34  {
35  return this->getStatus();
36  }

◆ operator!()

bool JLANG::JAbstractObjectStatus::operator! ( ) const
inlineinherited

Negated status of this object.

Returns
negated status of this object

Definition at line 44 of file JAbstractObjectStatus.hh.

45  {
46  return !(this->getStatus());
47  }

◆ setObject() [1/2]

virtual bool JIO::JReaderObjectIterator< JPhotonPath >::setObject ( JPhotonPath &  object)
inlinevirtualinherited

Set object.

Parameters
objectreference to object to be set
Returns
true if set; else false

Definition at line 46 of file JReaderObjectIterator.hh.

47  {
48  return (bool) (in >> object);
49  }

◆ setObject() [2/2]

template<class T>
virtual bool JLANG::JAbstractObjectIterator< T >::setObject ( T &  object)
pure virtualinherited

◆ hasNext()

template<class T>
virtual bool JLANG::JAbstractObjectIterator< T >::hasNext ( )
inlinevirtualinherited

Check availability of next element.

Returns
true if the iteration has more elements; else false

Implements JLANG::JObjectIterator< T >.

Definition at line 56 of file JAbstractObjectIterator.hh.

57  {
58  if (!has_next) {
59  has_next = this->setObject(object);
60  }
61 
62  return has_next;
63  }

◆ next()

template<class T>
virtual const pointer_type& JLANG::JAbstractObjectIterator< T >::next ( )
inlinevirtualinherited

Get next element.

Returns
pointer to element

Implements JLANG::JObjectIterator< T >.

Definition at line 71 of file JAbstractObjectIterator.hh.

72  {
73  if (has_next)
74  ps.reset(&this->object);
75  else
76  ps.reset(NULL);
77 
78  has_next = false;
79 
80  return ps;
81  }

◆ skip()

template<class T>
virtual skip_type JLANG::JObjectIterator< T >::skip ( const skip_type  ns)
inlinevirtualinherited

Member Data Documentation

◆ do_throw

bool JLANG::JThrow< JAccessible >::do_throw
staticprotectedinherited

throw option

Set default throw option to true.

Definition at line 28 of file JThrow.hh.

◆ in

std::istream& JIO::JStreamReader::in
protectedinherited

Definition at line 73 of file JStreamIO.hh.

◆ object

template<class T>
T JLANG::JAbstractObjectIterator< T >::object
protectedinherited

object

Definition at line 34 of file JAbstractObjectIterator.hh.

◆ has_next

template<class T>
bool JLANG::JAbstractObjectIterator< T >::has_next
protectedinherited

status

Definition at line 35 of file JAbstractObjectIterator.hh.

◆ ps

template<class T>
pointer_type JLANG::JAbstractObjectIterator< T >::ps
privateinherited

Definition at line 84 of file JAbstractObjectIterator.hh.


The documentation for this class was generated from the following file:
JLANG::JAbstractObjectIterator::object
T object
object
Definition: JAbstractObjectIterator.hh:34
JEEP::close
void close(std::istream *pf)
Close file.
Definition: JeepToolkit.hh:342
JLANG::skip_type
unsigned int skip_type
Type definition for number of objects to skip.
Definition: JObjectIterator.hh:25
JLANG::JObjectIterator::hasNext
virtual bool hasNext()=0
Check availability of next element.
JLANG::JPointer::reset
virtual void reset()
Reset pointer.
Definition: JPointer.hh:84
JLANG::JBinaryInput::read
virtual int read(char *buffer, const int length)=0
Read byte array.
JLANG::JAbstractObjectIterator::has_next
bool has_next
status
Definition: JAbstractObjectIterator.hh:35
JEEP::open
T * open(const std::string &file_name)
Open file.
Definition: JeepToolkit.hh:302
JLANG::JAbstractObjectIterator::ps
pointer_type ps
Definition: JAbstractObjectIterator.hh:84
std
Definition: jaanetDictionary.h:36
JLANG::JAbstractObjectIterator::setObject
virtual bool setObject(T &object)=0
Set object.
JLANG::JThrow< JAccessible >::do_throw
static bool do_throw
throw option
Definition: JThrow.hh:28
JIO::JReaderObjectIterator< JPhotonPath >::in
JReader & in
Definition: JReaderObjectIterator.hh:52
JLANG::JException::what
virtual const char * what() const
Get error message.
Definition: JException.hh:65
JLANG::JAbstractObjectStatus::getStatus
virtual bool getStatus() const =0
Get status of object.
JIO::JStreamReader::in
std::istream & in
Definition: JStreamIO.hh:73
JLANG::JObjectIterator::next
virtual const pointer_type & next()=0
Get next element.