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

#include <SectionOffsetReplacer.hh>

Inheritance diagram for TPEF::SectionOffsetReplacer:
Inheritance graph
Collaboration diagram for TPEF::SectionOffsetReplacer:
Collaboration graph

Public Member Functions

 SectionOffsetReplacer (const SafePointable *obj)
 
virtual ~SectionOffsetReplacer ()
 
- Public Member Functions inherited from TPEF::ValueReplacer
void resolve ()
 

Protected Member Functions

virtual bool tryToReplace ()
 
virtual ValueReplacerclone ()
 
- Protected Member Functions inherited from TPEF::ValueReplacer
 ValueReplacer (const SafePointable *obj)
 
 ValueReplacer (const ValueReplacer &replacer)
 
virtual ~ValueReplacer ()
 
const SafePointablereference () const
 
unsigned int streamPosition () const
 

Private Member Functions

 SectionOffsetReplacer (const SectionOffsetReplacer &replacer)
 
SectionOffsetReplacer operator= (const SectionOffsetReplacer &)
 

Additional Inherited Members

- Static Public Member Functions inherited from TPEF::ValueReplacer
static void finalize ()
 
static void initialize (BinaryStream &stream)
 
- Static Protected Member Functions inherited from TPEF::ValueReplacer
static BinaryStreamstream ()
 

Detailed Description

Replaces object reference with section offset. Section offset key must be stored in reference manager for that object whose section offset is written.

Definition at line 47 of file SectionOffsetReplacer.hh.

Constructor & Destructor Documentation

◆ SectionOffsetReplacer() [1/2]

TPEF::SectionOffsetReplacer::SectionOffsetReplacer ( const SafePointable obj)

Constructor.

Definition at line 46 of file SectionOffsetReplacer.cc.

46  :
47  ValueReplacer(obj) {
48 }

Referenced by clone().

◆ ~SectionOffsetReplacer()

TPEF::SectionOffsetReplacer::~SectionOffsetReplacer ( )
virtual

Destructor.

Definition at line 60 of file SectionOffsetReplacer.cc.

60  {
61 }

◆ SectionOffsetReplacer() [2/2]

TPEF::SectionOffsetReplacer::SectionOffsetReplacer ( const SectionOffsetReplacer replacer)
private

Copy constructor.

Definition at line 53 of file SectionOffsetReplacer.cc.

54  : ValueReplacer(replacer) {
55 }

Member Function Documentation

◆ clone()

ValueReplacer * TPEF::SectionOffsetReplacer::clone ( )
protectedvirtual

Creates dynamically allocated copy of replacer.

Returns
Dynamically allocated copy of replacer.

Implements TPEF::ValueReplacer.

Definition at line 90 of file SectionOffsetReplacer.cc.

90  {
91  return new SectionOffsetReplacer(*this);
92 }

References SectionOffsetReplacer().

Here is the call graph for this function:

◆ operator=()

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

◆ tryToReplace()

bool TPEF::SectionOffsetReplacer::tryToReplace ( )
protectedvirtual

Tries to do replacement in to the stream.

Returns
True if replacement were done.

Implements TPEF::ValueReplacer.

Definition at line 69 of file SectionOffsetReplacer.cc.

69  {
70  try {
71  SectionOffsetKey key =
73 
75  stream().writeWord(key.offset());
76  return true;
77 
78  } catch (KeyNotFound& e) {
79  stream().writeWord(0);
80  return false;
81  }
82 }

References TPEF::ReferenceManager::SectionOffsetKey::offset(), TPEF::ValueReplacer::reference(), TPEF::ReferenceManager::SafePointer::sectionOffsetKeyFor(), TPEF::BinaryStream::setWritePosition(), TPEF::ValueReplacer::stream(), TPEF::ValueReplacer::streamPosition(), and TPEF::BinaryStream::writeWord().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
TPEF::BinaryStream::writeWord
void writeWord(Word word)
Definition: BinaryStream.cc:368
TPEF::ValueReplacer::stream
static BinaryStream & stream()
Definition: ValueReplacer.cc:160
TPEF::BinaryStream::setWritePosition
void setWritePosition(unsigned int position)
Definition: BinaryStream.cc:689
TPEF::ReferenceManager::SafePointer::sectionOffsetKeyFor
static SectionOffsetKey sectionOffsetKeyFor(const SafePointable *obj)
Definition: SafePointer.cc:380
TPEF::ValueReplacer::streamPosition
unsigned int streamPosition() const
Definition: ValueReplacer.cc:180
TPEF::SectionOffsetReplacer::SectionOffsetReplacer
SectionOffsetReplacer(const SafePointable *obj)
Definition: SectionOffsetReplacer.cc:46
KeyNotFound
Definition: Exception.hh:285
TPEF::ValueReplacer::ValueReplacer
ValueReplacer(const SafePointable *obj)
Definition: ValueReplacer.cc:53
TPEF::ValueReplacer::reference
const SafePointable * reference() const
Definition: ValueReplacer.cc:170