LSSTApplications  11.0-22-g33de520,13.0+153,14.0+52,14.0+57,14.0-1-g013352c+36,14.0-1-g13ef843+9,14.0-1-g4b114ac+14,14.0-1-g7257b6a+12,14.0-1-g8b7e855+51,14.0-13-g7a60b79+2,14.0-14-g87d16e8+10,14.0-14-gbf7a6f8a,14.0-17-g4f4ea82+5,14.0-2-g319577b+11,14.0-2-ga5af9b6+10,14.0-22-gc48c03f+3,14.0-3-g20413be+3,14.0-46-g76222d5f+3,14.0-47-g0a51fac97,14.0-5-g744ff5f+2,14.0-5-g86eb1bd+31,14.0-6-gd5b81a9+6,14.0-6-ge2c9487+42,14.0-8-g7f6dd6b+6,14.0-8-gb81b6e9+4,14.0-9-g11010eb,14.0-9-g330837b+5
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
lsst::afw::formatters::WcsFormatter Class Referenceabstract

Class implementing persistence and retrieval for Wcs objects. More...

#include <WcsFormatter.h>

Inheritance diagram for lsst::afw::formatters::WcsFormatter:
lsst::daf::persistence::Formatter lsst::daf::base::Citizen

Public Types

typedef std::shared_ptr< FormatterPtr
 
typedef Ptr(* FactoryPtr) (lsst::pex::policy::Policy::Ptr)
 Pointer to a (static) factory function for a Formatter subclass. More...
 
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

virtual ~WcsFormatter ()
 
 WcsFormatter (WcsFormatter const &)
 
 WcsFormatter (WcsFormatter &&)
 
WcsFormatteroperator= (WcsFormatter const &)
 
WcsFormatteroperator= (WcsFormatter &&)
 
virtual void write (lsst::daf::base::Persistable const *persistable, std::shared_ptr< lsst::daf::persistence::FormatterStorage > storage, std::shared_ptr< lsst::daf::base::PropertySet > additionalData)
 
virtual lsst::daf::base::Persistableread (std::shared_ptr< lsst::daf::persistence::FormatterStorage > storage, std::shared_ptr< lsst::daf::base::PropertySet > additionalData)
 
virtual void update (lsst::daf::base::Persistable *persistable, std::shared_ptr< lsst::daf::persistence::FormatterStorage > storage, std::shared_ptr< lsst::daf::base::PropertySet > additionalData)
 
virtual void write (lsst::daf::base::Persistable const *persistable, FormatterStorage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)=0
 Write a Persistable instance to a FormatterStorage instance. More...
 
virtual lsst::daf::base::Persistableread (FormatterStorage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)=0
 Read a Persistable instance from a FormatterStorage instance. More...
 
virtual void update (lsst::daf::base::Persistable *persistable, FormatterStorage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)=0
 Update an existing Persistable instance with information from an additional FormatterStorage instance. More...
 
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 std::shared_ptr< lsst::daf::base::PropertyListgeneratePropertySet (lsst::afw::image::Wcs const &wcs)
 
static std::shared_ptr< lsst::daf::persistence::FormattercreateInstance (std::shared_ptr< lsst::pex::policy::Policy > policy)
 
template<class Archive >
static void delegateSerialize (Archive &ar, int const version, lsst::daf::base::Persistable *persistable)
 
static Formatter::Ptr lookupFormatter (std::string const &persistableType, lsst::pex::policy::Policy::Ptr policy)
 Lookup Formatter subclass by name of Persistable subclass. More...
 
static Formatter::Ptr lookupFormatter (std::type_info const &persistableType, lsst::pex::policy::Policy::Ptr policy)
 Lookup Formatter subclass by its type_info from typeid(). More...
 
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...
 
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...
 

Private Member Functions

 WcsFormatter (std::shared_ptr< lsst::pex::policy::Policy > policy)
 

Static Private Attributes

static lsst::daf::persistence::FormatterRegistration registration
 

Detailed Description

Class implementing persistence and retrieval for Wcs objects.

Definition at line 45 of file WcsFormatter.h.

Member Typedef Documentation

◆ FactoryPtr

