Class Index Cross Index Namespace Index

Class FrameCPP::Version_3_4_5::Input

Input
Contained in: FrameCPP::Version_3_4_5
Derived from: none
Derived by: FrameCPP::Version_3_4_5::DaqFrame FrameCPP::Version_3_4_5::FrameReaderBase

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


public function member index:

Input(std::istream* in=0, FileHeader* fh=0); Constructor
virtual ~Input(); Destructor
inline void clearErrors(); Clear the errors
inline Input::error_iterator errorBegin() const; Error Begin
inline Input::error_iterator errorEnd() const; Error End
inline const std::string& errorFirst() const; Get first error
inline const std::string& errorLast() const; Get last error
inline unsigned int errorQuantity() const; Error Quantity
inline INT_2U getDataFormatVersion() const; Get frame file data format vesion
inline const std::string& getError(unsigned int index) const; Get an error
inline INT_4U getNBytes() const; Get Number of Bytes Read
inline Input& operator >>(CHAR& v); Read a CHAR
inline Input& operator >>(CHAR_U& v); Read a CHAR_U
inline Input& operator >>(INT_2S& v); Read an INT_2S
inline Input& operator >>(INT_2U& v); Read an INT_2U
inline Input& operator >>(INT_4S& v); Read an INT_4S
inline Input& operator >>(INT_4U& v); Read an INT_4U
inline Input& operator >>(INT_8S& v); Read an INT_8S
inline Input& operator >>(INT_8U& v); Read an INT_8U
inline Input& operator >>(REAL_4& v); Read an REAL_4
inline Input& operator >>(REAL_8& v); Read an REAL_8
Input& operator >>(std::string& v); Read a STRING.
void read(void*, unsigned int n); Read Bytes
virtual ObjectHeader readNextObjectHeader(); Get next object header.
void reset(); Reset the Input object
void setErrorWatch(void(*f)(const std::string&)); Set an Error Watch
void skip(unsigned int n); Skip bytes
inline void skipCurrentObject(); Skip the length of the current object header
 

protected function member index:

void addError(const std::string& msg); Add an Error
 

private function member index:

void(*mErrorWatch);
void endDictionaryElement(); Finish a Dictionary Element
void readStructureElement(INT_4U length); Read a Structure Element
void readStructureHeader(); Read Structure Header (Dictionary Element)
 

Description:

This class' responsibilities are:

  1. Read object headers:
    1. If the header corresponds to a Structure Header or Structure Element then read it in and remember it.
    2. Convert the file class ID to the local class ID for the object.
    3. If the object is unknown, skip it.
  2. Provide bulk reads (through the use of the FileHeader class).
  3. Store information about errors and warnings which occur during the read process.

An instance of this class is constructed with an istream object. When the user performs the first read request, the Input class attempts to read the File Header, once this is loaded then the read is processed.


Function Member Descriptions:


FrameCPP::Version_3_4_5::Input::Input - Constructor


Input(std::istream* in=0, FileHeader* fh=0);
Creates an input object which reads the passed stream.

Parameters:
ParameterDescription
istream& inThe stream to read.
FileHeader* fhOptional file header.

Exceptions:
ExceptionDescription
None.



FrameCPP::Version_3_4_5::Input::void


void(*mErrorWatch);



FrameCPP::Version_3_4_5::Input::~Input - Destructor


virtual ~Input();
We only need to delete the FileHeader.




FrameCPP::Version_3_4_5::Input::addError - Add an Error


void addError(const std::string& msg);

Parameters:
ParameterDescription
const strin& msgError message.

Exceptions:
ExceptionDescription
None.



FrameCPP::Version_3_4_5::Input::clearErrors - Clear the errors


inline void clearErrors();

Exceptions:
ExceptionDescription
None.
None.



FrameCPP::Version_3_4_5::Input::endDictionaryElement - Finish a Dictionary Element


void endDictionaryElement();
This closes a dictionary element and adds a translation entry to the translation map (this map stores a mapping between file class ID's and local class ID's).




FrameCPP::Version_3_4_5::Input::errorBegin - Error Begin


inline Input::error_iterator errorBegin() const;
Get an iterator pointing to the first iterator.

Return value:
error_iterator

Exceptions:
ExceptionDescription
None.
None.



FrameCPP::Version_3_4_5::Input::errorEnd - Error End


inline Input::error_iterator errorEnd() const;
Get an iterator pointing immediately past the last iterator.

Return value:
error_iterator

Exceptions:
ExceptionDescription
None.
None.



FrameCPP::Version_3_4_5::Input::errorFirst - Get first error


inline const std::string& errorFirst() const;

Return value:
const std::string&

Exceptions:
ExceptionDescription
None.
None.



FrameCPP::Version_3_4_5::Input::errorLast - Get last error


inline const std::string& errorLast() const;

Return value:
const std::string&

Exceptions:
ExceptionDescription
None.
None.



FrameCPP::Version_3_4_5::Input::errorQuantity - Error Quantity


inline unsigned int errorQuantity() const;
Get the number of errors.

Return value:
unsigned int

Exceptions:
ExceptionDescription
None.
None.



FrameCPP::Version_3_4_5::Input::getDataFormatVersion - Get frame file data format vesion


