LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Classes | Variables
Citizen.cc File Reference

Implementation of Citizen. More...

#include <iostream>
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/format.hpp>
#include <ctype.h>
#include <cerrno>
#include "lsst/daf/base/Citizen.h"
#include "lsst/pex/exceptions.h"
#include "lsst/utils/Demangle.h"

Go to the source code of this file.

Classes

class  CitizenInit
 Called once when the memory system is being initialised. More...
 

Functions

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

dafBase::Citizen::memId defaultNewCallback (dafBase::Citizen::memId const cid)
 Default NewCallback. More...
 
dafBase::Citizen::memId defaultDeleteCallback (dafBase::Citizen const *ptr)
 Default DeleteCallback. More...
 
dafBase::Citizen::memId defaultCorruptionCallback (dafBase::Citizen const *ptr)
 Default CorruptionCallback. More...
 

Variables

CitizenInit one
 

Detailed Description

Implementation of Citizen.

Definition in file Citizen.cc.

Function Documentation

dafBase::Citizen::memId defaultCorruptionCallback ( dafBase::Citizen const *  ptr)

Default CorruptionCallback.

Parameters
ptrAbout-to-be deleted Citizen

Definition at line 465 of file Citizen.cc.

466  {
467  throw LSST_EXCEPT(lsst::pex::exceptions::MemoryError,
468  str(boost::format("Citizen \"%s\" is corrupted") % ptr->repr()));
469 
470  return ptr->getId(); // NOTREACHED
471 }
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
dafBase::Citizen::memId defaultDeleteCallback ( dafBase::Citizen const *  ptr)

Default DeleteCallback.

Parameters
ptrAbout-to-be deleted Citizen

Definition at line 456 of file Citizen.cc.

457  {
458  static int dId = 0; // how much to incr memId
459  std::cerr << boost::format("Deleting memId %s\n") % ptr->repr();
460 
461  return dId;
462 }
dafBase::Citizen::memId defaultNewCallback ( dafBase::Citizen::memId const  cid)

Default NewCallback.

Default callbacks.

Note that these may well be the target of debugger breakpoints, so e.g. dId may well be changed behind our back

Parameters
cidID for just-allocated Citizen

Definition at line 446 of file Citizen.cc.

448  {
449  static int dId = 0; // how much to incr memId
450  std::cerr << boost::format("Allocating memId %d\n") % cid;
451 
452  return dId;
453 }

Variable Documentation

Definition at line 155 of file Citizen.cc.