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::TanWcsFormatter Class Referenceabstract

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

#include <TanWcsFormatter.h>

Inheritance diagram for lsst::afw::formatters::TanWcsFormatter:
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 ~TanWcsFormatter ()
 
 TanWcsFormatter (TanWcsFormatter const &)
 
 TanWcsFormatter (TanWcsFormatter &&)
 
TanWcsFormatteroperator= (TanWcsFormatter const &)
 
TanWcsFormatteroperator= (TanWcsFormatter &&)
 
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::TanWcs 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

 TanWcsFormatter (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 TanWcs objects.

Definition at line 48 of file TanWcsFormatter.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

◆ ~TanWcsFormatter()

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

◆ TanWcsFormatter() [1/3]

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

◆ TanWcsFormatter() [2/3]

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

◆ TanWcsFormatter() [3/3]

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

Definition at line 71 of file TanWcsFormatter.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::TanWcsFormatter::createInstance ( std::shared_ptr< lsst::pex::policy::Policy policy)
static

Definition at line 289 of file TanWcsFormatter.cc.

290  {
292 }
TanWcsFormatter(TanWcsFormatter const &)

◆ delegateSerialize()

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

Definition at line 219 of file TanWcsFormatter.cc.

219  {
220  LOGL_DEBUG(_log, "TanWcsFormatter delegateSerialize start");
221  image::TanWcs* ip = dynamic_cast<image::TanWcs*>(persistable);
222  if (ip == 0) {
223  throw LSST_EXCEPT(pexExcept::RuntimeError, "Serializing non-TanWcs");
224  }
225 
226  // Serialize most fields normally
227  ar & ip->_nWcsInfo & ip->_relax;
228  ar & ip->_wcsfixCtrl & ip->_wcshdrCtrl & ip->_nReject;
229  ar & ip->_coordSystem;
230 
231  ar & ip->_hasDistortion;
232 
233  if (ip->_hasDistortion) {
234  serializeEigenArray(ar, ip->_sipA);
235  serializeEigenArray(ar, ip->_sipAp);
236  serializeEigenArray(ar, ip->_sipB);
237  serializeEigenArray(ar, ip->_sipBp);
238  }
239 
240  // If we are loading, create the array of Wcs parameter structs
241  if (Archive::is_loading::value) {
242  ip->_wcsInfo = reinterpret_cast<wcsprm*>(malloc(ip->_nWcsInfo * sizeof(wcsprm)));
243  }
244 
245  for (int i = 0; i < ip->_nWcsInfo; ++i) {
246  // If we are loading, initialize the struct first
247  if (Archive::is_loading::value) {
248  ip->_wcsInfo[i].flag = -1;
249  wcsini(1, 2, &(ip->_wcsInfo[i]));
250  }
251 
252  // Serialize only critical Wcs parameters
253  ar & ip->_wcsInfo[i].naxis;
254  ar & ip->_wcsInfo[i].equinox;
255  ar & ip->_wcsInfo[i].radesys;
256  ar & ip->_wcsInfo[i].crpix[0];
257  ar & ip->_wcsInfo[i].crpix[1];
258  ar & ip->_wcsInfo[i].cd[0];
259  ar & ip->_wcsInfo[i].cd[1];
260  ar & ip->_wcsInfo[i].cd[2];
261  ar & ip->_wcsInfo[i].cd[3];
262  ar & ip->_wcsInfo[i].crval[0];
263  ar & ip->_wcsInfo[i].crval[1];
264  ar & ip->_wcsInfo[i].cunit[0];
265  ar & ip->_wcsInfo[i].cunit[1];
266  ar & ip->_wcsInfo[i].ctype[0];
267  ar & ip->_wcsInfo[i].ctype[1];
268  ar & ip->_wcsInfo[i].altlin;
269 
270  // If we are loading, compute intermediate values given those above
271  if (Archive::is_loading::value) {
272  ip->_wcsInfo[i].flag = 0;
273  wcsset(&(ip->_wcsInfo[i]));
274  }
275  }
276  LOGL_DEBUG(_log, "TanWcsFormatter delegateSerialize end");
277 }
Eigen::MatrixXd _sipAp
Definition: TanWcs.h:201
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
Definition: Log.h:513
Implementation of the WCS standard for the special case of the Gnomonic (tangent plane) projection...
Definition: TanWcs.h:68
Eigen::MatrixXd _sipB
Definition: TanWcs.h:201
#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
Eigen::MatrixXd _sipA
Definition: TanWcs.h:201
int _wcsfixCtrl
Do potentially unsafe translations of non-standard unit strings? 0/1 = no/yes.
Definition: Wcs.h:449
void serializeEigenArray(Archive &ar, Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &m)
struct wcsprm * _wcsInfo
Definition: Wcs.h:446
coord::CoordSystem _coordSystem
Definition: Wcs.h:452
Eigen::MatrixXd _sipBp
Definition: TanWcs.h:201

◆ generatePropertySet()

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

Definition at line 165 of file TanWcsFormatter.cc.

165  {
166  // Only generates properties for the first wcsInfo.
168 
169  if (wcs._wcsInfo == NULL) { // nothing to add
170  return wcsProps;
171  }
172 
173  wcsProps->add("NAXIS", wcs._wcsInfo[0].naxis, "number of data axes");
174  // EQUINOX is "not relevant" (FITS definition, version 3.0, page 30) when
175  // dealing with ICRS, and may confuse readers. Don't write it.
176  if (strncmp(wcs._wcsInfo[0].radesys, "ICRS", 4) != 0) {
177  wcsProps->add("EQUINOX", wcs._wcsInfo[0].equinox, "Equinox of coordinates");
178  }
179  wcsProps->add("RADESYS", std::string(wcs._wcsInfo[0].radesys), "Coordinate system for equinox");
180  wcsProps->add("CRPIX1", wcs._wcsInfo[0].crpix[0], "WCS Coordinate reference pixel");
181  wcsProps->add("CRPIX2", wcs._wcsInfo[0].crpix[1], "WCS Coordinate reference pixel");
182  wcsProps->add("CD1_1", wcs._wcsInfo[0].cd[0], "WCS Coordinate scale matrix");
183  wcsProps->add("CD1_2", wcs._wcsInfo[0].cd[1], "WCS Coordinate scale matrix");
184  wcsProps->add("CD2_1", wcs._wcsInfo[0].cd[2], "WCS Coordinate scale matrix");
185  wcsProps->add("CD2_2", wcs._wcsInfo[0].cd[3], "WCS Coordinate scale matrix");
186  wcsProps->add("CRVAL1", wcs._wcsInfo[0].crval[0], "WCS Ref value (RA in decimal degrees)");
187  wcsProps->add("CRVAL2", wcs._wcsInfo[0].crval[1], "WCS Ref value (DEC in decimal degrees)");
188  wcsProps->add("CUNIT1", std::string(wcs._wcsInfo[0].cunit[0]));
189  wcsProps->add("CUNIT2", std::string(wcs._wcsInfo[0].cunit[1]));
190 
191  // Hack. Because wcslib4.3 gets confused when it's passed RA---TAN-SIP,
192  // we set the value of ctypes to just RA---TAN, regardless of whether
193  // the SIP types are present. But when we persist to a file, we need to
194  // check whether the SIP polynomials were actually there and correct
195  // ctypes if necessary. Bad things will happen if someone tries to
196  // use a system other than RA---TAN and DEC--TAN
197  std::string ctype1(wcs._wcsInfo[0].ctype[0]);
198  std::string ctype2(wcs._wcsInfo[0].ctype[1]);
199 
200  if (wcs._hasDistortion) {
201  if (ctype1.rfind("-SIP") == std::string::npos) {
202  ctype1 += "-SIP";
203  }
204  if (ctype2.rfind("-SIP") == std::string::npos) {
205  ctype2 += "-SIP";
206  }
207  encodeSipHeader(wcsProps, "A", wcs._sipA);
208  encodeSipHeader(wcsProps, "B", wcs._sipB);
209  encodeSipHeader(wcsProps, "AP", wcs._sipAp);
210  encodeSipHeader(wcsProps, "BP", wcs._sipBp);
211  }
212  wcsProps->add("CTYPE1", ctype1, "WCS Coordinate type");
213  wcsProps->add("CTYPE2", ctype2, "WCS Coordinate type");
214 
215  return wcsProps;
216 }
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)
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]

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

