35 #include "boost/format.hpp"
66 namespace ex = lsst::pex::exceptions;
67 namespace fmt = lsst::afw::formatters;
81 "PersistableMatchPairVector",
92 template <
class Archive>
95 unsigned int const version,
99 MatchPairVector::size_type sz;
102 if (Archive::is_loading::value) {
106 for (; sz > 0; --sz) {
113 for (MatchPairVector::iterator i(vec.begin()), end(vec.end()); i != end; ++i) {
120 template void lsst::ap::io::MatchPairVectorFormatter::delegateSerialize<boost::archive::text_oarchive>(
121 boost::archive::text_oarchive &,
unsigned int const,
Persistable *
123 template void lsst::ap::io::MatchPairVectorFormatter::delegateSerialize<boost::archive::text_iarchive>(
124 boost::archive::text_iarchive &,
unsigned int const,
Persistable *
137 Storage::Ptr storage,
140 if (persistable == 0) {
141 throw LSST_EXCEPT(ex::InvalidParameterError,
"No Persistable provided");
144 throw LSST_EXCEPT(ex::InvalidParameterError,
"No Storage provided");
150 "Persistable was not of concrete type PersistableMatchPairVector");
156 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get BoostStorage");
161 std::string model = _policy->getString(
fmt::getItemName(additionalData) +
".templateTableName");
163 if (
typeid(*storage) ==
typeid(
DbStorage)) {
166 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get DbStorage");
170 for (MatchPairVector::const_iterator i(v.begin()), end(v.end()); i != end; ++i) {
171 db->
setColumn<boost::int64_t>(
"first", i->_first);
172 db->
setColumn<boost::int64_t>(
"second", i->_second);
173 db->
setColumn<
double> (
"distance", i->_distance);
179 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get DbTsvStorage");
183 for (MatchPairVector::const_iterator i(v.begin()), end(v.end()); i != end; ++i) {
184 db->
setColumn<boost::int64_t>(
"first", i->_first);
185 db->
setColumn<boost::int64_t>(
"second", i->_second);
186 db->
setColumn<
double> (
"distance", i->_distance);
191 throw LSST_EXCEPT(ex::InvalidParameterError,
"Storage type is not supported");
197 Storage::Ptr storage,
205 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get BoostStorage");
211 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get DbStorage");
221 throw LSST_EXCEPT(ex::RuntimeError,
"null column \"first\"");
224 throw LSST_EXCEPT(ex::RuntimeError,
"null column \"second\"");
227 throw LSST_EXCEPT(ex::RuntimeError,
"null column \"distance\"");
229 p->getMatchPairs().push_back(data);
233 throw LSST_EXCEPT(ex::InvalidParameterError,
"Storage type is not supported");
240 throw LSST_EXCEPT(ex::RuntimeError,
"MatchPairVectorFormatter: updates not supported");
256 "PersistableIdPairVector",
267 template <
class Archive>
270 unsigned int const version,
274 IdPairVector::size_type sz;
277 if (Archive::is_loading::value) {
281 for (; sz > 0; --sz) {
282 archive & data.first;
283 archive & data.second;
289 for (IdPairVector::iterator i(vec.begin()), end(vec.end()); i != end; ++i) {
297 template void lsst::ap::io::IdPairVectorFormatter::delegateSerialize<boost::archive::text_oarchive>(
298 boost::archive::text_oarchive &,
unsigned int const,
Persistable *
300 template void lsst::ap::io::IdPairVectorFormatter::delegateSerialize<boost::archive::text_iarchive>(
301 boost::archive::text_iarchive &,
unsigned int const,
Persistable *
314 Storage::Ptr storage,
317 if (persistable == 0) {
318 throw LSST_EXCEPT(ex::InvalidParameterError,
"No Persistable provided");
321 throw LSST_EXCEPT(ex::InvalidParameterError,
"No Storage provided");
326 throw LSST_EXCEPT(ex::RuntimeError,
"Persistable was not of concrete type IdPairVector");
332 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get BoostStorage");
337 std::string model = _policy->getString(
fmt::getItemName(additionalData) +
".templateTableName");
339 if (
typeid(*storage) ==
typeid(
DbStorage)) {
342 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get DbStorage");
346 for (IdPairVector::const_iterator i(v.begin()), end(v.end()); i != end; ++i) {
347 db->
setColumn<boost::int64_t>(
"first", i->first);
348 db->
setColumn<boost::int64_t>(
"second", i->second);
354 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get DbTsvStorage");
358 for (IdPairVector::const_iterator i(v.begin()), end(v.end()); i != end; ++i) {
359 db->
setColumn<boost::int64_t>(
"first", i->first);
360 db->
setColumn<boost::int64_t>(
"second", i->second);
365 throw LSST_EXCEPT(ex::InvalidParameterError,
"Storage type is not supported");
371 Storage::Ptr storage,
379 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get BoostStorage");
385 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get DbStorage");
391 db->
outParam(
"second", &data.second);
395 throw LSST_EXCEPT(ex::RuntimeError,
"null column \"first\"");
398 throw LSST_EXCEPT(ex::RuntimeError,
"null column \"second\"");
400 p->getIdPairs().push_back(data);
404 throw LSST_EXCEPT(ex::InvalidParameterError,
"Storage type is not supported");
411 throw LSST_EXCEPT(ex::RuntimeError,
"IdPairVectorFormatter: updates not supported");
427 "PersistableIdVector",
438 template <
class Archive>
441 unsigned int const version,
445 IdVector::size_type sz;
448 if (Archive::is_loading::value) {
452 for (; sz > 0; --sz) {
459 for (IdVector::iterator i(vec.begin()), end(vec.end()); i != end; ++i) {
466 template void lsst::ap::io::IdVectorFormatter::delegateSerialize<boost::archive::text_oarchive>(
467 boost::archive::text_oarchive &,
unsigned int const,
Persistable *
469 template void lsst::ap::io::IdVectorFormatter::delegateSerialize<boost::archive::text_iarchive>(
470 boost::archive::text_iarchive &,
unsigned int const,
Persistable *
483 Storage::Ptr storage,
486 if (persistable == 0) {
487 throw LSST_EXCEPT(ex::InvalidParameterError,
"No Persistable provided");
490 throw LSST_EXCEPT(ex::InvalidParameterError,
"No Storage provided");
495 throw LSST_EXCEPT(ex::RuntimeError,
"Persistable was not of concrete type IdVector");
501 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get BoostStorage");
506 std::string model = _policy->getString(
fmt::getItemName(additionalData) +
".templateTableName");
508 if (
typeid(*storage) ==
typeid(
DbStorage)) {
511 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get DbStorage");
515 for (IdVector::const_iterator i(v.begin()), end(v.end()); i != end; ++i) {
522 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get DbTsvStorage");
526 for (IdVector::const_iterator i(v.begin()), end(v.end()); i != end; ++i) {
532 throw LSST_EXCEPT(ex::InvalidParameterError,
"Storage type is not supported");
538 Storage::Ptr storage,
546 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get BoostStorage");
552 throw LSST_EXCEPT(ex::RuntimeError,
"Didn't get DbStorage");
561 throw LSST_EXCEPT(ex::RuntimeError,
"null column \"id\"");
563 p->getIds().push_back(data);
567 throw LSST_EXCEPT(ex::InvalidParameterError,
"Storage type is not supported");
574 throw LSST_EXCEPT(ex::RuntimeError,
"IdVectorFormatter: updates not supported");
Holds a pair of ids and the distance between the corresponding positions on the unit sphere...
std::vector< boost::int64_t > IdVector
A list of integer ids.
bool columnIsNull(int pos)
Interface for DbStorage class.
virtual void createTableFromTemplate(std::string const &tableName, std::string const &templateName, bool mayAlreadyExist=false)
virtual void setTableForQuery(std::string const &tableName, bool isExpr=false)
a container for holding hierarchical configuration data in memory.
virtual boost::archive::text_oarchive & getOArchive(void)
Miscellaneous helper methods.
std::vector< MatchPair > MatchPairVector
A list of MatchPair instances.
A persistable wrapper for a MatchPairVector.
Class for database storage.
A persistable wrapper for an IdPairVector.
lsst::daf::base::PropertySet PropertySet
virtual void insertRow(void)
Interface for DbTsvStorage class.
virtual void setTableForInsert(std::string const &tableName)
std::pair< boost::int64_t, boost::int64_t > IdPair
Holds a pair of ids.
std::vector< IdPair > IdPairVector
A list of IdPair instances.
void setColumn(std::string const &columnName, T const &value)
IdPairVector & getIdPairs()
virtual void insertRow(void)
void outParam(std::string const &columnName, T *location, bool isExpr=false)
void setColumn(std::string const &columnName, T const &value)
Master header file for the association pipeline.
Class for database storage with data loading from TSV files.
virtual boost::archive::text_iarchive & getIArchive(void)
#define LSST_EXCEPT(type,...)
MatchPairVector & getMatchPairs()
virtual void finishQuery(void)
Interface for Persistable base class.
Class for boost::serialization storage.
virtual void setTableForInsert(std::string const &tableName)
Interface for PropertySet class.
Base class for all persistable classes.
boost::shared_ptr< PropertySet > Ptr
virtual void createTableFromTemplate(std::string const &tableName, std::string const &templateName, bool mayAlreadyExist=false)
A persistable wrapper for an IdVector.
Persistable vectors for association pipeline results.
Include files required for standard LSST Exception handling.
Abstract base class for storage implementations.
Interface for BoostStorage class.