45 #ifndef CLIPPER_MEMORY
46 #define CLIPPER_MEMORY
49 #include "clipper_thread.h"
69 explicit Property(
const T& val ) { val_ = val; }
72 const T&
value()
const {
return val_; }
110 std::vector<std::pair<std::string,Property_base*> > property_;
160 void operator =(
const Reference& other );
161 bool is_null()
const {
return obj_ == NULL; }
162 const T& data()
const {
return obj_->second; }
164 std::pair<int,T>* obj_;
166 Reference( std::pair<int,T>* obj ) { obj_ = obj; obj_->first++; }
171 enum MODE { NORMAL, MINMEM, MAXMEM };
179 Reference
cache(
const typename T::Key& key );
181 std::vector<std::pair<int,T>*> cache_;
bool exists_property(const std::string &label) const
test for property
Definition: clipper_memory.cpp:112
~PropertyManager()
destructor
Definition: clipper_memory.cpp:60
PropertyManager & operator=(const PropertyManager &mgr)
assign op
Definition: clipper_memory.cpp:56
bool set_property(const std::string &label, const Property_base &property)
add a labelled property to the list
Definition: clipper_memory.cpp:85
Reference cache(const typename T::Key &key)
cache or return data by key
Definition: clipper_instance.cpp:91
Object Cache manager.
Definition: clipper_memory.h:150
const Property_base & get_property(const std::string &label) const
get a labelled property from the list
Definition: clipper_memory.cpp:95
bool delete_property(const std::string &label)
delete property
Definition: clipper_memory.cpp:127
ObjectCache reference class.
Definition: clipper_memory.h:154
void destroy()
VERY DANGEROUS, DO NOT USE.
Definition: clipper_instance.cpp:134
PropertyManager & copy(const PropertyManager &mgr)
copy manager
Definition: clipper_memory.cpp:70
Property(const T &val)
constructor: takes contents
Definition: clipper_memory.h:69
void purge()
purge unreferenced objects from cache
Definition: clipper_instance.cpp:125
Template for a property holding an arbitrary type.
Definition: clipper_memory.h:65
void set_mode(const MODE &mode)
set garbage collection mode
Definition: clipper_instance.cpp:122
~ObjectCache()
destructor, can message on contents
Definition: clipper_instance.cpp:77
Base class for properties of arbitrary types.
Definition: clipper_memory.h:57
Property_base * clone() const
factory copy method
Definition: clipper_memory.h:71
virtual Property_base * clone() const =0
factory copy method
const T & value() const
return value of contents
Definition: clipper_memory.h:72
Class for holding a list of labelled properties of arbitrary types.
Definition: clipper_memory.h:95
PropertyManager()
null constructor
Definition: clipper_memory.h:98
ObjectCache()
constructor
Definition: clipper_instance.cpp:74