OpenASIP  2.0
Protected Member Functions | Private Member Functions | Static Private Attributes | List of all members
TPEF::TPEFDataSectionReader Class Reference

#include <TPEFDataSectionReader.hh>

Inheritance diagram for TPEF::TPEFDataSectionReader:
Inheritance graph
Collaboration diagram for TPEF::TPEFDataSectionReader:
Collaboration graph

Protected Member Functions

 TPEFDataSectionReader (bool reg=true)
 
virtual ~TPEFDataSectionReader ()
 
virtual void readData (BinaryStream &stream, Section *section) const
 
virtual Section::SectionType type () const
 
- Protected Member Functions inherited from TPEF::TPEFSectionReader
 TPEFSectionReader ()
 
virtual BinaryReaderparent () const
 
virtual void readInfo (BinaryStream &stream, Section *sect) const
 
- Protected Member Functions inherited from TPEF::SectionReader
 SectionReader ()
 
virtual void finalize (Section *section) const
 

Private Member Functions

 TPEFDataSectionReader (const TPEFDataSectionReader &)
 Copying not allowed. More...
 
TPEFDataSectionReaderoperator= (TPEFDataSectionReader &)
 Assignment not allowed. More...
 

Static Private Attributes

static TPEFDataSectionReader proto_
 Prototype instance of TPEFDataSectionReader to be registered to SectionReader. More...
 

Additional Inherited Members

- Public Types inherited from TPEF::SectionReader
typedef BinaryReader::Length Length
 
- Public Member Functions inherited from TPEF::TPEFSectionReader
virtual ~TPEFSectionReader ()
 
- Public Member Functions inherited from TPEF::SectionReader
virtual ~SectionReader ()
 
- Static Public Member Functions inherited from TPEF::SectionReader
static void readSection (BinaryStream &stream, Section *section, BinaryReader *reader)
 
static void finalizeBinary (Binary *binaryToFinalize, BinaryReader *reader)
 
- Static Protected Member Functions inherited from TPEF::TPEFSectionReader
static const Headerheader ()
 
- Static Protected Member Functions inherited from TPEF::SectionReader
static const SectionReaderfindSectionReader (const Section::SectionType type, const BinaryReader *bReader)
 
static void registerSectionReader (const SectionReader *sReader)
 

Detailed Description

Reads string section from TPEF binary file.

Definition at line 46 of file TPEFDataSectionReader.hh.

Constructor & Destructor Documentation

◆ TPEFDataSectionReader() [1/2]

TPEF::TPEFDataSectionReader::TPEFDataSectionReader ( bool  reg = true)
protected

Constructor.

Registers itself to SectionReader.

Definition at line 55 of file TPEFDataSectionReader.cc.

55  : TPEFSectionReader() {
56  if (reg)
58 }

References TPEF::SectionReader::registerSectionReader().

Here is the call graph for this function:

◆ ~TPEFDataSectionReader()

TPEF::TPEFDataSectionReader::~TPEFDataSectionReader ( )
protectedvirtual

Destructor.

Definition at line 63 of file TPEFDataSectionReader.cc.

63  {
64 }

◆ TPEFDataSectionReader() [2/2]

TPEF::TPEFDataSectionReader::TPEFDataSectionReader ( const TPEFDataSectionReader )
private

Copying not allowed.

Member Function Documentation

◆ operator=()

TPEFDataSectionReader& TPEF::TPEFDataSectionReader::operator= ( TPEFDataSectionReader )
private

Assignment not allowed.

◆ readData()

void TPEF::TPEFDataSectionReader::readData ( BinaryStream stream,
Section section 
) const
protectedvirtual

Reads data section of TPEF binary file.

Parameters
streamStream to be read from.
sectionSection where the information is to be stored.
Exceptions
UnreachableStreamIf reading of section fails.
KeyAlreadyExistsKey was in use when trying to register object.
EndOfFileIf end of file were reached while it shouldn't.
OutOfRangeSome of read values were out of range.
WrongSubclassSome class couldn't do what it was asked for.
UnexpectedValueIf there was unexpected value when reading.

Reimplemented from TPEF::TPEFSectionReader.

Definition at line 89 of file TPEFDataSectionReader.cc.

89  {
90  // base classes implementation must be called with these.
91  TPEFSectionReader::readData(stream, section);
92 
93  DataSection* dataSection = dynamic_cast<DataSection*>(section);
94  assert(dataSection != NULL);
95 
96  // check that link section is defined properly
97  assert(header().linkId == 0);
98 
99  if (!section->noBits()) {
100  while (stream.readPosition() <
101  header().bodyOffset + header().bodyLength) {
102  dataSection->addByte(stream.readByte());
103  }
104 
105  dynamic_cast<TPEFReader*>(
106  parent())->addSectionSize(section, header().bodyLength);
107  }
108 }

References TPEF::DataSection::addByte(), assert, TPEF::TPEFSectionReader::Header::bodyLength, TPEF::TPEFSectionReader::header(), TPEF::Section::noBits(), TPEF::TPEFSectionReader::parent(), TPEF::BinaryStream::readByte(), TPEF::TPEFSectionReader::readData(), and TPEF::BinaryStream::readPosition().

Here is the call graph for this function:

◆ type()

Section::SectionType TPEF::TPEFDataSectionReader::type ( ) const
protectedvirtual

Returns the type of section it is meant to read.

Returns
The type of section it can read.

Implements TPEF::SectionReader.

Reimplemented in TPEF::TPEFLEDataSectionReader.

Definition at line 72 of file TPEFDataSectionReader.cc.

72  {
73  return Section::ST_DATA;
74 }

References TPEF::Section::ST_DATA.

Member Data Documentation

◆ proto_

TPEFDataSectionReader TPEF::TPEFDataSectionReader::proto_
staticprivate

Prototype instance of TPEFDataSectionReader to be registered to SectionReader.

Definition at line 63 of file TPEFDataSectionReader.hh.


The documentation for this class was generated from the following files:
TPEF::TPEFSectionReader::TPEFSectionReader
TPEFSectionReader()
Definition: TPEFSectionReader.cc:50
assert
#define assert(condition)
Definition: Application.hh:86
TPEF::Section::ST_DATA
@ ST_DATA
Initialized data section.
Definition: Section.hh:80
TPEF::SectionReader::registerSectionReader
static void registerSectionReader(const SectionReader *sReader)
Definition: SectionReader.cc:145
TPEF::TPEFSectionReader::parent
virtual BinaryReader * parent() const
Definition: TPEFSectionReader.cc:65
TPEF::TPEFSectionReader::readData
virtual void readData(BinaryStream &stream, Section *section) const
Definition: TPEFSectionReader.cc:86
TPEF::TPEFSectionReader::header
static const Header & header()
Definition: TPEFSectionReader.cc:174
TPEF::TPEFSectionReader::Header::bodyLength
Word bodyLength
Definition: TPEFSectionReader.hh:70