25 #ifndef LSST_DAF_BASE_PROPERTYSET
26 #define LSST_DAF_BASE_PROPERTYSET
58 #include <unordered_map>
61 #include "boost/any.hpp"
70 namespace persistence {
71 class PropertySetFormatter;
78 #pragma warning (push)
79 #pragma warning (disable: 444)
85 typedef std::shared_ptr<PropertySet>
Ptr;
86 typedef std::shared_ptr<PropertySet const>
ConstPtr;
105 size_t nameCount(
bool topLevelOnly =
true)
const;
106 std::vector<std::string>
names(
bool topLevelOnly =
true)
const;
107 std::vector<std::string>
paramNames(
bool topLevelOnly =
true)
const;
115 std::type_info
const&
typeOf(std::string
const&
name)
const;
120 template <
typename T> T
get(std::string
const&
name)
const;
123 template <
typename T>
124 T
get(std::string
const&
name, T
const& defaultValue)
const;
126 template <
typename T>
139 virtual std::string
toString(
bool topLevelOnly =
false,
140 std::string
const& indent =
"")
const;
143 template <
typename T>
void set(std::string
const&
name, T
const& value);
144 template <
typename T>
void set(std::string
const&
name,
145 std::vector<T>
const& value);
146 void set(std::string
const&
name,
char const* value);
147 template <
typename T>
void add(std::string
const&
name, T
const& value);
148 template <
typename T>
void add(std::string
const&
name,
149 std::vector<T>
const& value);
150 void add(std::string
const&
name,
char const* value);
152 virtual void copy(std::string
const& dest,
ConstPtr source,
153 std::string
const&
name);
158 virtual void remove(std::string
const&
name);
161 virtual void _set(std::string
const&
name,
162 std::shared_ptr< std::vector<boost::any> > vp);
163 virtual void _add(std::string
const&
name,
164 std::shared_ptr< std::vector<boost::any> > vp);
165 virtual std::string
_format(std::string
const&
name)
const;
170 typedef std::unordered_map<std::
string,
173 AnyMap::iterator
_find(std::
string const&
name);
174 AnyMap::const_iterator
_find(std::
string const& name) const;
176 std::shared_ptr< std::vector<boost::
any> > vp);
179 std::
string const& name);
187 #pragma warning (pop)
190 template<>
void PropertySet::add<PropertySet::Ptr>(
191 std::string
const&
name,
Ptr const& value);
192 template<>
void PropertySet::add<PropertySet::Ptr>(
193 std::string
const&
name, std::vector<Ptr>
const& value);
bool getAsBool(std::string const &name) const
std::vector< std::string > paramNames(bool topLevelOnly=true) const
std::shared_ptr< PropertySet > Ptr
void _cycleCheckPtr(Ptr const &v, std::string const &name)
#define LSST_PERSIST_FORMATTER(formatter...)
table::Key< std::string > name
Interface for Persistable base class.
int64_t getAsInt64(std::string const &name) const
Persistable::Ptr getAsPersistablePtr(std::string const &name) const
bool isPropertySetPtr(std::string const &name) const
size_t nameCount(bool topLevelOnly=true) const
std::vector< std::string > propertySetNames(bool topLevelOnly=true) const
virtual void _add(std::string const &name, std::shared_ptr< std::vector< boost::any > > vp)
virtual void copy(std::string const &dest, ConstPtr source, std::string const &name)
void _cycleCheckPtrVec(std::vector< Ptr > const &v, std::string const &name)
std::shared_ptr< PropertySet const > ConstPtr
PropertySet & operator=(const PropertySet &)=delete
PropertySet(bool flat=false)
void set(std::string const &name, T const &value)
std::vector< std::string > names(bool topLevelOnly=true) const
size_t valueCount(std::string const &name) const
bool isArray(std::string const &name) const
bool any(CoordinateExpr< N > const &expr)
Return true if any elements are true.
int getAsInt(std::string const &name) const
std::unordered_map< std::string, std::shared_ptr< std::vector< boost::any > > > AnyMap
virtual void combine(ConstPtr source)
virtual std::string _format(std::string const &name) const
PropertySet::Ptr getAsPropertySetPtr(std::string const &name) const
virtual void _set(std::string const &name, std::shared_ptr< std::vector< boost::any > > vp)
std::type_info const & typeOf(std::string const &name) const
double getAsDouble(std::string const &name) const
Class for storing generic metadata.
virtual Ptr deepCopy(void) const
virtual std::string toString(bool topLevelOnly=false, std::string const &indent="") const
std::string getAsString(std::string const &name) const
std::shared_ptr< Persistable > Ptr
virtual ~PropertySet(void)
Base class for all persistable classes.
void _cycleCheckAnyVec(std::vector< boost::any > const &v, std::string const &name)
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
AnyMap::iterator _find(std::string const &name)
virtual void _findOrInsert(std::string const &name, std::shared_ptr< std::vector< boost::any > > vp)
Include files required for standard LSST Exception handling.
void add(std::string const &name, T const &value)
std::vector< T > getArray(std::string const &name) const
bool exists(std::string const &name) const