39 # define __attribute__(x)
50 #include <boost/archive/text_oarchive.hpp>
51 #include <boost/archive/text_iarchive.hpp>
52 #include <boost/archive/binary_oarchive.hpp>
53 #include <boost/archive/binary_iarchive.hpp>
54 #include <boost/archive/xml_oarchive.hpp>
55 #include <boost/archive/xml_iarchive.hpp>
56 #include <boost/serialization/nvp.hpp>
57 #include <boost/serialization/vector.hpp>
59 #include <boost/serialization/export.hpp>
74 BOOST_CLASS_EXPORT(lsst::afw::math::FixedKernel)
75 BOOST_CLASS_EXPORT(lsst::afw::math::AnalyticKernel)
76 BOOST_CLASS_EXPORT(lsst::afw::math::DeltaFunctionKernel)
77 BOOST_CLASS_EXPORT(lsst::afw::math::LinearCombinationKernel)
78 BOOST_CLASS_EXPORT(lsst::afw::math::SeparableKernel)
80 BOOST_CLASS_EXPORT(lsst::afw::math::Function<
float>)
81 BOOST_CLASS_EXPORT(lsst::afw::math::NullFunction1<
float>)
82 BOOST_CLASS_EXPORT(lsst::afw::math::NullFunction2<
float>)
84 BOOST_CLASS_EXPORT(lsst::afw::math::Function<
double>)
85 BOOST_CLASS_EXPORT(lsst::afw::math::NullFunction1<
double>)
86 BOOST_CLASS_EXPORT(lsst::afw::math::NullFunction2<
double>)
88 BOOST_CLASS_EXPORT(lsst::afw::math::IntegerDeltaFunction2<
float>)
89 BOOST_CLASS_EXPORT(lsst::afw::math::GaussianFunction1<
float>)
90 BOOST_CLASS_EXPORT(lsst::afw::math::GaussianFunction2<
float>)
91 BOOST_CLASS_EXPORT(lsst::afw::math::DoubleGaussianFunction2<
float>)
92 BOOST_CLASS_EXPORT(lsst::afw::math::PolynomialFunction1<
float>)
93 BOOST_CLASS_EXPORT(lsst::afw::math::PolynomialFunction2<
float>)
94 BOOST_CLASS_EXPORT(lsst::afw::math::Chebyshev1Function1<
float>)
95 BOOST_CLASS_EXPORT(lsst::afw::math::Chebyshev1Function2<
float>)
96 BOOST_CLASS_EXPORT(lsst::afw::math::LanczosFunction1<
float>)
97 BOOST_CLASS_EXPORT(lsst::afw::math::LanczosFunction2<
float>)
99 BOOST_CLASS_EXPORT(lsst::afw::math::IntegerDeltaFunction2<
double>)
100 BOOST_CLASS_EXPORT(lsst::afw::math::GaussianFunction1<
double>)
101 BOOST_CLASS_EXPORT(lsst::afw::math::GaussianFunction2<
double>)
102 BOOST_CLASS_EXPORT(lsst::afw::math::DoubleGaussianFunction2<
double>)
103 BOOST_CLASS_EXPORT(lsst::afw::math::PolynomialFunction1<
double>)
104 BOOST_CLASS_EXPORT(lsst::afw::math::PolynomialFunction2<
double>)
105 BOOST_CLASS_EXPORT(lsst::afw::math::Chebyshev1Function1<
double>)
106 BOOST_CLASS_EXPORT(lsst::afw::math::Chebyshev1Function2<
double>)
107 BOOST_CLASS_EXPORT(lsst::afw::math::LanczosFunction1<
double>)
108 BOOST_CLASS_EXPORT(lsst::afw::math::LanczosFunction2<
double>)
114 namespace afwMath = lsst::afw::math;
115 namespace afwForm = lsst::afw::formatters;
116 namespace dafBase = lsst::daf::base;
117 namespace dafPersist = lsst::daf::persistence;
118 namespace pexPolicy = lsst::pex::policy;
120 using boost::serialization::make_nvp;
151 dafPersist::Formatter(typeid(this)), _policy(policy) {
163 LOGL_DEBUG(_log,
"KernelFormatter write start");
167 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Persisting non-Kernel");
170 LOGL_DEBUG(_log,
"KernelFormatter write BoostStorage");
174 LOGL_DEBUG(_log,
"KernelFormatter write end");
178 LOGL_DEBUG(_log,
"KernelFormatter write XmlStorage");
182 LOGL_DEBUG(_log,
"KernelFormatter write end");
185 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Unrecognized Storage for Kernel");
190 LOGL_DEBUG(_log,
"KernelFormatter read start");
193 LOGL_DEBUG(_log,
"KernelFormatter read BoostStorage");
201 LOGL_DEBUG(_log,
"KernelFormatter read XmlStorage");
208 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Unrecognized Storage for Kernel");
214 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Unexpected call to update for Kernel");
222 template <
class Archive>
225 LOGL_DEBUG(_log,
"KernelFormatter delegateSerialize start");
229 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
"Serializing non-Kernel");
231 ar & make_nvp(
"base",
232 boost::serialization::base_object<dafBase::Persistable>(*kp));
233 ar & make_nvp(
"width", kp->
_width);
234 ar & make_nvp(
"height", kp->
_height);
235 ar & make_nvp(
"ctrX", kp->
_ctrX);
236 ar & make_nvp(
"ctrY", kp->
_ctrY);
240 LOGL_DEBUG(_log,
"KernelFormatter delegateSerialize end");
std::shared_ptr< Policy > Ptr
Declare the Kernel class and subclasses.
Class for XML file storage.
Include files required for standard LSST Exception handling.
A kernel described by a pair of functions: func(x, y) = colFunc(x) * rowFunc(y)
Define a collection of useful Functions.
virtual boost::archive::text_oarchive & getOArchive(void)
Get a boost::serialization archive suitable for output.
#define LOGL_DEBUG(logger, message...)
Log a debug-level message using a varargs/printf style interface.
LSST DM logging module built on log4cxx.
Interface for XmlStorage class.
virtual boost::archive::xml_iarchive & getIArchive(void)
Get a boost::serialization XML archive suitable for input.
std::shared_ptr< Storage > Ptr
A kernel that is a linear combination of fixed basis kernels.
unsigned int _nKernelParams
virtual boost::archive::text_iarchive & getIArchive(void)
Get a boost::serialization archive suitable for input.
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
std::vector< SpatialFunctionPtr > _spatialFunctionList
Define the basic Function classes.
Class for boost::serialization storage.
Base class for all persistable classes.
virtual boost::archive::xml_oarchive & getOArchive(void)
Get a boost::serialization XML archive suitable for output.
std::shared_ptr< PropertySet > Ptr
A kernel described by a function.
#define LOG_GET(logger)
Returns a Log object associated with logger.
Interface for LogicalLocation class.
Kernels are used for convolution with MaskedImages and (eventually) Images.
A kernel that has only one non-zero pixel (of value 1)
A kernel created from an Image.
Interface for BoostStorage class.