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
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
lsst::afw::formatters::KernelFormatter Class Reference

#include <KernelFormatter.h>

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

Public Member Functions

virtual ~KernelFormatter (void)
 
virtual void write (lsst::daf::base::Persistable const *persistable, lsst::daf::persistence::Storage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)
 
virtual
lsst::daf::base::Persistable
read (lsst::daf::persistence::Storage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)
 
virtual void update (lsst::daf::base::Persistable *persistable, lsst::daf::persistence::Storage::Ptr storage, lsst::daf::base::PropertySet::Ptr additionalData)
 
- Public Member Functions inherited from lsst::daf::persistence::Formatter
virtual ~Formatter (void)
 
- Public Member Functions inherited from lsst::daf::base::Citizen
 Citizen (const std::type_info &)
 
 Citizen (Citizen const &)
 
 ~Citizen ()
 
Citizenoperator= (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

template<class Archive >
static void delegateSerialize (Archive &ar, unsigned int const version, lsst::daf::base::Persistable *persistable)
 
- Static Public Member Functions inherited from lsst::daf::persistence::Formatter
static Formatter::Ptr lookupFormatter (std::string const &persistableType, lsst::pex::policy::Policy::Ptr policy)
 
static Formatter::Ptr lookupFormatter (std::type_info const &persistableType, lsst::pex::policy::Policy::Ptr policy)
 
- Static Public Member Functions inherited from lsst::daf::base::Citizen
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...
 
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...
 
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...
 
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

 KernelFormatter (lsst::pex::policy::Policy::Ptr policy)
 

Static Private Member Functions

static
lsst::daf::persistence::Formatter::Ptr 
createInstance (lsst::pex::policy::Policy::Ptr policy)
 

Private Attributes

lsst::pex::policy::Policy::Ptr _policy
 

Static Private Attributes

static
lsst::daf::persistence::FormatterRegistration 
kernelRegistration
 
static
lsst::daf::persistence::FormatterRegistration 
fixedKernelRegistration
 
static
lsst::daf::persistence::FormatterRegistration 
analyticKernelRegistration
 
static
lsst::daf::persistence::FormatterRegistration 
deltaFunctionKernelRegistration
 
static
lsst::daf::persistence::FormatterRegistration 
linearCombinationKernelRegistration
 
static
lsst::daf::persistence::FormatterRegistration 
separableKernelRegistration
 

Additional Inherited Members

- Public Types inherited from lsst::daf::persistence::Formatter
typedef boost::shared_ptr
< Formatter
Ptr
 
typedef Ptr(* FactoryPtr )(lsst::pex::policy::Policy::Ptr)
 
- Public Types inherited from lsst::daf::base::Citizen
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)
 
- Protected Member Functions inherited from lsst::daf::persistence::Formatter
 Formatter (std::type_info const &type)
 

Detailed Description

Definition at line 54 of file KernelFormatter.h.

Constructor & Destructor Documentation

lsst::afw::formatters::KernelFormatter::~KernelFormatter ( void  )
virtual

Minimal destructor.

Definition at line 157 of file KernelFormatter.cc.

157  {
158 }
lsst::afw::formatters::KernelFormatter::KernelFormatter ( lsst::pex::policy::Policy::Ptr  policy)
explicitprivate

Constructor.

Parameters
[in]policyPolicy for configuring this Formatter

Definition at line 150 of file KernelFormatter.cc.

151  :
152  dafPersist::Formatter(typeid(this)), _policy(policy) {
153 }
lsst::pex::policy::Policy::Ptr _policy
Abstract base class for all formatters.
Definition: Formatter.h:79

Member Function Documentation

dafPersist::Formatter::Ptr lsst::afw::formatters::KernelFormatter::createInstance ( lsst::pex::policy::Policy::Ptr  policy)
staticprivate

Factory method for KernelFormatter.

Parameters
[in]policyPolicy for configuring the KernelFormatter
Returns
Shared pointer to a new instance

Definition at line 263 of file KernelFormatter.cc.

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

Serialize a Kernel to a Boost archive. Handles text or XML archives, input or output.

Parameters
[in,out]arBoost archive
[in]versionVersion of the Kernel class
[in,out]persistablePointer to the Kernel as a Persistable

Definition at line 225 of file KernelFormatter.cc.