typedef Ptr(* lsst::daf::persistence::Formatter::FactoryPtr) (lsst::pex::policy::Policy::Ptr)
inherited

Pointer to a (static) factory function for a Formatter subclass.

Definition at line 85 of file Formatter.h.

◆ memCallback

typedef memId(* lsst::daf::base::Citizen::memCallback) (const Citizen *ptr)
inherited

Definition at line 59 of file Citizen.h.

◆ memId

typedef unsigned long lsst::daf::base::Citizen::memId
inherited

Type of the block's ID.

Definition at line 56 of file Citizen.h.

◆ memNewCallback

typedef memId(* lsst::daf::base::Citizen::memNewCallback) (const memId cid)
inherited

A function used to register a callback.

Definition at line 58 of file Citizen.h.

◆ Ptr

Definition at line 81 of file Formatter.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
magicSentinel 

Definition at line 86 of file Citizen.h.

Constructor & Destructor Documentation

◆ ~WcsFormatter()

lsst::afw::formatters::WcsFormatter::~WcsFormatter ( )
virtualdefault

◆ WcsFormatter() [1/3]

lsst::afw::formatters::WcsFormatter::WcsFormatter ( WcsFormatter const &  )
default

◆ WcsFormatter() [2/3]

lsst::afw::formatters::WcsFormatter::WcsFormatter ( WcsFormatter &&  )
default

◆ WcsFormatter() [3/3]

lsst::afw::formatters::WcsFormatter::WcsFormatter ( std::shared_ptr< lsst::pex::policy::Policy policy)
explicitprivate

Definition at line 71 of file WcsFormatter.cc.

71 : dafPersist::Formatter(typeid(this)) {}
Abstract base class for all formatters.
Definition: Formatter.h:79

Member Function Documentation

◆ census() [1/3]

int lsst::daf::base::Citizen::census ( int  ,
memId  startingMemId = 0 
)
staticinherited

How many active Citizens are there?

Parameters
startingMemIdDon't print Citizens with lower IDs

Definition at line 267 of file Citizen.cc.

270  {
271  if (startingMemId == 0) { // easy
272  ReadGuard guard(citizenLock);
273  return _activeCitizens.size();
274  }
275 
276  int n = 0;
277  ReadGuard guard(citizenLock);
278  for (table::iterator cur = _activeCitizens.begin();
279  cur != _activeCitizens.end(); cur++) {
280  if (cur->first->_CitizenId >= startingMemId) {
281  n++;
282  }
283  }
284 
285  return n;
286 }
T end(T... args)
static table _activeCitizens
Definition: Citizen.h:102
T size(T... args)
T begin(T... args)

◆ census() [2/3]

void lsst::daf::base::Citizen::census ( std::ostream stream,
memId  startingMemId = 0 
)
staticinherited

Print a list of all active Citizens to stream, sorted by ID.

Parameters
streamstream to print to
startingMemIdDon't print Citizens with lower IDs

Definition at line 290 of file Citizen.cc.

293  {
294  ReadGuard guard(citizenLock);
295 
297 
298  for (std::vector<Citizen const *>::const_iterator citizen = leaks->begin(), end = leaks->end();
299  citizen != end; ++citizen) {
300  if ((*citizen)->getId() >= startingMemId) {
301  stream << (*citizen)->repr() << "\n";
302  }
303  }
304 }
int end
STL class.
STL class.
T begin(T... args)
static const std::vector< const Citizen * > * census()
Return a (newly allocated) std::vector of active Citizens sorted by ID.
Definition: Citizen.cc:322

◆ census() [3/3]

std::vector< dafBase::Citizen const * > const * lsst::daf::base::Citizen::census ( )
staticinherited

Return a (newly allocated) std::vector of active Citizens sorted by ID.

You are responsible for deleting it; or you can say std::unique_ptr<std::vector<Citizen const*> const> leaks(Citizen::census()); and not bother (that becomes std::unique_ptr in C++11)

Definition at line 322 of file Citizen.cc.

