Class Index Cross Index Namespace Index

Class FrameCPP::Version_3_4_5::FrameReaderBase

FrameReaderBase
Contained in: FrameCPP::Version_3_4_5
Derived from: FrameCPP::Version_3_4_5::Input
Derived by: FrameCPP::Version_3_4_5::DaqReader FrameCPP::Version_3_4_5::FrameReader FrameCPP::Version_3_4_5::GeneralReader FrameCPP::Version_3_4_5::TOCReader

#include "../../../../../lib/framecpp/src/Version3_4_5/framereaderbase.hh"


public function member index:

FrameReaderBase(std::istream& in, bool autoReset = false); Constructor
virtual ~FrameReaderBase(); Destructor
bool byteSwapNeeded(); See if file input requires byte swapping
INT_2U currentInstance(); Get current input object's frame structure instance
INT_4U getFrameNumber(); Read the `number of frames'.
inline INT_4U getFrames() const; Get the number of frames read.
inline bool isAutoReset() const; Check if AutoReset is on.
inline FrameReaderBase& operator >>(CHAR& v); Read a CHAR.
inline FrameReaderBase& operator >>(CHAR_U& v); Read a CHAR_U
inline FrameReaderBase& operator >>(INT_2S& v); Read an INT_2S
inline FrameReaderBase& operator >>(INT_2U& v); Read an INT_2U
inline FrameReaderBase& operator >>(INT_4S& v); Read an INT_4S
inline FrameReaderBase& operator >>(INT_4U& v); Read an INT_4U
inline FrameReaderBase& operator >>(INT_8S& v); Read an INT_8S
inline FrameReaderBase& operator >>(INT_8U& v); Read an INT_8U
inline FrameReaderBase& operator >>(REAL_4& v); Read a REAL_4
inline FrameReaderBase& operator >>(REAL_8& v); Read a REAL_8
inline FrameReaderBase& operator >>(std::string& v); Read a std::string
inline FrameReaderBase& operator >>(Time& t); Read a Time
inline FrameReaderBase& operator >>(Location& t); Read a Location
FrameReaderBase& operator >>(Base** v); Read a pointer to an object.
FrameReaderBase& operator >>(Container< T >& c); Read a container
Frame* readFrame(); Read a Frame
virtual void readNextNodeReference(); Read next Linked-list Node
void readType(T*, unsigned int n); Read an array
void reset(); Reset the Reader
inline void setAutoReset(bool autoReset); Set the AutoReset flag.
 

protected function member index:

bool readBase(); Read a Frame Object
virtual void readBaseHook(Base* base, INT_2U classId); Read Object Hook
void readEndOfFile(); Read End-Of-File
void reconnect(bool ignoreErrors = false); Resolve References
 

Description:

This class contains methods which are used by the Frame objects to read themselves in.

In a frame file, containers are implemented by using linked-lists. Every object in the file which can be contained by another object has a pointer to the next element in the linked list. This creates a class which is both a linked-list element and a linked-list container. Internally, FrameCPP does not use linked-lists. The "pointer to next" in the frame objects has been removed.

This is the general read procedure:

  1. readFrame is called.
  2. FrameReaderBase calls Input::readNextObjectHeader to get information about the next object.
  3. Make sure that it is a frame header and call the read method for the Frame class (via the object store).
  4. Continue call readNextObjectHeader and reading objects (via the store) until an EndOfFrame or EndOfFile occurs.
  5. Reconnect references (see the next section).
  6. Delete internal data.
  7. Read EndOfFile if it is next.

This is the object component read procedure:

  1. If the component is a simple data type, nothing special happens. Just read it in. For example, there is nothing special in reading a REAL_4, FrameReaderBase just calls the Input method to read it.
  2. If the component is the beginning of a linked list, the extraction operator for Container< T >& is called. This will store a reference to the Container (as a RefHeadBase) in the mLinkedListStart member, along with the Reference to the starting member of the list.
  3. If the component is a next pointer, then the readNextNodeReference method is called. This reads a reference to the next object and stores this reference, along with the reference to the current object, in the mLinkedListNodes member.


Function Member Descriptions:


FrameCPP::Version_3_4_5::FrameReaderBase::FrameReaderBase - Constructor


FrameReaderBase(std::istream& in, bool autoReset = false);

Parameters:
ParameterDescription
std::istream& inThe stream to read from.
bool autoResetTrue if the reader should automatically reset itself when an end-of-file structure is read.

Exceptions:
ExceptionDescription
None.



FrameCPP::Version_3_4_5::FrameReaderBase::~FrameReaderBase - Destructor


virtual ~FrameReaderBase();



FrameCPP::Version_3_4_5::FrameReaderBase::byteSwapNeeded - See if file input requires byte swapping


bool byteSwapNeeded();



FrameCPP::Version_3_4_5::FrameReaderBase::currentInstance - Get current input object's frame structure instance


INT_2U currentInstance();

Exceptions:
ExceptionDescription
None.



FrameCPP::Version_3_4_5::FrameReaderBase::getFrameNumber - Read the `number of frames'.


INT_4U getFrameNumber();

Return value:
INT_4U- How many frames are there in the frame file.

Exceptions:
ExceptionDescription
read_failureRead failed.



FrameCPP::Version_3_4_5::FrameReaderBase::getFrames - Get the number of frames read.


inline INT_4U getFrames() const;

Return value:
INT_4U- The number of frames read.

Exceptions:
ExceptionDescription
None.
None.



FrameCPP::Version_3_4_5::FrameReaderBase::isAutoReset - Check if AutoReset is on.


inline bool isAutoReset() const;

Return value:
bool- True is AutoReset is on.

Exceptions:
ExceptionDescription
None.
None.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read a CHAR.


