Go to the documentation of this file.
36 #ifndef TTA_SAFEPOINTER_HH
37 #define TTA_SAFEPOINTER_HH
60 namespace ReferenceManager {
136 return reinterpret_cast<size_t>(key);
218 template <
typename MapType>
232 #ifndef DOXYGEN_SHOULD_SKIP_THIS
243 #define CREATE_SAFEPOINTER(x) \
244 ReferenceManager::SafePointer::debugCreate( x , __FILE__, __LINE__)
261 void setDebugString(std::string aStr);
262 std::string debugString()
const;
264 template <
typename ObjType>
265 static SafePointer* debugCreate(ObjType obj,
const char *file,
int line);
267 #endif // DOXYGEN_SHOULD_SKIP_THIS
276 #define CREATE_SAFEPOINTER(x) \
277 ReferenceManager::SafePointer::genericCreate(x)
280 template <
typename ObjType>
291 template <
typename KeyType,
typename MapType>
294 MapType& destinationMap,
297 template <
typename KeyType,
typename MapType>
299 const KeyType& key, MapType& destinationMap,
const SafePointable* obj);
301 template <
typename KeyType,
typename MapType>
304 template <
typename MapType>
307 std::set<SafePointerList*>&
static const SafePointer * replaceReference(const SafePointer *old, SafePointable *obj)
HalfWord SectionId
Type for storing binary file section ids.
FileOffset fileOffset() const
SectionOffset offset() const
static bool isReferenced(const SafePointable *object)
void setReference(const SafePointable *obj)
size_t operator()(const FileOffsetKey &key) const
SafePointable * reference_
Object that SafePointers in this list are pointing to.
SectionIndex index() const
void genericRegisterPointer(const KeyType &key, MapType &destinationMap, SafePointer *newSafePointer)
static FileOffsetKey fileOffsetKeyFor(const SafePointable *obj)
std::set< SafePointer * > SafePointerSet
Unordered set of SafePointers.
LengthType length() const
static SectionOffsetMap * sectionOffsetMap_
Map of SafePointers that are requested using SectionOffsetKeys.
std::map< const SafePointable *, SafePointerList * > ReferenceMap
Map for resolved references, that is SafePointers that are pointing to the created object.
SectionId sectionId() const
std::pair< const SafePointable *, void * > KeyForCacheKey
Key type for cache, void* is pointer to key map (sectioMap_, sectionOffsetMap, ......
static void genericAddObjectReference(const KeyType &key, MapType &destinationMap, const SafePointable *obj)
static void addObjectReference(SectionIndexKey key, const SafePointable *obj)
static KeyForCacheMap * keyForCache_
Map for cache.
static void notifyDeleted(const SafePointable *obj)
std::map< SectionIndexKey, SafePointerList * > SectionIndexMap
Map for SafePointers that are requested using SectionIndexKeys.
static SectionMap * sectionMap_
Map of SafePointers that are requested using SectionKeys.
static FileOffsetMap * fileOffsetMap_
Map of SafePointers that are requested using FileOffsetKeys.
static SafePointer * genericCreate(ObjType obj)
static void cleanupKeyTables()
SectionId sectionId() const
std::map< FileOffsetKey, SafePointerList * > FileOffsetMap
Map for SafePointers that are requested using FileOffsetKeys.
SectionId sectionId() const
static ReferenceMap * referenceMap_
Map of SafePointers that have resolved references.
SafePointable * reference() const
size_t operator()(const SectionIndexKey &key) const
std::map< SectionOffsetKey, SafePointerList * > SectionOffsetMap
Map for SafePointers that are requested using SectionOffsetKeys.
static SectionKey sectionKeyFor(const SafePointable *obj)
std::list< SafePointer * > SafePointerListType
Type of the container to hold the SafePointers in.
SafePointable * pointer() const
static SectionOffsetKey sectionOffsetKeyFor(const SafePointable *obj)
void append(SafePointer *newSafePointer)
static SafePointerSet * aliveSafePointers_
Set that cointains all alive (not deleted) SafePointers for extra safety.
SafePointer & operator=(SafePointer &)
Assignment not allowed.
void setPointer(SafePointable *object)
static SectionIndexMap * sectionIndexMap_
Map of SafePointers that are requested using SectionIndexKeys.
std::map< KeyForCacheKey, const ReferenceKey * > KeyForCacheMap
static KeyType genericKeyFor(const SafePointable *obj, MapType &sourceMap)
size_t operator()(const SectionOffsetKey &key) const
SafePointer(SectionIndexKey key)
static void safelyCleanupKeyTable(MapType &sourceMap, std::set< SafePointerList * > &listsToDelete)
static bool isAlive(SafePointer *pointerToCheck)
std::string::size_type LengthType
Type of the list length value.
SafePointer * front() const
size_t operator()(const SafePointable *const &key) const
SafePointerListType list_
Container for SafePointers.
static bool unresolvedReferences(const MapType &mapToCheck, const ReferenceKey **unresolvedKey)
size_t operator()(const SectionKey &key) const
static SectionIndexKey sectionIndexKeyFor(const SafePointable *obj)
static void replaceAllReferences(SafePointable *newObj, SafePointable *oldObj)
std::map< SectionKey, SafePointerList * > SectionMap
Map for SafePointers that are requested using SectionKeys.
virtual ~SafePointerList()
SafePointable * object_
The reference to the real object.