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

#include <FileOffsetReplacer.hh>

Inheritance diagram for TPEF::FileOffsetReplacer:
Inheritance graph
Collaboration diagram for TPEF::FileOffsetReplacer:
Collaboration graph

Public Member Functions

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

 FileOffsetReplacer (const FileOffsetReplacer &replacer)
 
FileOffsetReplacer operator= (const FileOffsetReplacer &)
 

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 file offset. File offset key must be stored in reference manager for that object whose file offset is written.

Definition at line 48 of file FileOffsetReplacer.hh.

Constructor & Destructor Documentation

◆ FileOffsetReplacer() [1/2]

TPEF::FileOffsetReplacer::FileOffsetReplacer ( const SafePointable obj)

Constructor.

Definition at line 46 of file FileOffsetReplacer.cc.

46  :
47  ValueReplacer(obj) {
48 }

Referenced by clone().

◆ ~FileOffsetReplacer()

TPEF::FileOffsetReplacer::~FileOffsetReplacer ( )
virtual

Destructor.

Definition at line 60 of file FileOffsetReplacer.cc.

60  {
61 }

◆ FileOffsetReplacer() [2/2]

TPEF::FileOffsetReplacer::FileOffsetReplacer ( const FileOffsetReplacer replacer)
private

Copy constructor.

Definition at line 53 of file FileOffsetReplacer.cc.

54  : ValueReplacer(replacer) {
55 }

Member Function Documentation

◆ clone()

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

Creates dynamically allocated copy of replacer.

Returns
Dynamically allocated copy of replacer.

Implements TPEF::ValueReplacer.

Definition at line 90 of file FileOffsetReplacer.cc.

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

References FileOffsetReplacer().

Here is the call graph for this function:

◆ operator=()

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

◆ tryToReplace()

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

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

References TPEF::ReferenceManager::FileOffsetKey::fileOffset(), TPEF::ReferenceManager::SafePointer::fileOffsetKeyFor(), TPEF::ValueReplacer::reference(), 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::ReferenceManager::SafePointer::fileOffsetKeyFor
static FileOffsetKey fileOffsetKeyFor(const SafePointable *obj)
Definition: SafePointer.cc:394
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::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::FileOffsetReplacer::FileOffsetReplacer
FileOffsetReplacer(const SafePointable *obj)
Definition: FileOffsetReplacer.cc:46
TPEF::ValueReplacer::reference
const SafePointable * reference() const
Definition: ValueReplacer.cc:170