322  {
325  ReadGuard guard(citizenLock);
326  vec->reserve(_activeCitizens.size());
327 
328  for (table::iterator cur = _activeCitizens.begin();
329  cur != _activeCitizens.end(); cur++) {
330  vec->push_back(dynamic_cast<Citizen const*>(cur->first));
331  }
332 
333  std::sort(vec->begin(), vec->end(), cmpId);
334 
335  return vec;
336 }
T end(T... args)
static table _activeCitizens
Definition: Citizen.h:102
T push_back(T... args)
T size(T... args)
STL class.
T begin(T... args)
T sort(T... args)
T reserve(T... args)

◆ createInstance()

std::shared_ptr< dafPersist::Formatter > lsst::afw::formatters::WcsFormatter::createInstance ( std::shared_ptr< lsst::pex::policy::Policy policy)
static

Definition at line 232 of file WcsFormatter.cc.

233  {
235 }
WcsFormatter(WcsFormatter const &)

◆ delegateSerialize()

template<class Archive >
void lsst::afw::formatters::WcsFormatter::delegateSerialize ( Archive &  ar,
int const  version,
lsst::daf::base::Persistable persistable 
)
static

Definition at line 171 of file WcsFormatter.cc.

171  {
172  LOGL_DEBUG(_log, "WcsFormatter delegateSerialize start");
173  image::Wcs* ip = dynamic_cast<image::Wcs*>(persistable);
174  if (ip == 0) {
175  throw LSST_EXCEPT(pexExcept::RuntimeError, "Serializing non-Wcs");
176  }
177 
178  // Serialize most fields normally
179  ar & ip->_nWcsInfo & ip->_relax;
180  ar & ip->_wcsfixCtrl & ip->_wcshdrCtrl & ip->_nReject;
181  ar & ip->_coordSystem;
182 
183  // If we are loading, create the array of Wcs parameter structs
184  if (Archive::is_loading::value) {
185  ip->_wcsInfo = reinterpret_cast<wcsprm*>(malloc(ip->_nWcsInfo * sizeof(wcsprm)));
186  }
187 
188  for (int i = 0; i < ip->_nWcsInfo; ++i) {
189  // If we are loading, initialize the struct first
190  if (Archive::is_loading::value) {
191  ip->_wcsInfo[i].flag = -1;
192  wcsini(1, 2, &(ip->_wcsInfo[i]));
193  }
194 
195  // Serialize only critical Wcs parameters
196  // wcslib provides support for arrays of wcs', but we only
197  // implement support for one.
198  ar & ip->_wcsInfo[i].naxis;
199  ar & ip->_wcsInfo[i].equinox;
200  ar & ip->_wcsInfo[i].radesys;
201  ar & ip->_wcsInfo[i].crpix[0];
202  ar & ip->_wcsInfo[i].crpix[1];
203  ar & ip->_wcsInfo[i].cd[0];
204  ar & ip->_wcsInfo[i].cd[1];
205  ar & ip->_wcsInfo[i].cd[2];
206  ar & ip->_wcsInfo[i].cd[3];
207  ar & ip->_wcsInfo[i].crval[0];
208  ar & ip->_wcsInfo[i].crval[1];
209  ar & ip->_wcsInfo[i].cunit[0];
210  ar & ip->_wcsInfo[i].cunit[1];
211  ar & ip->_wcsInfo[i].ctype[0];
212  ar & ip->_wcsInfo[i].ctype[1];
213  ar & ip->_wcsInfo[i].altlin;
214 
215  // If we are loading, compute intermediate values given those above
216  if (Archive::is_loading::value) {
217  ip->_wcsInfo[i].flag = 0;
218  wcsset(&(ip->_wcsInfo[i]));
219  }
220  }
221  LOGL_DEBUG(_log, "WcsFormatter delegateSerialize end");
222 }
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:104
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
Definition: Log.h:513
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
Definition: Exception.h:46
T malloc(T... args)
int _wcshdrCtrl
Controls messages to stderr from wcshdr (0 for none); see wcshdr.h for details.
Definition: Wcs.h:450
int _relax
Degree of permissiveness for wcspih (0 for strict); see wcshdr.h for details.
Definition: Wcs.h:448
int _wcsfixCtrl
Do potentially unsafe translations of non-standard unit strings? 0/1 = no/yes.
Definition: Wcs.h:449
struct wcsprm * _wcsInfo
Definition: Wcs.h:446
coord::CoordSystem _coordSystem
Definition: Wcs.h:452