inline FrameReaderBase& operator >>(CHAR& v);

Parameters:
ParameterDescription
CHAR& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read a CHAR_U


inline FrameReaderBase& operator >>(CHAR_U& v);

Parameters:
ParameterDescription
CHAR_U& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read an INT_2S


inline FrameReaderBase& operator >>(INT_2S& v);

Parameters:
ParameterDescription
INT_2S& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read an INT_2U


inline FrameReaderBase& operator >>(INT_2U& v);

Parameters:
ParameterDescription
INT_2U& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read an INT_4S


inline FrameReaderBase& operator >>(INT_4S& v);

Parameters:
ParameterDescription
INT_4S& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read an INT_4U


inline FrameReaderBase& operator >>(INT_4U& v);

Parameters:
ParameterDescription
INT_4U& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read an INT_8S


inline FrameReaderBase& operator >>(INT_8S& v);

Parameters:
ParameterDescription
INT_8S& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read an INT_8U


inline FrameReaderBase& operator >>(INT_8U& v);

Parameters:
ParameterDescription
INT_8U& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read a REAL_4


inline FrameReaderBase& operator >>(REAL_4& v);

Parameters:
ParameterDescription
REAL_4& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read a REAL_8


inline FrameReaderBase& operator >>(REAL_8& v);

Parameters:
ParameterDescription
REAL_8& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read a std::string


inline FrameReaderBase& operator >>(std::string& v);

Parameters:
ParameterDescription
std::string& vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read a Time


inline FrameReaderBase& operator >>(Time& t);

Parameters:
ParameterDescription
Time& tTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read a Location


inline FrameReaderBase& operator >>(Location& t);

Parameters:
ParameterDescription
Location& lTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read a pointer to an object.


FrameReaderBase& operator >>(Base** v);
Some frame structures have a pointer to another object which is not part of a linked-list. This method reads in those pointers.

Parameters:
ParameterDescription
Base** vTarget.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::operator >> - Read a container


FrameReaderBase& operator >>(Container< T >& c);

Parameters:
ParameterDescription
Container< T >& cThe container to read into.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failure occured.
read_failureRead failed.



FrameCPP::Version_3_4_5::FrameReaderBase::readBase - Read a Frame Object


bool readBase();

Return value:
bool- True if the end-of-frame object was read.

Exceptions:
ExceptionDescription
std::bad_allocMemory allocation failed.
read_failureRead failure accured.



FrameCPP::Version_3_4_5::FrameReaderBase::readBaseHook - Read Object Hook


virtual void readBaseHook(Base* base, INT_2U classId);

Exceptions:
ExceptionDescription
std::bad_allocMemory allocation failed.



FrameCPP::Version_3_4_5::FrameReaderBase::readEndOfFile - Read End-Of-File


void readEndOfFile();
This reads the end-of-file structure.




FrameCPP::Version_3_4_5::FrameReaderBase::readFrame - Read a Frame


Frame* readFrame();

Return value:
Frame*- Newly allocated.

Exceptions:
ExceptionDescription
std::bad_allocMemory allocation failed.
read_failureRead failure accured.



FrameCPP::Version_3_4_5::FrameReaderBase::readNextNodeReference - Read next Linked-list Node


virtual void readNextNodeReference();
This method reads in the next node of a linked list. for example, this method is called when reading in the 'next' field in an FrAdcData struct.

Exceptions:
ExceptionDescription
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::readType - Read an array


void readType(T*, unsigned int n);

Parameters:
ParameterDescription
T* dataTarget array.
unsigned int nNumber of array elements to read.

Return value:
FrameReaderBase&- This object.

Exceptions:
ExceptionDescription
read_failureRead failure occured.



FrameCPP::Version_3_4_5::FrameReaderBase::reconnect - Resolve References


void reconnect(bool ignoreErrors = false);
This method puts the frame together, resolving the references which were read during the read process.




FrameCPP::Version_3_4_5::FrameReaderBase::reset - Reset the Reader


void reset();

Exceptions:
ExceptionDescription
None.



FrameCPP::Version_3_4_5::FrameReaderBase::setAutoReset - Set the AutoReset flag.


inline void setAutoReset(bool autoReset);
If AutoReset is on, then this class will reset itself whenever the end-of-file structure is read.

Parameters:
ParameterDescription
bool autoResetTrue if want to enable autoreset.

Exceptions:
ExceptionDescription
None.
None.



Variable Member Descriptions:


FrameCPP::Version_3_4_5::FrameReaderBase::mAutoReset - Input stream is reset at the end of frame file.

bool mAutoReset;

FrameCPP::Version_3_4_5::FrameReaderBase::mCurrentObjectHeader - Current frame structure object header.

ObjectHeader mCurrentObjectHeader;

FrameCPP::Version_3_4_5::FrameReaderBase::mEndOfFile - At the end of frame file.

bool mEndOfFile;

FrameCPP::Version_3_4_5::FrameReaderBase::mFrame - Current frame.

Frame* mFrame;

FrameCPP::Version_3_4_5::FrameReaderBase::mLinkedListNodes -

LinkedListNodes mLinkedListNodes;

FrameCPP::Version_3_4_5::FrameReaderBase::mLinkedListStart -

LinkedListStart mLinkedListStart;

FrameCPP::Version_3_4_5::FrameReaderBase::mNFrames - The number of frames read.

unsigned int mNFrames;

FrameCPP::Version_3_4_5::FrameReaderBase::mObjectStorage -

ObjectStorage mObjectStorage;

FrameCPP::Version_3_4_5::FrameReaderBase::mPointers -

Pointers mPointers;

FrameCPP::Version_3_4_5::FrameReaderBase::mStatDetectorPointers -

Pointers mStatDetectorPointers;