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 Attributes | List of all members
lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT > Class Template Reference

Class implementing persistence and retrieval for DecoratedImages. More...

#include <DecoratedImageFormatter.h>

Inheritance diagram for lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT >:
lsst::daf::persistence::Formatter lsst::daf::base::Citizen

Public Member Functions

virtual ~DecoratedImageFormatter (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

static
lsst::daf::persistence::Formatter::Ptr 
createInstance (lsst::pex::policy::Policy::Ptr policy)
 
template<class Archive >
static void delegateSerialize (Archive &ar, 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

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

Static Private Attributes

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

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

template<typename ImagePixelT>
class lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT >

Class implementing persistence and retrieval for DecoratedImages.

Definition at line 54 of file DecoratedImageFormatter.h.

Constructor & Destructor Documentation

template<typename ImagePixelT >
lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT >::~DecoratedImageFormatter ( void  )
virtual

Definition at line 117 of file DecoratedImageFormatter.cc.

117  {
118 }
template<typename ImagePixelT >
lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT >::DecoratedImageFormatter ( lsst::pex::policy::Policy::Ptr  policy)
explicitprivate

Definition at line 109 of file DecoratedImageFormatter.cc.

112  : lsst::daf::persistence::Formatter(typeid(this))
113 {
114 }
Abstract base class for all formatters.
Definition: Formatter.h:79

Member Function Documentation

template<typename ImagePixelT >
lsst::daf::persistence::Formatter::Ptr lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT >::createInstance ( lsst::pex::policy::Policy::Ptr  policy)
static

Definition at line 225 of file DecoratedImageFormatter.cc.

228 {
229  return lsst::daf::persistence::Formatter::Ptr(new DecoratedImageFormatter<ImagePixelT>(policy));
230 }
boost::shared_ptr< Formatter > Ptr
Definition: Formatter.h:81
template<typename ImagePixelT >
template<class Archive >
template void lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT >::delegateSerialize ( Archive &  ar,
int const  version,
lsst::daf::base::Persistable persistable 
)
static

Definition at line 209 of file DecoratedImageFormatter.cc.

214 {
215  execTrace("DecoratedImageFormatter delegateSerialize start");
216  DecoratedImage<ImagePixelT>* ip = dynamic_cast<DecoratedImage<ImagePixelT>*>(persistable);
217  if (ip == 0) {
218  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Serializing non-DecoratedImage");
219  }
220  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
221  "DecoratedImage serialization not yet implemented");
222 }
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
A container for an Image and its associated metadata.
Definition: Image.h:614
template<typename ImagePixelT >
Persistable * lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT >::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 161 of file DecoratedImageFormatter.cc.

165 {
166  execTrace("DecoratedImageFormatter read start");
167  if (typeid(*storage) == typeid(BoostStorage)) {
168  execTrace("DecoratedImageFormatter read BoostStorage");
169  BoostStorage* boost = dynamic_cast<BoostStorage*>(storage.get());
171  boost->getIArchive() & *ip;
172  execTrace("DecoratedImageFormatter read end");
173  return ip;
174  } else if (typeid(*storage) == typeid(XmlStorage)) {
175  execTrace("DecoratedImageFormatter read XmlStorage");
176  XmlStorage* boost = dynamic_cast<XmlStorage*>(storage.get());
178  boost->getIArchive() & make_nvp("img", *ip);
179  execTrace("DecoratedImageFormatter read end");
180  return ip;
181  } else if(typeid(*storage) == typeid(FitsStorage)) {
182 
183  execTrace("DecoratedImageFormatter read FitsStorage");
184  FitsStorage* fits = dynamic_cast<FitsStorage*>(storage.get());
185 
187  // \todo Do something with these fields?
188  // int _X0;
189  // int _Y0;
190  execTrace("DecoratedImageFormatter read end");
191  return ip;
192  }
193  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
194  "Unrecognized Storage for DecoratedImage");
195 }
Class for XML file storage.
Definition: XmlStorage.h:57
virtual boost::archive::text_iarchive & getIArchive(void)
virtual std::string const & getPath(void)
Definition: FitsStorage.cc:109
Class for FITS file storage.
Definition: FitsStorage.h:52
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
A container for an Image and its associated metadata.
Definition: Image.h:614
template<typename ImagePixelT >
void lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT >::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 198 of file DecoratedImageFormatter.cc.

203 {
204  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
205  "Unexpected call to update for DecoratedImage");
206 }
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
template<typename ImagePixelT >
void lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT >::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 121 of file DecoratedImageFormatter.cc.

126 {
127  execTrace("DecoratedImageFormatter write start");
128  DecoratedImage<ImagePixelT> const* ip = dynamic_cast<DecoratedImage<ImagePixelT> const*>(persistable);
129  if (ip == 0) {
130  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Persisting non-DecoratedImage");
131  }
132  if (typeid(*storage) == typeid(BoostStorage)) {
133  execTrace("DecoratedImageFormatter write BoostStorage");
134  BoostStorage* boost = dynamic_cast<BoostStorage*>(storage.get());
135  boost->getOArchive() & *ip;
136  execTrace("DecoratedImageFormatter write end");
137  return;
138  } else if (typeid(*storage) == typeid(XmlStorage)) {
139  execTrace("DecoratedImageFormatter write XmlStorage");
140  XmlStorage* boost = dynamic_cast<XmlStorage*>(storage.get());
141  boost->getOArchive() & make_nvp("img", *ip);
142  execTrace("DecoratedImageFormatter write end");
143  return;
144  } else if (typeid(*storage) == typeid(FitsStorage)) {
145  execTrace("DecoratedImageFormatter write FitsStorage");
146  FitsStorage* fits = dynamic_cast<FitsStorage*>(storage.get());
148 
149  ip->writeFits(fits->getPath());
150  // \todo Do something with these fields?
151  // int _X0;
152  // int _Y0;
153  execTrace("DecoratedImageFormatter write end");
154  return;
155  }
156  throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
157  "Unrecognized Storage for DecoratedImage");
158 }
Class for XML file storage.
Definition: XmlStorage.h:57
virtual std::string const & getPath(void)
Definition: FitsStorage.cc:109
Class for FITS file storage.
Definition: FitsStorage.h:52
void writeFits(std::string const &fileName, boost::shared_ptr< lsst::daf::base::PropertySet const > metadata=boost::shared_ptr< lsst::daf::base::PropertySet const >(), std::string const &mode="w") const
#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
A container for an Image and its associated metadata.
Definition: Image.h:614

Member Data Documentation

template<typename ImagePixelT >
lsst::daf::persistence::FormatterRegistration lsst::afw::formatters::DecoratedImageFormatter< ImagePixelT >::registration
staticprivate

Definition at line 87 of file DecoratedImageFormatter.h.


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