42 #ifndef CORE_DATATYPES_PROPERTYMANAGER_H
43 #define CORE_DATATYPES_PROPERTYMANAGER_H 1
70 virtual std::string dynamic_type_name()
const;
72 bool transient()
const {
return transient_; }
100 {
return new Property(obj_,
transient()); }
102 static const std::string
type_name(
int n = -1);
110 if (prop && obj_ == prop->obj_ )
119 if (prop && obj_ == prop->obj_ )
156 const std::string nm(
"Property");
182 Pio(stream, transient_);
206 template<
class T>
void set_property(
const std::string &,
const T &,
208 template<
class T>
bool get_property(
const std::string &, T &);
225 const std::map<std::string, PropertyBase *>&
properties()
const {
return properties_; }
238 return get_property(
"name", name) ? name : std::string();
243 typedef std::map<std::string, PropertyBase *> map_type;
244 map_type properties_;
262 std::cerr <<
"WARNING::PropertyManager must be frozen to store transient data"
263 <<
" freezing now!" << std::endl;
267 map_type::iterator loc = properties_.find(name);
268 if (loc != properties_.end())
283 map_type::iterator loc = properties_.find(name);
284 if (loc != properties_.end()) {
298 #endif // SCI_project_PropertyManager_h
virtual bool operator==(PropertyBase &) const
Definition: PropertyManager.h:75
specializations of template<class T> find_type_name() function for build-in and simple types not deri...
static PersistentTypeID type_id
Definition: PropertyManager.h:228
bool is_frozen() const
query frozen state of a PropertyManager.
Definition: PropertyManager.h:221
std::string get_property_name(size_t index)
Definition: PropertyManager.cc:230
Interface to dynamic 1D array class.
Definition: Persistent.h:89
const std::map< std::string, PropertyBase * > & properties() const
Definition: PropertyManager.h:225
virtual std::string dynamic_type_name() const
Definition: PropertyManager.cc:70
void set_property(const std::string &, const T &, bool is_transient)
Definition: PropertyManager.h:258
Definition: Persistent.h:187
const int PROPERTY_VERSION
Definition: PropertyManager.h:142
virtual void io(Piostream &)
Definition: PropertyManager.h:68
boost::mutex & get()
Definition: Mutex.h:49
#define SCISHARE
Definition: share.h:39
Utility for specifying data invariants (Assertions)
PropertyBase(bool trans)
Definition: PropertyManager.h:63
void remove_property(const std::string &)
Definition: PropertyManager.cc:253
virtual PropertyBase * clone() const
Definition: PropertyManager.h:99
bool operator==(const PropertyManager &pm)
Definition: PropertyManager.cc:140
virtual int begin_class(const std::string &name, int current_version)
Definition: Persistent.cc:143
bool get_property(const std::string &, T &)
Definition: PropertyManager.h:278
const string find_type_name(float *)
Definition: TypeName.cc:63
void copy_properties(const PropertyManager *src)
Definition: PropertyManager.cc:115
virtual void thaw()
thaw will remove all transient properties from the PropertyManager.
Definition: PropertyManager.cc:189
static PersistentTypeID type_id
Definition: PropertyManager.h:104
Core::Thread::Mutex lock
Definition: PropertyManager.h:252
void set_name(const std::string &name)
Definition: PropertyManager.h:231
const char * name[]
Definition: BoostGraphExampleTests.cc:87
size_t nproperties() const
Definition: PropertyManager.h:224
static PersistentTypeID type_id
Definition: PropertyManager.h:69
PropertyManager & operator=(const PropertyManager &pm)
Definition: PropertyManager.cc:104
bool transient_
Definition: PropertyManager.h:83
Definition: PropertyManager.h:91
Persistent i/o for STL containers.
std::string type
Definition: Persistent.h:72
static const std::string type_name(int n=-1)
Definition: PropertyManager.h:149
virtual void freeze()
– mutability –
Definition: PropertyManager.cc:207
virtual std::string dynamic_type_name() const
Definition: PropertyManager.h:105
Definition: PropertyManager.h:60
static const std::string make_template_id(const std::string &templateName, const std::string &templateParam)
Definition: TypeName.h:62
bool operator!=(const PropertyManager &pm)
Definition: PropertyManager.cc:174
Property(const T &o, bool trans)
Definition: PropertyManager.h:95
#define ASSERTFAIL(string)
Definition: Assert.h:52
void Pio(Piostream &stream, Array1< T > &array)
Definition: Array1.h:65
Property()
Definition: PropertyManager.h:128
virtual void end_class()
Definition: Persistent.cc:178
virtual ~Property()
Definition: PropertyManager.h:98
std::string get_name()
Definition: PropertyManager.h:235
virtual bool operator==(PropertyBase &pb) const
Definition: PropertyManager.h:107
virtual bool operator!=(PropertyBase &pb) const
Definition: PropertyManager.h:116
bool frozen_
Definition: PropertyManager.h:250
Definition: Persistent.h:64
int n
Definition: eab.py:9
boost::lock_guard< boost::mutex > Guard
Definition: Mutex.h:55
void clear_transient()
A frozen PropertyManager may store transient data.
Definition: PropertyManager.cc:266
virtual PropertyBase * clone() const
Definition: PropertyManager.h:64
bool is_property(const std::string &)
Definition: PropertyManager.cc:216
virtual void io(Piostream &stream)
Definition: PropertyManager.h:177
Definition: PropertyManager.h:193
virtual bool operator!=(PropertyBase &) const
Definition: PropertyManager.h:77
virtual ~PropertyManager()
Definition: PropertyManager.cc:180
void set_transient(bool t)
Definition: PropertyManager.h:73
void io(Piostream &stream)
Definition: PropertyManager.cc:290
PropertyManager()
Definition: PropertyManager.cc:73