OpenASIP 2.2
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
TPEF::ReferenceManager::SafePointerList Class Reference

#include <SafePointer.hh>

Collaboration diagram for TPEF::ReferenceManager::SafePointerList:
Collaboration graph

Public Types

typedef std::list< SafePointer * > SafePointerListType
 Type of the container to hold the SafePointers in.
 
typedef std::string::size_type LengthType
 Type of the list length value.
 

Public Member Functions

 SafePointerList ()
 
 SafePointerList (SafePointerList &aList)
 
virtual ~SafePointerList ()
 
void setReference (const SafePointable *obj)
 
SafePointablereference () const
 
void append (SafePointer *newSafePointer)
 
void append (SafePointerList *anotherSafePointerList)
 
SafePointerfront () const
 
void cleanup ()
 
void cleanupDead ()
 
LengthType length () const
 

Private Attributes

SafePointablereference_
 Object that SafePointers in this list are pointing to.
 
SafePointerListType list_
 Container for SafePointers.
 

Detailed Description

List of SafePointers that are all pointing to the same object.

Definition at line 71 of file SafePointer.hh.

Member Typedef Documentation

◆ LengthType

Type of the list length value.

Definition at line 77 of file SafePointer.hh.

◆ SafePointerListType

Type of the container to hold the SafePointers in.

Definition at line 74 of file SafePointer.hh.

Constructor & Destructor Documentation

◆ SafePointerList() [1/2]

TPEF::ReferenceManager::SafePointerList::SafePointerList ( )

Constructor.

Definition at line 82 of file SafePointer.cc.

82 : reference_(NULL) {
83}
SafePointable * reference_
Object that SafePointers in this list are pointing to.

◆ SafePointerList() [2/2]

TPEF::ReferenceManager::SafePointerList::SafePointerList ( SafePointerList aList)

Copy constructor.

Definition at line 89 of file SafePointer.cc.

89 :
90 reference_(aList.reference_) {
91
92 for (SafePointerListType::iterator i = aList.list_.begin();
93 i != aList.list_.end(); i++) {
94
95 list_.push_back(*i);
96 }
97}
SafePointerListType list_
Container for SafePointers.

References list_.

◆ ~SafePointerList()

TPEF::ReferenceManager::SafePointerList::~SafePointerList ( )
virtual

Destructor.

Definition at line 103 of file SafePointer.cc.

103 {
104}

Member Function Documentation

◆ append() [1/2]

void TPEF::ReferenceManager::SafePointerList::append ( SafePointer newSafePointer)

Appends a new SafePointer at the end of the list and sets it's reference to the reference of the list.

Parameters
newSafePointerThe SafePointer to add.

Definition at line 132 of file SafePointer.cc.

132 {
133
134 newSafePointer->setPointer(reference());
135 list_.push_back(newSafePointer);
136}

References list_, reference(), and TPEF::ReferenceManager::SafePointer::setPointer().

Here is the call graph for this function:

◆ append() [2/2]

void TPEF::ReferenceManager::SafePointerList::append ( SafePointerList anotherSafePointerList)

Appends another SafePointerList at the end of the list and sets it's reference to the reference of the list.

Parameters
anotherSafePointerListThe SafePointerList to add.

Definition at line 145 of file SafePointer.cc.

145 {
146
147 if (anotherSafePointerList == NULL) {
148 return;
149 }
150 anotherSafePointerList->setReference(reference());
151
152 insert_iterator<SafePointerListType> ii(list_,
153 list_.end());
154
155 copy(anotherSafePointerList->list_.begin(),
156 anotherSafePointerList->list_.end(), ii);
157
158}

References list_, reference(), and setReference().

Here is the call graph for this function:

◆ cleanup()

void TPEF::ReferenceManager::SafePointerList::cleanup ( )

Sets all SafePointers in the list NULL and clears the list.

Definition at line 164 of file SafePointer.cc.

164 {
165 setReference(NULL);
166 list_.clear();
167}
void setReference(const SafePointable *obj)

References list_, and setReference().

Referenced by TPEF::ReferenceManager::SafePointer::notifyDeleted().

Here is the call graph for this function:

◆ cleanupDead()

void TPEF::ReferenceManager::SafePointerList::cleanupDead ( )

Removes all dead (deleted) SafePointers from the list.

Definition at line 173 of file SafePointer.cc.

173 {
174
175
176 for (SafePointerListType::iterator i = list_.begin();
177 i != list_.end();) {
178 if (!SafePointer::isAlive((*i))) {
179 i = list_.erase(i);
180 } else {
181 ++i;
182 }
183 }
184}
static bool isAlive(SafePointer *pointerToCheck)

References TPEF::ReferenceManager::SafePointer::isAlive(), and list_.

Referenced by TPEF::ReferenceManager::SafePointer::isReferenced().

Here is the call graph for this function:

◆ front()

SafePointer * TPEF::ReferenceManager::SafePointerList::front ( ) const

◆ length()

LengthType TPEF::ReferenceManager::SafePointerList::length ( ) const

◆ reference()

SafePointable * TPEF::ReferenceManager::SafePointerList::reference ( ) const

◆ setReference()

void TPEF::ReferenceManager::SafePointerList::setReference ( const SafePointable obj)

Sets the object all SafePointers in the list are pointing to.

Parameters
objThe pointer to the object all SafePointers in the list should be pointing to.

Definition at line 113 of file SafePointer.cc.

113 {
114
115 reference_ = const_cast<SafePointable*>(obj);
116
117 for (SafePointerListType::iterator i = list_.begin();
118 i != list_.end(); i++) {
119 if (SafePointer::isAlive((*i))) {
120 (*i)->setPointer(reference_);
121 }
122 }
123}

References TPEF::ReferenceManager::SafePointer::isAlive(), list_, and reference_.

Referenced by append(), and cleanup().

Here is the call graph for this function:

Member Data Documentation

◆ list_

SafePointerListType TPEF::ReferenceManager::SafePointerList::list_
private

Container for SafePointers.

Definition at line 102 of file SafePointer.hh.

Referenced by append(), append(), cleanup(), cleanupDead(), SafePointerList(), and setReference().

◆ reference_

SafePointable* TPEF::ReferenceManager::SafePointerList::reference_
private

Object that SafePointers in this list are pointing to.

Definition at line 99 of file SafePointer.hh.

Referenced by setReference().


The documentation for this class was generated from the following files: