Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

afw rename daf::persistence::Storage to StorageFormatter #196

Merged
merged 3 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/lsst/afw/detection/PsfFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "lsst/daf/base/Persistable.h"
#include "lsst/daf/persistence/Formatter.h"
#include "lsst/daf/persistence/Storage.h"
#include "lsst/daf/persistence/FormatterStorage.h"
#include "lsst/pex/policy/Policy.h"

namespace lsst {
Expand All @@ -25,14 +25,14 @@ class PsfFormatter : public lsst::daf::persistence::Formatter {
virtual ~PsfFormatter(void);

virtual void write(lsst::daf::base::Persistable const* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::Storage> storage,
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

virtual void update(lsst::daf::base::Persistable* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

/** Serialize a Psf to a Boost archive. Handles text or XML
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/formatters/DecoratedImageFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class DecoratedImageFormatter : public lsst::daf::persistence::Formatter {
virtual ~DecoratedImageFormatter(void);

virtual void write(lsst::daf::base::Persistable const* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::Storage> storage,
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual void update(lsst::daf::base::Persistable* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

static std::shared_ptr<lsst::daf::persistence::Formatter> createInstance(
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/formatters/ExposureFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class ExposureFormatter : public lsst::daf::persistence::Formatter {
virtual ~ExposureFormatter(void);

virtual void write(lsst::daf::base::Persistable const* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::Storage> storage,
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual void update(lsst::daf::base::Persistable* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

static std::shared_ptr<lsst::daf::persistence::Formatter> createInstance(
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/formatters/ImageFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class ImageFormatter : public lsst::daf::persistence::Formatter {
virtual ~ImageFormatter(void);

virtual void write(lsst::daf::base::Persistable const* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::Storage> storage,
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual void update(lsst::daf::base::Persistable* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

static std::shared_ptr<lsst::daf::persistence::Formatter> createInstance(
Expand Down
8 changes: 4 additions & 4 deletions include/lsst/afw/formatters/KernelFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <lsst/afw/math/Kernel.h>
#include <lsst/daf/base/Persistable.h>
#include <lsst/daf/persistence/Formatter.h>
#include <lsst/daf/persistence/Storage.h>
#include <lsst/daf/persistence/FormatterStorage.h>
#include <lsst/pex/policy/Policy.h>

namespace lsst {
Expand All @@ -49,14 +49,14 @@ class KernelFormatter : public lsst::daf::persistence::Formatter {
virtual ~KernelFormatter(void);

virtual void write(lsst::daf::base::Persistable const* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::Storage> storage,
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

virtual void update(lsst::daf::base::Persistable* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

/** Serialize a Kernel to a Boost archive. Handles text or XML
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/formatters/MaskFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class MaskFormatter : public lsst::daf::persistence::Formatter {
virtual ~MaskFormatter(void);

virtual void write(lsst::daf::base::Persistable const* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::Storage> storage,
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual void update(lsst::daf::base::Persistable* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

static std::shared_ptr<lsst::daf::persistence::Formatter> createInstance(
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/formatters/MaskedImageFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ class MaskedImageFormatter : public lsst::daf::persistence::Formatter {
virtual ~MaskedImageFormatter(void);

virtual void write(lsst::daf::base::Persistable const* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::Storage> storage,
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual void update(lsst::daf::base::Persistable* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

static std::shared_ptr<lsst::daf::persistence::Formatter> createInstance(
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/formatters/PropertyListFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ class PropertyListFormatter : public daf::persistence::Formatter {
virtual ~PropertyListFormatter() {}

virtual void write(daf::base::Persistable const* persistable,
std::shared_ptr<daf::persistence::Storage> storage,
std::shared_ptr<daf::persistence::FormatterStorage> storage,
std::shared_ptr<daf::base::PropertySet> additionalData);

virtual daf::base::Persistable* read(std::shared_ptr<daf::persistence::Storage> storage,
virtual daf::base::Persistable* read(std::shared_ptr<daf::persistence::FormatterStorage> storage,
std::shared_ptr<daf::base::PropertySet> additionalData);

virtual void update(daf::base::Persistable* persistable,
std::shared_ptr<daf::persistence::Storage> storage,
std::shared_ptr<daf::persistence::FormatterStorage> storage,
std::shared_ptr<daf::base::PropertySet> additionalData);

static std::shared_ptr<daf::persistence::Formatter> createInstance(
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/formatters/TanWcsFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ class TanWcsFormatter : public lsst::daf::persistence::Formatter {
virtual ~TanWcsFormatter(void);

virtual void write(lsst::daf::base::Persistable const* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::Storage> storage,
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual void update(lsst::daf::base::Persistable* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

static std::shared_ptr<lsst::daf::base::PropertyList> generatePropertySet(
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/formatters/WcsFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ class WcsFormatter : public lsst::daf::persistence::Formatter {
virtual ~WcsFormatter(void);

virtual void write(lsst::daf::base::Persistable const* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::Storage> storage,
virtual lsst::daf::base::Persistable* read(std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);
virtual void update(lsst::daf::base::Persistable* persistable,
std::shared_ptr<lsst::daf::persistence::Storage> storage,
std::shared_ptr<lsst::daf::persistence::FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet> additionalData);

static std::shared_ptr<lsst::daf::base::PropertyList> generatePropertySet(
Expand Down
16 changes: 14 additions & 2 deletions python/lsst/afw/display/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,20 @@ def __exit__(self, *args):
def __del__(self):
self.close()

def __getattr__(self, name, *args, **kwargs):
"""Try to call self._impl.name(*args, *kwargs)"""
def __getattr__(self, name):
"""Return the attribute of self._impl, or ._impl if it is requested
Parameters:
-----------
name : string
name of the attribute requested
Returns:
--------
attribute : object
the attribute of self._impl for the requested name
"""

if name == '_impl':
return object.__getattr__(self, name)

if not (hasattr(self, "_impl") and self._impl):
raise AttributeError("Device has no _impl attached")
Expand Down
10 changes: 5 additions & 5 deletions src/detection/PsfFormatter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ PsfFormatter::PsfFormatter(std::shared_ptr<pexPolicy::Policy> policy)
PsfFormatter::~PsfFormatter(void) {}

void PsfFormatter::write(dafBase::Persistable const* persistable,
std::shared_ptr<dafPersist::Storage> storage,
std::shared_ptr<dafPersist::FormatterStorage> storage,
std::shared_ptr<dafBase::PropertySet>) {
LOGL_DEBUG(_log, "PsfFormatter write start");
Psf const* ps = dynamic_cast<Psf const*>(persistable);
Expand All @@ -62,10 +62,10 @@ void PsfFormatter::write(dafBase::Persistable const* persistable,
LOGL_DEBUG(_log, "PsfFormatter write end");
return;
}
throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized Storage for Psf");
throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized FormatterStorage for Psf");
}

dafBase::Persistable* PsfFormatter::read(std::shared_ptr<dafPersist::Storage> storage,
dafBase::Persistable* PsfFormatter::read(std::shared_ptr<dafPersist::FormatterStorage> storage,
std::shared_ptr<dafBase::PropertySet>) {
LOGL_DEBUG(_log, "PsfFormatter read start");
Psf* ps;
Expand All @@ -82,10 +82,10 @@ dafBase::Persistable* PsfFormatter::read(std::shared_ptr<dafPersist::Storage> st
LOGL_DEBUG(_log, "PsfFormatter read end");
return ps;
}
throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized Storage for Psf");
throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized FormatterStorage for Psf");
}

void PsfFormatter::update(dafBase::Persistable*, std::shared_ptr<dafPersist::Storage>,
void PsfFormatter::update(dafBase::Persistable*, std::shared_ptr<dafPersist::FormatterStorage>,
std::shared_ptr<dafBase::PropertySet>) {
throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unexpected call to update for Psf");
}
Expand Down
12 changes: 6 additions & 6 deletions src/formatters/DecoratedImageFormatter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ using lsst::daf::base::Persistable;
using lsst::daf::persistence::BoostStorage;
using lsst::daf::persistence::XmlStorage;
using lsst::daf::persistence::FitsStorage;
using lsst::daf::persistence::Storage;
using lsst::daf::persistence::FormatterStorage;
using lsst::afw::image::DecoratedImage;

namespace lsst {
Expand Down Expand Up @@ -108,7 +108,7 @@ DecoratedImageFormatter<ImagePixelT>::~DecoratedImageFormatter(void) {}

template <typename ImagePixelT>
void DecoratedImageFormatter<ImagePixelT>::write(Persistable const* persistable,
std::shared_ptr<Storage> storage,
std::shared_ptr<FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet>) {
LOGL_DEBUG(_log, "DecoratedImageFormatter write start");
DecoratedImage<ImagePixelT> const* ip = dynamic_cast<DecoratedImage<ImagePixelT> const*>(persistable);
Expand Down Expand Up @@ -139,11 +139,11 @@ void DecoratedImageFormatter<ImagePixelT>::write(Persistable const* persistable,
LOGL_DEBUG(_log, "DecoratedImageFormatter write end");
return;
}
throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized Storage for DecoratedImage");
throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized FormatterStorage for DecoratedImage");
}

template <typename ImagePixelT>
Persistable* DecoratedImageFormatter<ImagePixelT>::read(std::shared_ptr<Storage> storage,
Persistable* DecoratedImageFormatter<ImagePixelT>::read(std::shared_ptr<FormatterStorage> storage,
std::shared_ptr<lsst::daf::base::PropertySet>) {
LOGL_DEBUG(_log, "DecoratedImageFormatter read start");
if (typeid(*storage) == typeid(BoostStorage)) {
Expand Down Expand Up @@ -171,12 +171,12 @@ Persistable* DecoratedImageFormatter<ImagePixelT>::read(std::shared_ptr<Storage>
LOGL_DEBUG(_log, "DecoratedImageFormatter read end");
return ip;
}
throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized Storage for DecoratedImage");
throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unrecognized FormatterStorage for DecoratedImage");
}

template <typename ImagePixelT>
void DecoratedImageFormatter<ImagePixelT>::update(lsst::daf::base::Persistable*,
std::shared_ptr<lsst::daf::persistence::Storage>,
std::shared_ptr<lsst::daf::persistence::FormatterStorage>,
std::shared_ptr<lsst::daf::base::PropertySet>) {
throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError, "Unexpected call to update for DecoratedImage");
}
Expand Down