25#ifndef LSST_DAF_BASE_PROPERTYLIST
26#define LSST_DAF_BASE_PROPERTYLIST
51#include <unordered_map>
54#include "boost/any.hpp"
65#pragma warning(disable : 444)
101 template <typename T>
102 T
get(
std::
string const& name) const;
117 template <typename T>
118 T
get(
std::
string const& name, T const& defaultValue) const;
121 template <typename T>
137 std::list<
std::
string>::const_iterator
begin() const;
140 std::list<
std::
string>::const_iterator
end() const;
143 virtual
std::
string toString(
bool topLevelOnly = false,
std::
string const& indent =
"") const;
148 template <typename T>
149 void set(
std::
string const& name, T const& value);
166 template <typename T>
167 void set(
std::
string const& name,
std::vector<T> const& value);
170 void set(
std::
string const& name,
char const* value);
173 template <typename T>
174 void add(
std::
string const& name, T const& value);
177 template <typename T>
178 void add(
std::
string const& name,
std::vector<T> const& value);
181 void add(
std::
string const& name,
char const* value);
191 template <typename T>
192 void set(
std::
string const& name, T const& value,
std::
string const& comment);
202 template <typename T>
203 void set(
std::
string const& name,
std::vector<T> const& value,
std::
string const& comment);
213 void set(
std::
string const& name,
char const* value,
std::
string const& comment);
223 template <typename T>
224 void add(
std::
string const& name, T const& value,
std::
string const& comment);
234 template <typename T>
235 void add(
std::
string const& name,
std::vector<T> const& value,
std::
string const& comment);
245 void add(
std::
string const& name,
char const* value,
std::
string const& comment);
248 template <typename T>
249 void set(
std::
string const& name, T const& value,
char const* comment) {
254 template <
typename T>
265 template <
typename T>
270 template <
typename T>
283 bool asScalar =
false);
302 CommentMap _comments;
std::list< std::string >::const_iterator end() const
End iterator over the list of property names, in the order they were added.
void set(std::string const &name, std::vector< T > const &value, char const *comment)
Version of set vector value that accepts a comment.
PropertyList()
Construct an empty PropertyList.
std::shared_ptr< PropertyList > Ptr
void set(std::string const &name, T const &value)
Replace all values for a property name (possibly hierarchical) with a new scalar value.
T get(std::string const &name) const
Get the last value for a property name (possibly hierarchical).
void add(std::string const &name, T const &value, char const *comment)
Version of add scalar value that accepts a comment.
virtual std::shared_ptr< PropertySet > deepCopy() const
Make a deep copy of the PropertyList and all of its contents.
void add(std::string const &name, T const &value)
Append a single value to the vector of values for a property name (possibly hierarchical).
void add(std::string const &name, std::vector< T > const &value, char const *comment)
Version of add vector value that accepts a comment.
std::shared_ptr< PropertyList const > ConstPtr
std::string const & getComment(std::string const &name) const
Get the comment for a string property name (possibly hierarchical).
std::vector< T > getArray(std::string const &name) const
Get the vector of values for a property name (possibly hierarchical).
std::vector< std::string > getOrderedNames() const
Get the list of property names, in the order they were added.
void add(std::string const &name, char const *value, char const *comment)
Version of add char* value that accepts a comment.
virtual ~PropertyList() noexcept
Destructor.
virtual std::string toString(bool topLevelOnly=false, std::string const &indent="") const
Generate a string representation of the PropertySet.
std::list< std::string >::const_iterator begin() const
Begin iterator over the list of property names, in the order they were added.
void set(std::string const &name, char const *value, char const *comment)
Version of set char* value that accepts a comment.
Class for storing generic metadata.
PropertySet(bool flat=false)
Construct an empty PropertySet.