25 #ifndef LSST_DAF_BASE_PROPERTYSET
26 #define LSST_DAF_BASE_PROPERTYSET
60 #include "boost/any.hpp"
61 #include "boost/noncopyable.hpp"
62 #include "boost/shared_ptr.hpp"
70 namespace persistence {
71 class PropertySetFormatter;
78 #pragma warning (push)
79 #pragma warning (disable: 444)
85 ,
public boost::noncopyable
90 typedef boost::shared_ptr<PropertySet>
Ptr;
91 typedef boost::shared_ptr<PropertySet const>
ConstPtr;
101 size_t nameCount(
bool topLevelOnly =
true)
const;
102 std::vector<std::string>
names(
bool topLevelOnly =
true)
const;
103 std::vector<std::string>
paramNames(
bool topLevelOnly =
true)
const;
111 std::type_info
const&
typeOf(std::string
const&
name)
const;
116 template <
typename T> T
get(std::string
const&
name)
const;
119 template <
typename T>
120 T
get(std::string
const&
name, T
const& defaultValue)
const;
122 template <
typename T>
135 virtual std::string
toString(
bool topLevelOnly =
false,
136 std::string
const& indent =
"")
const;
139 template <
typename T>
void set(std::string
const&
name, T
const& value);
140 template <
typename T>
void set(std::string
const&
name,
141 std::vector<T>
const& value);
142 void set(std::string
const&
name,
char const* value);
143 template <
typename T>
void add(std::string
const&
name, T
const& value);
144 template <
typename T>
void add(std::string
const&
name,
145 std::vector<T>
const& value);
146 void add(std::string
const&
name,
char const* value);
148 virtual void copy(std::string
const& dest,
ConstPtr source,
149 std::string
const&
name);
154 virtual void remove(std::string
const&
name);
157 virtual void _set(std::string
const&
name,
158 boost::shared_ptr< std::vector<boost::any> > vp);
159 virtual void _add(std::string
const&
name,
160 boost::shared_ptr< std::vector<boost::any> > vp);
161 virtual std::string
_format(std::string
const&
name)
const;
166 typedef std::tr1::unordered_map<std::
string,
169 AnyMap::iterator
_find(std::
string const&
name);
170 AnyMap::const_iterator
_find(std::
string const& name) const;
172 boost::shared_ptr< std::vector<boost::
any> > vp);
175 std::
string const& name);
183 #pragma warning (pop)
186 template<>
void PropertySet::add<PropertySet::Ptr>(
187 std::string
const&
name,
Ptr const& value);
188 template<>
void PropertySet::add<PropertySet::Ptr>(
189 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
void _cycleCheckPtr(Ptr const &v, std::string const &name)
table::Key< std::string > name
virtual void _add(std::string const &name, boost::shared_ptr< std::vector< boost::any > > vp)
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
Include files required for standard LSST Exception handling.
virtual void copy(std::string const &dest, ConstPtr source, std::string const &name)
void _cycleCheckPtrVec(std::vector< Ptr > const &v, std::string const &name)
boost::shared_ptr< PropertySet > Ptr
boost::shared_ptr< PropertySet const > ConstPtr
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
std::tr1::unordered_map< std::string, boost::shared_ptr< std::vector< boost::any > > > AnyMap
bool any(CoordinateExpr< N > const &expr)
Return true if any elements are true.
int getAsInt(std::string const &name) const
virtual void combine(ConstPtr source)
boost::shared_ptr< Persistable > Ptr
virtual std::string _format(std::string const &name) const
PropertySet::Ptr getAsPropertySetPtr(std::string const &name) const
#define LSST_PERSIST_FORMATTER(formatter...)
virtual void _findOrInsert(std::string const &name, boost::shared_ptr< std::vector< boost::any > > vp)
Interface for Persistable base class.
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
virtual void _set(std::string const &name, boost::shared_ptr< std::vector< boost::any > > vp)
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)
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