inline INT_2U getDataFormatVersion() const;

Return value:
INT_2U- input frame data format version or 0 if not read yet

Exceptions:
ExceptionDescription
None.
None.



FrameCPP::Version_3_4_5::Input::getError - Get an error


inline const std::string& getError(unsigned int index) const;

Parameters:
ParameterDescription
unsigned int indexError index.

Return value:
const std::string&- Error message.

Exceptions:
ExceptionDescription
std::range_error
std::range_errorThrown if the requested error index does not exist.



FrameCPP::Version_3_4_5::Input::getNBytes - Get Number of Bytes Read


inline INT_4U getNBytes() const;

Return value:
INT_4U- The number of bytes read.

Exceptions:
ExceptionDescription
None.
None.



FrameCPP::Version_3_4_5::Input::operator >> - Read a CHAR


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

Parameters:
ParameterDescription
CHAR& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failed.



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


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

Parameters:
ParameterDescription
CHAR_U& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



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


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

Parameters:
ParameterDescription
INT_2S& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failed.



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


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

Parameters:
ParameterDescription
INT_2U& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead fialure occured.



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


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

Parameters:
ParameterDescription
INT_4S& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



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


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

Parameters:
ParameterDescription
INT_4U& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



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


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

Parameters:
ParameterDescription
INT_8S& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



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


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

Parameters:
ParameterDescription
INT_8U& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::Input::operator >> - Read an REAL_4


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

Parameters:
ParameterDescription
REAL_4& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::Input::operator >> - Read an REAL_8


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

Parameters:
ParameterDescription
REAL_8& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failure occured.



FrameCPP::Version_3_4_5::Input::operator >> - Read a STRING.


Input& operator >>(std::string& v);

Parameters:
ParameterDescription
std::string& vTarget.

Return value:
Input&- This object.

Exceptions:
ExceptionDescription
read_failureString read failed.



FrameCPP::Version_3_4_5::Input::read - Read Bytes


void read(void*, unsigned int n);

Parameters:
ParameterDescription
void* bufferthe location to store the bytes
unsigned int nThe number of bytes to read

Exceptions:
ExceptionDescription
read_failureRead failed.



FrameCPP::Version_3_4_5::Input::readNextObjectHeader - Get next object header.


virtual ObjectHeader readNextObjectHeader();
This returns the object header for the next item in the frame file. This method skips over structure headers and structure elements, storing their information.

Exceptions:
ExceptionDescription
read_failureRead failed.



FrameCPP::Version_3_4_5::Input::readStructureElement - Read a Structure Element


void readStructureElement(INT_4U length);

Parameters:
ParameterDescription
INT_4U lengththe length of the structure element. This is needed in case this is a stray structure element, in which case the structure element will be skipped.

Exceptions:
ExceptionDescription
read_failureRead failed.



FrameCPP::Version_3_4_5::Input::readStructureHeader - Read Structure Header (Dictionary Element)


void readStructureHeader();
This method reads a structure header. the object header must have already been read.

Exceptions:
ExceptionDescription
read_failureRead failed.



FrameCPP::Version_3_4_5::Input::reset - Reset the Input object


void reset();
This causes the input object to re-read the fileheader from the stream when the next frame is read.

Exceptions:
ExceptionDescription
None.



FrameCPP::Version_3_4_5::Input::setErrorWatch - Set an Error Watch


void setErrorWatch(void(*f)(const std::string&));
An error watch is a method which is called whenever an error is added to the Input class.

Parameters:
ParameterDescription
void (*f)(const std::string&)The function to call when an error occurs. If this is null, then no function will be called.

Exceptions:
ExceptionDescription
None.



FrameCPP::Version_3_4_5::Input::skip - Skip bytes


void skip(unsigned int n);

Parameters:
ParameterDescription
unsigned int lengthThe number of bytes to skip.

Exceptions:
ExceptionDescription
read_failureRead failed.



FrameCPP::Version_3_4_5::Input::skipCurrentObject - Skip the length of the current object header


inline void skipCurrentObject();

Exceptions:
ExceptionDescription
read_failureRead failed.
read_failureRead failed.



Variable Member Descriptions:


FrameCPP::Version_3_4_5::Input::dictionary - Input frame file dictionary.

Dictionary* dictionary;

FrameCPP::Version_3_4_5::Input::mCurrentSH - Read Internal State.

SH* mCurrentSH;

FrameCPP::Version_3_4_5::Input::mErrors - Error messages.

std::vector< std::string > mErrors;

FrameCPP::Version_3_4_5::Input::mFileHeader - Frame file header.

FileHeader* mFileHeader;

FrameCPP::Version_3_4_5::Input::mIsHeaderLoaded -

bool mIsHeaderLoaded;

FrameCPP::Version_3_4_5::Input::mNBytes - Number of bytes read.

unsigned int mNBytes;

FrameCPP::Version_3_4_5::Input::mNextObjectHeader -

ObjectHeader mNextObjectHeader;

FrameCPP::Version_3_4_5::Input::mStream - Input data stream.

std::istream* mStream;

FrameCPP::Version_3_4_5::Input::mTransMap -

TransMap mTransMap;