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

#include <SectionIdReplacer.hh>

Inheritance diagram for TPEF::SectionIdReplacer:
Inheritance graph
Collaboration diagram for TPEF::SectionIdReplacer:
Collaboration graph

Public Member Functions

 SectionIdReplacer (const SafePointable *obj)
 
virtual ~SectionIdReplacer ()
 
- 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

 SectionIdReplacer (const SectionIdReplacer &replacer)
 
SectionIdReplacer operator= (const SectionIdReplacer &)
 

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 references with the section identification code that identifies the object. The reference manager must contain a SectionId key for the objects whose section identification code is written out.

Definition at line 47 of file SectionIdReplacer.hh.

Constructor & Destructor Documentation

◆ SectionIdReplacer() [1/2]

TPEF::SectionIdReplacer::SectionIdReplacer ( const SafePointable obj)

Constructor.

Definition at line 46 of file SectionIdReplacer.cc.

46  :
47  ValueReplacer(obj) {
48 }

Referenced by clone().

◆ ~SectionIdReplacer()

TPEF::SectionIdReplacer::~SectionIdReplacer ( )
virtual

Destructor.

Definition at line 60 of file SectionIdReplacer.cc.

60  {
61 }

◆ SectionIdReplacer() [2/2]

TPEF::SectionIdReplacer::SectionIdReplacer ( const SectionIdReplacer replacer)
private

Copy constructor.

Definition at line 53 of file SectionIdReplacer.cc.

53  :
54  ValueReplacer(replacer) {
55 }

Member Function Documentation

◆ clone()

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

Creates dynamically allocated copy of replacer.

Returns
Dynamically allocated copy of replacer.

Implements TPEF::ValueReplacer.

Definition at line 90 of file SectionIdReplacer.cc.

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

References SectionIdReplacer().

Here is the call graph for this function:

◆ operator=()

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

◆ tryToReplace()

bool TPEF::SectionIdReplacer::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 SectionIdReplacer.cc.

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

References TPEF::ValueReplacer::reference(), TPEF::ReferenceManager::SectionKey::sectionId(), TPEF::ReferenceManager::SafePointer::sectionKeyFor(), TPEF::BinaryStream::setWritePosition(), TPEF::ValueReplacer::stream(), TPEF::ValueReplacer::streamPosition(), and TPEF::BinaryStream::writeHalfWord().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
TPEF::BinaryStream::writeHalfWord
void writeHalfWord(HalfWord halfword)
Definition: BinaryStream.cc:336
TPEF::SectionIdReplacer::SectionIdReplacer
SectionIdReplacer(const SafePointable *obj)
Definition: SectionIdReplacer.cc:46
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::sectionKeyFor
static SectionKey sectionKeyFor(const SafePointable *obj)
Definition: SafePointer.cc:408
TPEF::ValueReplacer::streamPosition
unsigned int streamPosition() const
Definition: ValueReplacer.cc:180
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