|
LSSTApplications
1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
|
Citizen is a class that should be among all LSST classes base classes, and handles basic memory management. More...
#include <Citizen.h>
Public Types | |
| enum | { magicSentinel = 0xdeadbeef } |
| typedef unsigned long | memId |
| Type of the block's ID. More... | |
| typedef memId(* | memNewCallback )(const memId cid) |
| A function used to register a callback. More... | |
| typedef memId(* | memCallback )(const Citizen *ptr) |
Public Member Functions | |
| Citizen (const std::type_info &) | |
| Citizen (Citizen const &) | |
| ~Citizen () | |
| Citizen & | operator= (Citizen const &) |
| std::string | repr () const |
| Return a string representation of a Citizen. More... | |
| void | markPersistent (void) |
| Mark a Citizen as persistent and not destroyed until process end. More... | |
| memId | getId () const |
| Return the Citizen's ID. More... | |
Static Public Member Functions | |
| static bool | hasBeenCorrupted () |
| Check all allocated blocks for corruption. More... | |
| static memId | getNextMemId () |
| Return the memId of the next object to be allocated. More... | |
| static int | init () |
| Called once when the memory system is being initialised. More... | |
Census | |
Provide a list of current Citizens | |
| static int | census (int, memId startingMemId=0) |
| How many active Citizens are there? More... | |
| static void | census (std::ostream &stream, memId startingMemId=0) |
| Print a list of all active Citizens to stream, sorted by ID. More... | |
| static const std::vector < const Citizen * > * | census () |
| Return a (newly allocated) std::vector of active Citizens sorted by ID. More... | |
callbackIDs | |
Set callback Ids. The old Id is returned | |
| static memId | setNewCallbackId (memId id) |
| Call the NewCallback when block is allocated. More... | |
| static memId | setDeleteCallbackId (memId id) |
| Call the current DeleteCallback when block is deleted. More... | |
Private Types | |
| typedef std::pair< memId, pthread_t > | CitizenInfo |
| typedef std::map< Citizen const *, CitizenInfo > | table |
Private Member Functions | |
| bool | _hasBeenCorrupted () const |
Static Private Member Functions | |
| static memId | _addCitizen (Citizen const *c) |
| static memId | _nextMemIdAndIncrement (void) |
| Return the memId and prepare for the next object to be allocated. More... | |
| static memId | _nextMemId (void) |
| Return the memId of the next object to be allocated. More... | |
Private Attributes | |
| int | _sentinel |
| memId | _CitizenId |
| const char * | _typeName |
Static Private Attributes | |
| static table | _activeCitizens |
| static table | _persistentCitizens |
| static memId | _newId = 0 |
| static memId | _deleteId = 0 |
| static memNewCallback | _newCallback = defaultNewCallback |
| static memCallback | _deleteCallback = defaultDeleteCallback |
| static memCallback | _corruptionCallback = defaultCorruptionCallback |
Friends | |
| class | PersistentCitizenScope |
callbacks | |
Set the New/Delete callback functions; in each case the previously installed callback is returned. These callback functions return a value which is Added to the previously registered id. The default callback functions are called default{New,Delete}Callback; you may want to set a break point in these callbacks from your favourite debugger | |
| static memNewCallback | setNewCallback (memNewCallback func) |
| Set the NewCallback function. More... | |
| static memCallback | setDeleteCallback (memCallback func) |
| Set the DeleteCallback function. More... | |
| static memCallback | setCorruptionCallback (memCallback func) |
| Set the CorruptionCallback function. More... | |
| static bool & | _shouldPersistCitizens () |
| Set the NewCallback function. More... | |
Citizen is a class that should be among all LSST classes base classes, and handles basic memory management.
Instances of subclasses of Citizen will automatically be given a unique id.
You can ask for infomation about the currently allocated Citizens using the census functions, request that a function of your choice be called when a specific block ID is allocated or deleted, and check whether any of the data blocks are known to be corrupted
|
private |
| typedef unsigned long lsst.daf.base::Citizen::memId |
|
private |
| lsst.daf.base::Citizen::Citizen | ( | const std::type_info & | type | ) |
Definition at line 173 of file Citizen.cc.
| lsst.daf.base::Citizen::Citizen | ( | Citizen const & | citizen | ) |
Definition at line 179 of file Citizen.cc.
| lsst.daf.base::Citizen::~Citizen | ( | ) |
Definition at line 185 of file Citizen.cc.
|
staticprivate |
Definition at line 159 of file Citizen.cc.
|
private |
Check for corruption Return true if the block is corrupted, but only after calling the corruptionCallback
Definition at line 342 of file Citizen.cc.
|
staticprivate |
Return the memId of the next object to be allocated.
Definition at line 233 of file Citizen.cc.
|
staticprivate |
Return the memId and prepare for the next object to be allocated.
Definition at line 238 of file Citizen.cc.
|
staticprivate |
Set the NewCallback function.
Definition at line 473 of file Citizen.cc.
|
static |
How many active Citizens are there?
| startingMemId | Don't print Citizens with lower IDs |
Definition at line 266 of file Citizen.cc.
|
static |
Print a list of all active Citizens to stream, sorted by ID.
| stream | stream to print to |
| startingMemId | Don't print Citizens with lower IDs |
Definition at line 289 of file Citizen.cc.
|
static |
Return a (newly allocated) std::vector of active Citizens sorted by ID.
You are responsible for deleting it; or you can say boost::scoped_ptr<std::vector<Citizen const*> const> leaks(Citizen::census()); and not bother (that becomes std::unique_ptr in C++11)
Definition at line 321 of file Citizen.cc.
| dafBase::Citizen::memId lsst.daf.base::Citizen::getId | ( | ) | const |
|
static |
Return the memId of the next object to be allocated.
Definition at line 228 of file Citizen.cc.
|
static |
Check all allocated blocks for corruption.
Definition at line 352 of file Citizen.cc.
|
static |
Called once when the memory system is being initialised.
Definition at line 213 of file Citizen.cc.
| void lsst.daf.base::Citizen::markPersistent | ( | void | ) |
Mark a Citizen as persistent and not destroyed until process end.
Definition at line 253 of file Citizen.cc.
| std::string lsst.daf.base::Citizen::repr | ( | ) | const |
Return a string representation of a Citizen.
Definition at line 244 of file Citizen.cc.
|
static |
Set the CorruptionCallback function.
| func | function be called when block is found to be corrupted |
Definition at line 431 of file Citizen.cc.
|
static |
Set the DeleteCallback function.
| func | function be called when desired block is deleted |
Definition at line 421 of file Citizen.cc.
|
static |
Call the current DeleteCallback when block is deleted.
| id | Desired ID |
Definition at line 386 of file Citizen.cc.
|
static |
Set the NewCallback function.
| func | The new function to be called when a designated block is allocated |
Definition at line 411 of file Citizen.cc.
|
static |
Call the NewCallback when block is allocated.
| id | Desired ID |
Definition at line 375 of file Citizen.cc.
|
friend |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
1.8.5