Skip to content

Commit

Permalink
Remove inPlace
Browse files Browse the repository at this point in the history
It looks like we don't actually use the inPlace argument to the
PropertyList add and set methods anywhere in the stack besides the
daf_base unit tests. I think it was originally put in to accommodate the
addition of COMMENT and HISTORY items that might want to be placed at
the end of the PropertyList instead of grouped together, but the
implementation actually still groups all of these items together, just
at the end of the list instead of where they were.
  • Loading branch information
ktlim authored and timj committed Aug 4, 2016
1 parent 22b9da8 commit 4a41107
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 155 deletions.
67 changes: 28 additions & 39 deletions include/lsst/daf/base/PropertyList.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,84 +115,73 @@ class PropertyList : public PropertySet {

// Modifiers
template <typename T> void set(
std::string const& name, T const& value, bool inPlace=true);
std::string const& name, T const& value);
void set(
std::string const& name, PropertySet::Ptr const& value,
bool inPlace=true);
std::string const& name, PropertySet::Ptr const& value);
template <typename T> void set(
std::string const& name, std::vector<T> const& value,
bool inPlace=true);
std::string const& name, std::vector<T> const& value);
void set(
std::string const& name, char const* value, bool inPlace=true);
std::string const& name, char const* value);
template <typename T> void add(
std::string const& name, T const& value, bool inPlace=true);
std::string const& name, T const& value);
template <typename T> void add(
std::string const& name, std::vector<T> const& value,
bool inPlace=true);
std::string const& name, std::vector<T> const& value);
void add(
std::string const& name, char const* value, bool inPlace=true);
std::string const& name, char const* value);

template <typename T> void set(
std::string const& name, T const& value,
std::string const& comment, bool inPlace=true);
std::string const& comment);
template <typename T> void set(
std::string const& name, std::vector<T> const& value,
std::string const& comment, bool inPlace=true);
std::string const& comment);
void set(
std::string const& name, char const* value,
std::string const& comment, bool inPlace=true);
std::string const& comment);
template <typename T> void add(
std::string const& name, T const& value,
std::string const& comment, bool inPlace=true);
std::string const& comment);
template <typename T> void add(
std::string const& name, std::vector<T> const& value,
std::string const& comment, bool inPlace=true);
std::string const& comment);
void add(
std::string const& name, char const* value,
std::string const& comment, bool inPlace=true);
std::string const& comment);

template <typename T> void set(
std::string const& name, T const& value,
char const* comment, bool inPlace=true) {
set(name, value, std::string(comment), inPlace);
char const* comment) {
set(name, value, std::string(comment));
}
template <typename T> void set(
std::string const& name, std::vector<T> const& value,
char const* comment, bool inPlace=true) {
set(name, value, std::string(comment), inPlace);
char const* comment) {
set(name, value, std::string(comment));
}
void set(
std::string const& name, char const* value,
char const* comment, bool inPlace=true) {
set(name, value, std::string(comment), inPlace);
char const* comment) {
set(name, value, std::string(comment));
}
template <typename T> void add(
std::string const& name, T const& value,
char const* comment, bool inPlace=true) {
add(name, value, std::string(comment), inPlace);
char const* comment) {
add(name, value, std::string(comment));
}
template <typename T> void add(
std::string const& name, std::vector<T> const& value,
char const* comment, bool inPlace=true) {
add(name, value, std::string(comment), inPlace);
char const* comment) {
add(name, value, std::string(comment));
}
void add(
std::string const& name, char const* value,
char const* comment, bool inPlace=true) {
add(name, value, std::string(comment), inPlace);
}

virtual void copy(std::string const& dest, PropertySet::ConstPtr source,
std::string const& name) {
copy(dest, source, name, true);
}
virtual void combine(PropertySet::ConstPtr source) {
combine(source, true);
char const* comment) {
add(name, value, std::string(comment));
}

virtual void copy(std::string const& dest, PropertySet::ConstPtr source,
std::string const& name, bool inPlace);
virtual void combine(PropertySet::ConstPtr source, bool inPlace);
std::string const& name);
virtual void combine(PropertySet::ConstPtr source);

virtual void remove(std::string const& name);

Expand All @@ -205,7 +194,7 @@ class PropertyList : public PropertySet {
std::shared_ptr< std::vector<boost::any> > vp);
virtual void _moveToEnd(std::string const& name);
virtual void _commentOrderFix(
std::string const& name, std::string const& comment, bool inPlace);
std::string const& name, std::string const& comment);

CommentMap _comments;
std::list<std::string> _order;
Expand Down
11 changes: 4 additions & 7 deletions python/lsst/daf/base/baseLib.i
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,8 @@ del _PS_toDict
%extend lsst::daf::base::PropertyList {
static std::type_info const TYPE_ ## typeName = typeid(type);
void setPropertySet(
std::string const& name, PropertySet::Ptr const& value,
bool inPlace=true) {
$self->set(name, value, inPlace);
std::string const& name, PropertySet::Ptr const& value) {
$self->set(name, value);
}
}
%enddef
Expand Down Expand Up @@ -290,17 +289,15 @@ _PL_typeMenu = {bool: "Bool",

def _PL_getValue(self, name, asArray=False):
return _propertyContainerGet(self, name, asArray)
def _PL_setValue(self, name, value, comment=None, inPlace=True):
def _PL_setValue(self, name, value, comment=None):
args = []
if comment is not None:
args.append(comment)
args.append(inPlace)
return _propertyContainerSet(self, name, value, _PL_typeMenu, *args)
def _PL_addValue(self, name, value, comment=None, inPlace=True):
def _PL_addValue(self, name, value, comment=None):
args = []
if comment is not None:
args.append(comment)
args.append(inPlace)
return _propertyContainerAdd(self, name, value, _PL_typeMenu, *args)

PropertyList.get = _PL_getValue
Expand Down

0 comments on commit 4a41107

Please sign in to comment.