39 # define __attribute__(x)
44 #include "boost/scoped_ptr.hpp"
45 #include "boost/serialization/shared_ptr.hpp"
46 #include "boost/serialization/binary_object.hpp"
47 #include "boost/serialization/nvp.hpp"
48 #include <boost/archive/binary_oarchive.hpp>
49 #include <boost/archive/binary_iarchive.hpp>
59 static void execTrace(std::string s,
int level =
EXEC_TRACE) {
63 using boost::serialization::make_nvp;
73 namespace formatters {
75 template <
typename ImagePixelT>
78 static std::string
name();
82 static std::string
name =
"DecoratedImageU";
86 static std::string
name =
"DecoratedImageI";
90 static std::string
name =
"DecoratedImageF";
94 static std::string
name =
"DecoratedImageD";
98 static std::string
name =
"DecoratedImageL";
102 template <
typename ImagePixelT>
108 template <
typename ImagePixelT>
112 : lsst::daf::persistence::Formatter(typeid(this))
116 template <
typename ImagePixelT>
120 template <
typename ImagePixelT>
123 Storage::Ptr storage,
127 execTrace(
"DecoratedImageFormatter write start");
130 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Persisting non-DecoratedImage");
133 execTrace(
"DecoratedImageFormatter write BoostStorage");
136 execTrace(
"DecoratedImageFormatter write end");
138 }
else if (
typeid(*storage) ==
typeid(
XmlStorage)) {
139 execTrace(
"DecoratedImageFormatter write XmlStorage");
142 execTrace(
"DecoratedImageFormatter write end");
144 }
else if (
typeid(*storage) ==
typeid(
FitsStorage)) {
145 execTrace(
"DecoratedImageFormatter write FitsStorage");
153 execTrace(
"DecoratedImageFormatter write end");
156 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
157 "Unrecognized Storage for DecoratedImage");
160 template <
typename ImagePixelT>
162 Storage::Ptr storage,
166 execTrace(
"DecoratedImageFormatter read start");
168 execTrace(
"DecoratedImageFormatter read BoostStorage");
172 execTrace(
"DecoratedImageFormatter read end");
174 }
else if (
typeid(*storage) ==
typeid(
XmlStorage)) {
175 execTrace(
"DecoratedImageFormatter read XmlStorage");
179 execTrace(
"DecoratedImageFormatter read end");
181 }
else if(
typeid(*storage) ==
typeid(
FitsStorage)) {
183 execTrace(
"DecoratedImageFormatter read FitsStorage");
190 execTrace(
"DecoratedImageFormatter read end");
193 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
194 "Unrecognized Storage for DecoratedImage");
197 template <
typename ImagePixelT>
204 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
205 "Unexpected call to update for DecoratedImage");
208 template <
typename ImagePixelT>
template <
class Archive>
215 execTrace(
"DecoratedImageFormatter delegateSerialize start");
218 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Serializing non-DecoratedImage");
220 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
221 "DecoratedImage serialization not yet implemented");
224 template <
typename ImagePixelT>
232 #define InstantiateFormatter(ImagePixelT) \
233 template class DecoratedImageFormatter<ImagePixelT >; \
234 template void DecoratedImageFormatter<ImagePixelT >::delegateSerialize(boost::archive::text_oarchive&, int const, Persistable*); \
235 template void DecoratedImageFormatter<ImagePixelT >::delegateSerialize(boost::archive::text_iarchive&, int const, Persistable*); \
236 template void DecoratedImageFormatter<ImagePixelT >::delegateSerialize(boost::archive::binary_oarchive&, int const, Persistable*); \
237 template void DecoratedImageFormatter<ImagePixelT >::delegateSerialize(boost::archive::binary_iarchive&, int const, Persistable*);
245 #undef InstantiateFormatter
Class for XML file storage.
table::Key< std::string > name
daf_persistence package header file
virtual boost::archive::text_iarchive & getIArchive(void)
boost::shared_ptr< PropertySet > Ptr
virtual std::string const & getPath(void)
definition of the Trace messaging facilities
boost::shared_ptr< Policy > Ptr
limited backward compatibility to the DC2 run-time trace facilities
Class for FITS file storage.
virtual boost::archive::xml_iarchive & getIArchive(void)
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,...)
virtual boost::archive::text_oarchive & getOArchive(void)
virtual boost::archive::xml_oarchive & getOArchive(void)
boost::shared_ptr< Storage > Ptr
Class for boost::serialization storage.
Base class for all persistable classes.
Abstract base class for storage implementations.
A container for an Image and its associated metadata.