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

#include <TPEFDebugSectionWriter.hh>

Inheritance diagram for TPEF::TPEFDebugSectionWriter:
Inheritance graph
Collaboration diagram for TPEF::TPEFDebugSectionWriter:
Collaboration graph

Protected Member Functions

 TPEFDebugSectionWriter ()
 
virtual ~TPEFDebugSectionWriter ()
 
virtual Section::SectionType type () const
 
virtual void createKeys (const Section *sect) const
 
virtual void actualWriteData (BinaryStream &stream, const Section *section) const
 
virtual Word elementSize (const Section *section) const
 
- Protected Member Functions inherited from TPEF::TPEFSectionWriter
 TPEFSectionWriter ()
 
virtual ~TPEFSectionWriter ()
 
virtual const BinaryWriterparent () const
 
virtual void actualWriteHeader (BinaryStream &stream, const Section *sect) const
 
virtual void writeSize (BinaryStream &stream, const Section *sect) const
 
virtual void writeInfo (BinaryStream &stream, const Section *sect) const
 
virtual SectionId getSectionId () const
 
- Protected Member Functions inherited from TPEF::SectionWriter
 SectionWriter ()
 
virtual ~SectionWriter ()
 
virtual void finalize (BinaryStream &stream, Section *section) const
 

Private Member Functions

 TPEFDebugSectionWriter (const TPEFDebugSectionWriter &)
 Copying not allowed. More...
 
TPEFDebugSectionWriter operator= (const TPEFDebugSectionWriter &)
 Assignment not allowed. More...
 

Static Private Attributes

static const TPEFDebugSectionWriter instance_
 A unique instance of this class. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from TPEF::SectionWriter
static void writeHeader (BinaryStream &stream, const Section *sect, const BinaryWriter *writer)
 
static void writeData (BinaryStream &stream, const Section *sect, const BinaryWriter *writer)
 
static void finalizeBinary (BinaryStream &stream, const Binary *binaryToFinalize, const BinaryWriter *writer)
 
- Static Protected Member Functions inherited from TPEF::SectionWriter
static void registerSectionWriter (const SectionWriter *sWriter)
 
static SectionId getUniqueSectionId ()
 

Detailed Description

Writes TPEF symbol table to stream.

Definition at line 46 of file TPEFDebugSectionWriter.hh.

Constructor & Destructor Documentation

◆ TPEFDebugSectionWriter() [1/2]

TPEF::TPEFDebugSectionWriter::TPEFDebugSectionWriter ( )
protected

Constructor.

Registers itself to SectionWriter.

Definition at line 62 of file TPEFDebugSectionWriter.cc.

62  : TPEFSectionWriter() {
64 }

References TPEF::SectionWriter::registerSectionWriter().

Here is the call graph for this function:

◆ ~TPEFDebugSectionWriter()

TPEF::TPEFDebugSectionWriter::~TPEFDebugSectionWriter ( )
protectedvirtual

Destructor.

Definition at line 69 of file TPEFDebugSectionWriter.cc.

69  {
70 }

◆ TPEFDebugSectionWriter() [2/2]

TPEF::TPEFDebugSectionWriter::TPEFDebugSectionWriter ( const TPEFDebugSectionWriter )
private

Copying not allowed.

Member Function Documentation

◆ actualWriteData()

void TPEF::TPEFDebugSectionWriter::actualWriteData ( BinaryStream stream,
const Section sect 
) const
protectedvirtual

Writes the data of the section in to stream.

Parameters
streamThe stream to be written to.
sectThe section to be written.

Reimplemented from TPEF::TPEFSectionWriter.

Definition at line 89 of file TPEFDebugSectionWriter.cc.

