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

#include <AOutStringSectionReader.hh>

Inheritance diagram for TPEF::AOutStringSectionReader:
Inheritance graph
Collaboration diagram for TPEF::AOutStringSectionReader:
Collaboration graph

Public Member Functions

virtual ~AOutStringSectionReader ()
 
- Public Member Functions inherited from TPEF::AOutSectionReader
virtual ~AOutSectionReader ()
 
- Public Member Functions inherited from TPEF::SectionReader
virtual ~SectionReader ()
 

Protected Member Functions

 AOutStringSectionReader ()
 
virtual void readData (BinaryStream &stream, Section *section) const
 
virtual Section::SectionType type () const
 
- Protected Member Functions inherited from TPEF::AOutSectionReader
 AOutSectionReader ()
 
virtual BinaryReaderparent () const
 
- Protected Member Functions inherited from TPEF::SectionReader
 SectionReader ()
 
virtual void finalize (Section *section) const
 

Private Member Functions

 AOutStringSectionReader (const AOutStringSectionReader &)
 Copying not allowed. More...
 
AOutStringSectionReaderoperator= (const AOutStringSectionReader &)
 Assignment not allowed. More...
 

Static Private Attributes

static AOutStringSectionReader proto_
 Static attribute enables registering to SectionReader before main function is executed. More...
 

Additional Inherited Members

- Public Types inherited from TPEF::SectionReader
typedef BinaryReader::Length Length
 
- 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::SectionReader
static const SectionReaderfindSectionReader (const Section::SectionType type, const BinaryReader *bReader)
 
static void registerSectionReader (const SectionReader *sReader)
 

Detailed Description

Reads string section from a.out binary file.

Definition at line 47 of file AOutStringSectionReader.hh.

Constructor & Destructor Documentation

◆ ~AOutStringSectionReader()

TPEF::AOutStringSectionReader::~AOutStringSectionReader ( )
virtual

Destructor.

Definition at line 63 of file AOutStringSectionReader.cc.

63  {
64 }

◆ AOutStringSectionReader() [1/2]

TPEF::AOutStringSectionReader::AOutStringSectionReader ( )
protected

Constructor.

Registers to SectionReader.

Definition at line 56 of file AOutStringSectionReader.cc.

References TPEF::SectionReader::registerSectionReader().

Here is the call graph for this function:

◆ AOutStringSectionReader() [2/2]

TPEF::AOutStringSectionReader::AOutStringSectionReader ( const AOutStringSectionReader )
private

Copying not allowed.

Member Function Documentation

◆ operator=()

AOutStringSectionReader& TPEF::AOutStringSectionReader::operator= ( const AOutStringSectionReader )
private

Assignment not allowed.

◆ readData()

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

Reads string section from a.out binary file.

Reads section from stream and makes sure that section starts withs zero.

Parameters
streamStream to be read from.
sectionSection where to the information is 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.

Implements TPEF::SectionReader.

Definition at line 92 of file AOutStringSectionReader.cc.

93  {
94  AOutReader* aOutReader = dynamic_cast<AOutReader*>(parent());
95 
96  StringSection* strSect = dynamic_cast<StringSection*>(section);
97  assert(strSect != NULL);
98 
99  for (unsigned int i = 0;
100  i < aOutReader->header().sectionSizeString(); i++) {
101  strSect->addByte(stream.readByte());
102  }
103 
104  // add zero byte if no data
105  if (strSect->length() == 0) {
106  strSect->addByte(0);
107  }
108 
109  // section must start with zero.
110  assert(strSect->byte(strSect->chunk(0)) == 0);
111 }

References TPEF::DataSection::addByte(), assert, TPEF::DataSection::byte(), TPEF::RawSection::chunk(), TPEF::AOutReader::header(), TPEF::DataSection::length(), TPEF::AOutSectionReader::parent(), and TPEF::BinaryStream::readByte().

Here is the call graph for this function:

◆ type()

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

Returns the type of section that this class can read.

Returns
Type of section to read.

Implements TPEF::SectionReader.

Definition at line 72 of file AOutStringSectionReader.cc.

72  {
73  return Section::ST_STRTAB;
74 }

References TPEF::Section::ST_STRTAB.

Member Data Documentation

◆ proto_

AOutStringSectionReader TPEF::AOutStringSectionReader::proto_
staticprivate

Static attribute enables registering to SectionReader before main function is executed.

Definition at line 66 of file AOutStringSectionReader.hh.


The documentation for this class was generated from the following files:
assert
#define assert(condition)
Definition: Application.hh:86
TPEF::AOutSectionReader::parent
virtual BinaryReader * parent() const
Definition: AOutSectionReader.cc:57
TPEF::SectionReader::registerSectionReader
static void registerSectionReader(const SectionReader *sReader)
Definition: SectionReader.cc:145
TPEF::AOutSectionReader::AOutSectionReader
AOutSectionReader()
Definition: AOutSectionReader.cc:41
TPEF::Section::ST_STRTAB
@ ST_STRTAB
String table.
Definition: Section.hh:71