◆ generatePropertySet()

std::shared_ptr< dafBase::PropertyList > lsst::afw::formatters::WcsFormatter::generatePropertySet ( lsst::afw::image::Wcs const &  wcs)
static

Definition at line 128 of file WcsFormatter.cc.

128  {
129  // Only generates properties for the first wcsInfo.
131 
132  assert(wcs._wcsInfo); // default ctor is private, so an uninitialized Wcs should not exist in the wild
133 
134  wcsProps->add("NAXIS", wcs._wcsInfo[0].naxis, "number of data axes");
135  // EQUINOX is "not relevant" (FITS definition, version 3.0, page 30) when
136  // dealing with ICRS, and may confuse readers. Don't write it.
137  if (strncmp(wcs._wcsInfo[0].radesys, "ICRS", 4) != 0) {
138  wcsProps->add("EQUINOX", wcs._wcsInfo[0].equinox, "Equinox of coordinates");
139  }
140  wcsProps->add("RADESYS", std::string(wcs._wcsInfo[0].radesys), "Coordinate system for equinox");
141  wcsProps->add("CRPIX1", wcs._wcsInfo[0].crpix[0], "WCS Coordinate reference pixel");
142  wcsProps->add("CRPIX2", wcs._wcsInfo[0].crpix[1], "WCS Coordinate reference pixel");
143  wcsProps->add("CD1_1", wcs._wcsInfo[0].cd[0], "WCS Coordinate scale matrix");
144  wcsProps->add("CD1_2", wcs._wcsInfo[0].cd[1], "WCS Coordinate scale matrix");
145  wcsProps->add("CD2_1", wcs._wcsInfo[0].cd[2], "WCS Coordinate scale matrix");
146  wcsProps->add("CD2_2", wcs._wcsInfo[0].cd[3], "WCS Coordinate scale matrix");
147  wcsProps->add("CRVAL1", wcs._wcsInfo[0].crval[0], "WCS Ref value (RA in decimal degrees)");
148  wcsProps->add("CRVAL2", wcs._wcsInfo[0].crval[1], "WCS Ref value (DEC in decimal degrees)");
149  wcsProps->add("CUNIT1", std::string(wcs._wcsInfo[0].cunit[0]));
150  wcsProps->add("CUNIT2", std::string(wcs._wcsInfo[0].cunit[1]));
151  //
152  // Some projections need PVi_j keywords. Add them.
153  //
154  for (int i = 0; i != wcs._wcsInfo[0].npv; ++i) {
155  auto const pv = wcs._wcsInfo[0].pv[i];
156  int const ii = pv.i > 0 ? pv.i : (wcs._wcsInfo[0].lat + 1); // 0 => latitude axis (see wcslib/wsc.h)
157  char key[20];
158  sprintf(key, "PV%d_%d", ii, pv.m);
159  wcsProps->add(key, pv.value);
160  }
161 
162  std::string ctype1(wcs._wcsInfo[0].ctype[0]);
163  std::string ctype2(wcs._wcsInfo[0].ctype[1]);
164  wcsProps->add("CTYPE1", ctype1, "WCS Coordinate type");
165  wcsProps->add("CTYPE2", ctype2, "WCS Coordinate type");
166 
167  return wcsProps;
168 }
Class for storing ordered metadata with comments.
Definition: PropertyList.h:73
tbl::Key< int > wcs
table::Key< std::string > ctype2
Definition: Wcs.cc:938
STL class.
T strncmp(T... args)
T sprintf(T... args)
table::Key< std::string > ctype1
Definition: Wcs.cc:937

◆ getId()

dafBase::Citizen::memId lsst::daf::base::Citizen::getId ( ) const
inherited

Return the Citizen's ID.

Definition at line 224 of file Citizen.cc.

224  {
225  return _CitizenId;
226 }

◆ getNextMemId()

dafBase::Citizen::memId lsst::daf::base::Citizen::getNextMemId ( )
staticinherited

Return the memId of the next object to be allocated.

Definition at line 229 of file Citizen.cc.

229  {
230  return _nextMemId();
231 }
static memId _nextMemId(void)
Return the memId of the next object to be allocated.
Definition: Citizen.cc:234

◆ hasBeenCorrupted()

bool lsst::daf::base::Citizen::hasBeenCorrupted ( )
staticinherited

Check all allocated blocks for corruption.

Definition at line 353 of file Citizen.cc.

353  {
354  ReadGuard guard(citizenLock);
355  for (table::iterator cur = _activeCitizens.begin();
356  cur != _activeCitizens.end(); cur++) {
357  if (cur->first->_hasBeenCorrupted()) {
358  return true;
359  }
360  }
361  for (table::iterator cur = _persistentCitizens.begin();
362  cur != _persistentCitizens.end(); cur++) {
363  if (cur->first->_hasBeenCorrupted()) {
364  return true;
365  }
366  }
367 
368  return false;
369 }
T end(T... args)
static table _activeCitizens
Definition: Citizen.h:102
static table _persistentCitizens
Definition: Citizen.h:103
T begin(T... args)

◆ init()

int lsst::daf::base::Citizen::init ( )
staticinherited

Called once when the memory system is being initialised.

Definition at line 214 of file Citizen.cc.

214  {
215  volatile int dummy = 1;
216  return dummy;
217 }

◆ lookupFormatter() [1/2]

Formatter::Ptr lsst::daf::persistence::Formatter::lookupFormatter ( std::string const &  name,
lsst::pex::policy::Policy::Ptr  policy 
)
staticinherited

Lookup Formatter subclass by name of Persistable subclass.

Parameters
[in]nameName of Persistable subclass
[in]policyPolicy for configuring the Formatter
Returns
Shared pointer to Formatter instance

Returned pointer is not owned and should not be deleted.

Definition at line 84 of file Formatter.cc.

85  {
87 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
static FormatterRegistry & getInstance(void)
Get a reference to the singleton instance of the FormatterRegistry.
Formatter::Ptr lookupFormatter(std::type_info const &persistableType, lsst::pex::policy::Policy::Ptr policy)
Create a new instance of a Formatter subclass given the typeid() of its corresponding Persistable sub...

◆ lookupFormatter() [2/2]

Formatter::Ptr lsst::daf::persistence::Formatter::lookupFormatter ( std::type_info const &  type,
lsst::pex::policy::Policy::Ptr  policy 
)
staticinherited

Lookup Formatter subclass by its type_info from typeid().

Parameters
[in]typestd::type_info of Formatter subclass from typeid()
[in]policyPolicy for configuring the Formatter
Returns
Shared pointer to Formatter instance

Definition at line 94 of file Formatter.cc.

95  {
96  return FormatterRegistry::getInstance().lookupFormatter(type, policy);
97 }
static FormatterRegistry & getInstance(void)
Get a reference to the singleton instance of the FormatterRegistry.
Formatter::Ptr lookupFormatter(std::type_info const &persistableType, lsst::pex::policy::Policy::Ptr policy)
Create a new instance of a Formatter subclass given the typeid() of its corresponding Persistable sub...

◆ markPersistent()

void lsst::daf::base::Citizen::markPersistent ( void  )
inherited

Mark a Citizen as persistent and not destroyed until process end.

Definition at line 254 of file Citizen.cc.

254  {
255  WriteGuard guard(citizenLock);
256  _persistentCitizens[this] = _activeCitizens[this];
257  _activeCitizens.erase(this);
258 }
static table _activeCitizens
Definition: Citizen.h:102
T erase(T... args)
static table _persistentCitizens
Definition: Citizen.h:103

◆ operator=() [1/2]

WcsFormatter & lsst::afw::formatters::WcsFormatter::operator= ( WcsFormatter const &  )
default

◆ operator=() [2/2]

WcsFormatter & lsst::afw::formatters::WcsFormatter::operator= ( WcsFormatter &&  )
default

◆ read() [1/2]

dafBase::Persistable * lsst::afw::formatters::WcsFormatter::read ( std::shared_ptr< lsst::daf::persistence::FormatterStorage storage,
std::shared_ptr< lsst::daf::base::PropertySet additionalData 
)
virtual

Definition at line 99 of file WcsFormatter.cc.

100  {
101  LOGL_DEBUG(_log, "WcsFormatter read start");
102  // TODO: Replace this with something better in DM-10776
104  if (boost) {
105  image::Wcs* ip = new image::Wcs;
106  LOGL_DEBUG(_log, "WcsFormatter read BoostStorage");
107  boost->getIArchive() & *ip;
108  LOGL_DEBUG(_log, "WcsFormatter read end");
109  return ip;
110  }
112  if (fits) {
113  LOGL_DEBUG(_log, "WcsFormatter read FitsStorage");
114  int hdu = additionalData->get<int>("hdu", fits::DEFAULT_HDU);
116  image::Wcs* ip = new image::Wcs(md);
117  LOGL_DEBUG(_log, "WcsFormatter read end");
118  return ip;
119  }
120  throw LSST_EXCEPT(pexExcept::RuntimeError, "Unrecognized FormatterStorage for Wcs");
121 }
Definition: Span.h:37
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:104
Class for FITS file storage.
Definition: FitsStorage.h:52
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
Definition: Log.h:513
std::shared_ptr< daf::base::PropertyList > readMetadata(std::string const &fileName, int hdu=DEFAULT_HDU, bool strip=false)
Read FITS header.
Definition: Utils.h:64
T dynamic_pointer_cast(T... args)
T get(T... args)
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
Definition: Exception.h:46
Class for boost::serialization storage.
Definition: BoostStorage.h:59
const int DEFAULT_HDU
Specify that the default HDU should be read.
Definition: fitsDefaults.h:18

◆ read() [2/2]

virtual lsst::daf::base::Persistable* lsst::daf::persistence::Formatter::read ( FormatterStorage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
pure virtualinherited

Read a Persistable instance from a FormatterStorage instance.

Parameters
[in]storagePointer to the FormatterStorage instance.
[in]additionalDataAdditional data used to find the proper instance within the FormatterStorage.
Returns
Shared pointer to the new Persistable instance.

◆ repr()

std::string lsst::daf::base::Citizen::repr ( ) const
inherited

Return a string representation of a Citizen.

Definition at line 245 of file Citizen.cc.

245  {
246  return boost::str(boost::format("%d: %08x %s")
247  % _CitizenId
248  % this
250  );
251 }
std::string demangleType(std::string const _typeName)
Definition: Demangle.cc:113
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:134
const char * _typeName
Definition: Citizen.h:94

◆ setCorruptionCallback()

dafBase::Citizen::memCallback lsst::daf::base::Citizen::setCorruptionCallback ( Citizen::memCallback  func)
staticinherited

Set the CorruptionCallback function.

Parameters
funcfunction be called when block is found to be corrupted

Definition at line 432 of file Citizen.cc.

434  {
436  _corruptionCallback = func;
437 
438  return old;
439 }
memId(* memCallback)(const Citizen *ptr)
Definition: Citizen.h:59
static memCallback _corruptionCallback
Definition: Citizen.h:113

◆ setDeleteCallback()

dafBase::Citizen::memCallback lsst::daf::base::Citizen::setDeleteCallback ( Citizen::memCallback  func)
staticinherited

Set the DeleteCallback function.

Parameters
funcfunction be called when desired block is deleted

Definition at line 422 of file Citizen.cc.

424  {
426  _deleteCallback = func;
427 
428  return old;
429 }
static memCallback _deleteCallback
Definition: Citizen.h:112
memId(* memCallback)(const Citizen *ptr)
Definition: Citizen.h:59

◆ setDeleteCallbackId()

dafBase::Citizen::memId lsst::daf::base::Citizen::setDeleteCallbackId ( Citizen::memId  id)
staticinherited

Call the current DeleteCallback when block is deleted.

Parameters
idDesired ID

Definition at line 387 of file Citizen.cc.

389  {
390  WriteGuard guard(citizenLock);
391  Citizen::memId oldId = _deleteId;
392  _deleteId = id;
393 
394  return oldId;
395 }
unsigned long memId
Type of the block&#39;s ID.
Definition: Citizen.h:56
int id
Definition: CR.cc:155
static memId _deleteId
Definition: Citizen.h:109

◆ setNewCallback()

dafBase::Citizen::memNewCallback lsst::daf::base::Citizen::setNewCallback ( Citizen::memNewCallback  func)
staticinherited

Set the NewCallback function.

Parameters
funcThe new function to be called when a designated block is allocated

Definition at line 412 of file Citizen.cc.

414  {
416  _newCallback = func;
417 
418  return old;
419 }
memId(* memNewCallback)(const memId cid)
A function used to register a callback.
Definition: Citizen.h:58
static memNewCallback _newCallback
Definition: Citizen.h:111

◆ setNewCallbackId()

dafBase::Citizen::memId lsst::daf::base::Citizen::setNewCallbackId ( Citizen::memId  id)
staticinherited

Call the NewCallback when block is allocated.

Parameters
idDesired ID

Definition at line 376 of file Citizen.cc.

378  {
379  WriteGuard guard(citizenLock);
380  Citizen::memId oldId = _newId;
381  _newId = id;
382 
383  return oldId;
384 }
unsigned long memId
Type of the block&#39;s ID.
Definition: Citizen.h:56
static memId _newId
Definition: Citizen.h:108
int id
Definition: CR.cc:155

◆ update() [1/2]

void lsst::afw::formatters::WcsFormatter::update ( lsst::daf::base::Persistable persistable,
std::shared_ptr< lsst::daf::persistence::FormatterStorage storage,
std::shared_ptr< lsst::daf::base::PropertySet additionalData 
)
virtual

Definition at line 123 of file WcsFormatter.cc.

124  {
125  throw LSST_EXCEPT(pexExcept::RuntimeError, "Unexpected call to update for Wcs");
126 }
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
Definition: Exception.h:46

◆ update() [2/2]

virtual void lsst::daf::persistence::Formatter::update ( lsst::daf::base::Persistable persistable,
FormatterStorage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
pure virtualinherited

Update an existing Persistable instance with information from an additional FormatterStorage instance.

Parameters
[in,out]persistablePointer to the Persistable instance.
[in]storageShared pointer to the additional FormatterStorage instance.
[in]additionalDataAdditional data used to find the proper instance within the FormatterStorage.

◆ write() [1/2]

void lsst::afw::formatters::WcsFormatter::write ( lsst::daf::base::Persistable const *  persistable,
std::shared_ptr< lsst::daf::persistence::FormatterStorage storage,
std::shared_ptr< lsst::daf::base::PropertySet additionalData 
)
virtual

Definition at line 80 of file WcsFormatter.cc.

82  {
83  LOGL_DEBUG(_log, "WcsFormatter write start");
84  image::Wcs const* ip = dynamic_cast<image::Wcs const*>(persistable);
85  if (ip == 0) {
86  throw LSST_EXCEPT(pexExcept::RuntimeError, "Persisting non-Wcs");
87  }
88  // TODO: Replace this with something better in DM-10776
90  if (boost) {
91  LOGL_DEBUG(_log, "WcsFormatter write BoostStorage");
92  boost->getOArchive() & *ip;
93  LOGL_DEBUG(_log, "WcsFormatter write end");
94  return;
95  }
96  throw LSST_EXCEPT(pexExcept::RuntimeError, "Unrecognized FormatterStorage for Wcs");
97 }
Definition: Span.h:37
Implementation of the WCS standard for a any projection.
Definition: Wcs.h:104
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
Definition: Log.h:513
T dynamic_pointer_cast(T... args)
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
Definition: Exception.h:46
Class for boost::serialization storage.
Definition: BoostStorage.h:59

◆ write() [2/2]

virtual void lsst::daf::persistence::Formatter::write ( lsst::daf::base::Persistable const *  persistable,
FormatterStorage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
pure virtualinherited

Write a Persistable instance to a FormatterStorage instance.

Parameters
[in]persistablePointer to the Persistable instance.
[in]storageShared pointer to the FormatterStorage instance.
[in]additionalDataAdditional data used to find the proper place to put the instance into the FormatterStorage.

Member Data Documentation

◆ registration

dafPersist::FormatterRegistration lsst::afw::formatters::WcsFormatter::registration
staticprivate

Definition at line 74 of file WcsFormatter.h.


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