91  {
92 
93  FileOffset startOffset = stream.writePosition();
94 
95  // file offset to data of section
97  FileOffsetKey(startOffset), sect->element(0));
98 
99  for (Word i = 0; i < sect->elementCount(); i++) {
100 
101  DebugElement* elem = dynamic_cast<DebugElement*>(sect->element(i));
102  assert(elem != NULL);
103 
104  // write type
105  stream.writeHalfWord(static_cast<HalfWord>(elem->type()));
106 
107  // debug string
108  assert(elem->debugString() != NULL);
109  SectionOffsetReplacer sOffReplacer(elem->debugString());
110  sOffReplacer.resolve();
111 
112  // write variable data
113  stream.writeWord(elem->length());
114 
115  for (unsigned int j = 0; j < elem->length(); j++) {
116  stream.writeByte(elem->byte(j));
117  }
118  }
119  SectionSizeReplacer::setSize(sect, stream.writePosition() - startOffset);
120 }

References TPEF::ReferenceManager::SafePointer::addObjectReference(), assert, TPEF::DebugElement::byte(), TPEF::DebugElement::debugString(), TPEF::Section::element(), TPEF::Section::elementCount(), TPEF::DebugElement::length(), TPEF::ValueReplacer::resolve(), TPEF::SectionSizeReplacer::setSize(), TPEF::DebugElement::type(), TPEF::BinaryStream::writeByte(), TPEF::BinaryStream::writeHalfWord(), TPEF::BinaryStream::writePosition(), and TPEF::BinaryStream::writeWord().

Here is the call graph for this function:

◆ createKeys()

void TPEF::TPEFDebugSectionWriter::createKeys ( const Section sect) const
protectedvirtual

Creates needed keys for section if noBits flag is set.

Parameters
sectSection which for keys will be created.

Reimplemented from TPEF::TPEFSectionWriter.

Definition at line 138 of file TPEFDebugSectionWriter.cc.

138  {
139  SectionSizeReplacer::setSize(sect, 0x0);
140 }

References TPEF::SectionSizeReplacer::setSize().

Here is the call graph for this function:

◆ elementSize()

Word TPEF::TPEFDebugSectionWriter::elementSize ( const Section section) const
protectedvirtual

Returns the fixed size length of section elements.

Returns
The fixed size length of section elements.

Reimplemented from TPEF::TPEFSectionWriter.

Definition at line 128 of file TPEFDebugSectionWriter.cc.

128  {
129  return 0;
130 }

◆ operator=()

TPEFDebugSectionWriter TPEF::TPEFDebugSectionWriter::operator= ( const TPEFDebugSectionWriter )
private

Assignment not allowed.

◆ type()

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

Returns the section type this writer can write.

Returns
The section type writer can write.

Implements TPEF::TPEFSectionWriter.

Definition at line 78 of file TPEFDebugSectionWriter.cc.

78  {
79  return Section::ST_DEBUG;
80 }

References TPEF::Section::ST_DEBUG.

Member Data Documentation

◆ instance_

const TPEFDebugSectionWriter TPEF::TPEFDebugSectionWriter::instance_
staticprivate

A unique instance of this class.

Definition at line 68 of file TPEFDebugSectionWriter.hh.


The documentation for this class was generated from the following files:
TPEF::Section::ST_DEBUG
@ ST_DEBUG
Debug section.
Definition: Section.hh:73
TPEF::ReferenceManager::SafePointer::addObjectReference
static void addObjectReference(SectionIndexKey key, const SafePointable *obj)
Definition: SafePointer.cc:306
assert
#define assert(condition)
Definition: Application.hh:86
TPEF::SectionWriter::registerSectionWriter
static void registerSectionWriter(const SectionWriter *sWriter)
Definition: SectionWriter.cc:148
TPEF::FileOffset
Word FileOffset
Type for storing absolute file offsets.
Definition: TPEFBaseType.hh:52
TPEF::SectionSizeReplacer::setSize
static void setSize(const SafePointable *obj, Word size)
Definition: SectionSizeReplacer.cc:100
TPEF::TPEFSectionWriter::TPEFSectionWriter
TPEFSectionWriter()
Definition: TPEFSectionWriter.cc:63