◆ operator=() [2/2]

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

◆ read() [1/2]

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

Definition at line 99 of file TanWcsFormatter.cc.

100  {
101  LOGL_DEBUG(_log, "TanWcsFormatter read start");
102  // TODO: Replace this with something better in DM-10776
104  if (boost) {
105  image::TanWcs* ip = new image::TanWcs;
106  LOGL_DEBUG(_log, "TanWcsFormatter read BoostStorage");
107  boost->getIArchive() & *ip;
108  LOGL_DEBUG(_log, "TanWcsFormatter read end");
109  return ip;
110  }
112  if (fits) {
113  LOGL_DEBUG(_log, "TanWcsFormatter read FitsStorage");
114  int hdu = additionalData->get<int>("hdu", fits::DEFAULT_HDU);
116  image::TanWcs* ip = new image::TanWcs(md);
117  LOGL_DEBUG(_log, "TanWcsFormatter read end");
118  return ip;
119  }
120  throw LSST_EXCEPT(pexExcept::RuntimeError, "Unrecognized FormatterStorage for TanWcs");
121 }
Definition: Span.h:37
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
Implementation of the WCS standard for the special case of the Gnomonic (tangent plane) projection...
Definition: TanWcs.h:68
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::TanWcsFormatter::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 TanWcsFormatter.cc.

124  {
125  throw LSST_EXCEPT(pexExcept::RuntimeError, "Unexpected call to update for TanWcs");
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::TanWcsFormatter::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 TanWcsFormatter.cc.

82  {
83  LOGL_DEBUG(_log, "TamWcsFormatter write start");
84  image::TanWcs const* ip = dynamic_cast<image::TanWcs const*>(persistable);
85  if (ip == 0) {
86  throw LSST_EXCEPT(pexExcept::RuntimeError, "Persisting non-TanWcs");
87  }
88  // TODO: Replace this with something better in DM-10776
90  if (boost) {
91  LOGL_DEBUG(_log, "TanWcsFormatter write BoostStorage");
92  boost->getOArchive() & *ip;
93  LOGL_DEBUG(_log, "TanWcsFormatter write end");
94  return;
95  }
96  throw LSST_EXCEPT(pexExcept::RuntimeError, "Unrecognized FormatterStorage for TanWcs");
97 }
Definition: Span.h:37
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
Definition: Log.h:513
Implementation of the WCS standard for the special case of the Gnomonic (tangent plane) projection...
Definition: TanWcs.h:68
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::TanWcsFormatter::registration
staticprivate

Definition at line 77 of file TanWcsFormatter.h.


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