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

#include <SectionSizeReplacer.hh>

Inheritance diagram for TPEF::SectionSizeReplacer:
Inheritance graph
Collaboration diagram for TPEF::SectionSizeReplacer:
Collaboration graph

Public Member Functions

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

Static Public Member Functions

static void setSize (const SafePointable *obj, Word size)
 
static void clear ()
 
- Static Public Member Functions inherited from TPEF::ValueReplacer
static void finalize ()
 
static void initialize (BinaryStream &stream)
 

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

 SectionSizeReplacer (const SectionSizeReplacer &replacer)
 
SectionSizeReplacer operator= (const SectionSizeReplacer &)
 

Static Private Attributes

static std::map< const SafePointable *, Word > sizeMap
 Contains sections sizes. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from TPEF::ValueReplacer
static BinaryStreamstream ()
 

Detailed Description

Replaces object reference with size of object. Size for object must be stored with static setSize method of this class.

Definition at line 50 of file SectionSizeReplacer.hh.

Constructor & Destructor Documentation

◆ SectionSizeReplacer() [1/2]

TPEF::SectionSizeReplacer::SectionSizeReplacer ( const SafePointable obj)

Constructor.

Definition at line 48 of file SectionSizeReplacer.cc.

48  :
49  ValueReplacer(obj) {
50 }

Referenced by clone().

◆ ~SectionSizeReplacer()

TPEF::SectionSizeReplacer::~SectionSizeReplacer ( )
virtual

Destructor.

Definition at line 63 of file SectionSizeReplacer.cc.

63  {
64 }

◆ SectionSizeReplacer() [2/2]

TPEF::SectionSizeReplacer::SectionSizeReplacer ( const SectionSizeReplacer replacer)
private

Copy constructor.

Definition at line 55 of file SectionSizeReplacer.cc.

56  :
57  ValueReplacer(replacer) {
58 }

Member Function Documentation

◆ clear()

void TPEF::SectionSizeReplacer::clear ( )
static

Clears all elements from size map.

Definition at line 109 of file SectionSizeReplacer.cc.

109  {
110  sizeMap.clear();
111 }

References sizeMap.

Referenced by TPEF::BinaryWriter::writeBinary().

◆ clone()

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

Creates dynamically allocated copy of replacer.

Returns
Dynamically allocated copy of replacer.

Implements TPEF::ValueReplacer.

Definition at line 89 of file SectionSizeReplacer.cc.

89  {
90  return new SectionSizeReplacer(*this);
91 }

References SectionSizeReplacer().

Here is the call graph for this function:

◆ operator=()

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

◆ setSize()

void TPEF::SectionSizeReplacer::setSize ( const SafePointable obj,
Word  size 
)
static

◆ tryToReplace()

bool TPEF::SectionSizeReplacer::tryToReplace ( )
protectedvirtual

Tries to do replacement in to the stream.

Returns
True if replacement were done.

Implements TPEF::ValueReplacer.

Definition at line 72 of file SectionSizeReplacer.cc.

72  {
76  return true;
77  }
78 
79  stream().writeWord(0);
80  return false;
81 }

References MapTools::containsKey(), TPEF::ValueReplacer::reference(), TPEF::BinaryStream::setWritePosition(), sizeMap, TPEF::ValueReplacer::stream(), TPEF::ValueReplacer::streamPosition(), and TPEF::BinaryStream::writeWord().

Here is the call graph for this function:

Member Data Documentation

◆ sizeMap

std::map< const SafePointable *, Word > TPEF::SectionSizeReplacer::sizeMap
staticprivate

Contains sections sizes.

Definition at line 68 of file SectionSizeReplacer.hh.

Referenced by clear(), setSize(), and tryToReplace().


The documentation for this class was generated from the following files:
TPEF::SectionSizeReplacer::SectionSizeReplacer
SectionSizeReplacer(const SafePointable *obj)
Definition: SectionSizeReplacer.cc:48
TPEF::BinaryStream::writeWord
void writeWord(Word word)
Definition: BinaryStream.cc:368
assert
#define assert(condition)
Definition: Application.hh:86
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
MapTools::containsKey
static bool containsKey(const MapType &aMap, const KeyType &aKey)
TPEF::SectionSizeReplacer::sizeMap
static std::map< const SafePointable *, Word > sizeMap
Contains sections sizes.
Definition: SectionSizeReplacer.hh:68
TPEF::ValueReplacer::ValueReplacer
ValueReplacer(const SafePointable *obj)
Definition: ValueReplacer.cc:53
TPEF::ValueReplacer::reference
const SafePointable * reference() const
Definition: ValueReplacer.cc:170