226  {
227  execTrace("KernelFormatter delegateSerialize start");
228  afwMath::Kernel* kp =
229  dynamic_cast<afwMath::Kernel*>(persistable);
230  if (kp == 0) {
231  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Serializing non-Kernel");
232  }
233  ar & make_nvp("base",
234  boost::serialization::base_object<dafBase::Persistable>(*kp));
235  ar & make_nvp("width", kp->_width);
236  ar & make_nvp("height", kp->_height);
237  ar & make_nvp("ctrX", kp->_ctrX);
238  ar & make_nvp("ctrY", kp->_ctrY);
239  ar & make_nvp("nParams", kp->_nKernelParams);
240  ar & make_nvp("spatialFunctionList", kp->_spatialFunctionList);
241 
242  execTrace("KernelFormatter delegateSerialize end");
243 }
unsigned int _nKernelParams
Definition: Kernel.h:533
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
std::vector< SpatialFunctionPtr > _spatialFunctionList
Definition: Kernel.h:524
Kernels are used for convolution with MaskedImages and (eventually) Images.
Definition: Kernel.h:134
dafBase::Persistable * lsst::afw::formatters::KernelFormatter::read ( lsst::daf::persistence::Storage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
virtual

Read a Persistable instance from a Storage instance.

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

Implements lsst::daf::persistence::Formatter.

Definition at line 189 of file KernelFormatter.cc.

190  {
191  execTrace("KernelFormatter read start");
192  afwMath::Kernel* kp;
193  if (typeid(*storage) == typeid(dafPersist::BoostStorage)) {
194  execTrace("KernelFormatter read BoostStorage");
195  dafPersist::BoostStorage* boost =
196  dynamic_cast<dafPersist::BoostStorage*>(storage.get());
197  boost->getIArchive() & kp;
198  execTrace("KernelFormatter read end");
199  return kp;
200  }
201  else if (typeid(*storage) == typeid(dafPersist::XmlStorage)) {
202  execTrace("KernelFormatter read XmlStorage");
204  dynamic_cast<dafPersist::XmlStorage*>(storage.get());
205  xml->getIArchive() & make_nvp("ptr", kp);
206  execTrace("KernelFormatter read end");
207  return kp;
208  }
209  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized Storage for Kernel");
210 }
Class for XML file storage.
Definition: XmlStorage.h:57
virtual boost::archive::text_iarchive & getIArchive(void)
virtual boost::archive::xml_iarchive & getIArchive(void)
Definition: XmlStorage.cc:114
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
Class for boost::serialization storage.
Definition: BoostStorage.h:58
Kernels are used for convolution with MaskedImages and (eventually) Images.
Definition: Kernel.h:134
void lsst::afw::formatters::KernelFormatter::update ( lsst::daf::base::Persistable persistable,
lsst::daf::persistence::Storage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
virtual

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

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

Implements lsst::daf::persistence::Formatter.

Definition at line 212 of file KernelFormatter.cc.

214  {
215  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unexpected call to update for Kernel");
216 }
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
void lsst::afw::formatters::KernelFormatter::write ( lsst::daf::base::Persistable const *  persistable,
lsst::daf::persistence::Storage::Ptr  storage,
lsst::daf::base::PropertySet::Ptr  additionalData 
)
virtual

Write a Persistable instance to a Storage instance.

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

Implements lsst::daf::persistence::Formatter.

Definition at line 160 of file KernelFormatter.cc.

163  {
164  execTrace("KernelFormatter write start");
165  afwMath::Kernel const* kp =
166  dynamic_cast<afwMath::Kernel const*>(persistable);
167  if (kp == 0) {
168  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Persisting non-Kernel");
169  }
170  if (typeid(*storage) == typeid(dafPersist::BoostStorage)) {
171  execTrace("KernelFormatter write BoostStorage");
172  dafPersist::BoostStorage* boost =
173  dynamic_cast<dafPersist::BoostStorage*>(storage.get());
174  boost->getOArchive() & kp;
175  execTrace("KernelFormatter write end");
176  return;
177  }
178  else if (typeid(*storage) == typeid(dafPersist::XmlStorage)) {
179  execTrace("KernelFormatter write XmlStorage");
181  dynamic_cast<dafPersist::XmlStorage*>(storage.get());
182  xml->getOArchive() & make_nvp("ptr", kp);
183  execTrace("KernelFormatter write end");
184  return;
185  }
186  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized Storage for Kernel");
187 }
Class for XML file storage.
Definition: XmlStorage.h:57
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
virtual boost::archive::text_oarchive & getOArchive(void)
virtual boost::archive::xml_oarchive & getOArchive(void)
Definition: XmlStorage.cc:107
Class for boost::serialization storage.
Definition: BoostStorage.h:58
Kernels are used for convolution with MaskedImages and (eventually) Images.
Definition: Kernel.h:134

Member Data Documentation

lsst::pex::policy::Policy::Ptr lsst::afw::formatters::KernelFormatter::_policy
private

Definition at line 76 of file KernelFormatter.h.

dafPersist::FormatterRegistration lsst::afw::formatters::KernelFormatter::analyticKernelRegistration
staticprivate

Definition at line 83 of file KernelFormatter.h.

dafPersist::FormatterRegistration lsst::afw::formatters::KernelFormatter::deltaFunctionKernelRegistration
staticprivate

Definition at line 84 of file KernelFormatter.h.

dafPersist::FormatterRegistration lsst::afw::formatters::KernelFormatter::fixedKernelRegistration
staticprivate

Definition at line 82 of file KernelFormatter.h.

dafPersist::FormatterRegistration lsst::afw::formatters::KernelFormatter::kernelRegistration
staticprivate

Register this Formatter subclass through a static instance of FormatterRegistration.

Definition at line 81 of file KernelFormatter.h.

dafPersist::FormatterRegistration lsst::afw::formatters::KernelFormatter::linearCombinationKernelRegistration
staticprivate

Definition at line 86 of file KernelFormatter.h.

dafPersist::FormatterRegistration lsst::afw::formatters::KernelFormatter::separableKernelRegistration
staticprivate

Definition at line 87 of file KernelFormatter.h.


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