25 #ifndef LSST_DAF_BASE_CITIZEN_H 26 #define LSST_DAF_BASE_CITIZEN_H 61 Citizen(
const std::type_info &);
67 std::string
repr()
const;
70 static int census(
int, memId startingMemId = 0);
71 static void census(std::ostream &stream, memId startingMemId = 0);
72 static const std::vector<const Citizen *> *
census();
89 typedef std::pair<memId, pthread_t> CitizenInfo;
90 typedef std::map<Citizen const*, CitizenInfo> table;
94 const char *_typeName;
96 static memId _addCitizen(
Citizen const* c);
97 static memId _nextMemIdAndIncrement(
void);
101 static memId _nextMemId(
void);
102 static table _activeCitizens;
103 static table _persistentCitizens;
104 static bool& _shouldPersistCitizens();
109 static memId _deleteId;
115 bool _hasBeenCorrupted()
const;
unsigned long memId
Type of the block's ID.
A PersistentCitizenScope object causes all Citizen objects created during its lifetime to be marked a...
friend class PersistentCitizenScope
static int init()
Called once when the memory system is being initialised.
Citizen & operator=(Citizen const &)
static memCallback setCorruptionCallback(memCallback func)
Set the CorruptionCallback function.
void markPersistent(void)
Mark a Citizen as persistent and not destroyed until process end.
static memId setNewCallbackId(memId id)
Call the NewCallback when block is allocated.
static memNewCallback setNewCallback(memNewCallback func)
Set the NewCallback function.
static bool hasBeenCorrupted()
Check all allocated blocks for corruption.
std::string repr() const
Return a string representation of a Citizen.
static memId setDeleteCallbackId(memId id)
Call the current DeleteCallback when block is deleted.
memId getId() const
Return the Citizen's ID.
memId(* memNewCallback)(const memId cid)
A function used to register a callback.
Citizen(const std::type_info &)
static memCallback setDeleteCallback(memCallback func)
Set the DeleteCallback function.
memId(* memCallback)(const Citizen *ptr)
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
static memId getNextMemId()
Return the memId of the next object to be allocated.
static const std::vector< const Citizen * > * census()
Return a (newly allocated) std::vector of active Citizens sorted by ID.