46 template<
typename Type>
57 template<
typename Type>
67 : object(object), generation(-1)
72 : object(new
Resource_Impl<Type>(initial_value)), generation(-1)
78 return &
object->value;
83 return &
object->value;
88 bool updated = (generation !=
object->generation);
89 generation =
object->generation;
93 void set(
const Type &value)
95 object->value = value;
96 generation = ++
object->generation;
101 return object->value;
106 return object->value;
109 operator Type&() {
return object->value;}
110 operator const Type&()
const {
return object->value;}
112 const std::shared_ptr<Resource_Impl<Type> > &
handle()
const {
return object; }
122 std::shared_ptr<Resource_Impl<Type> > object;
Definition: resource.h:41
int generation
Definition: resource.h:53
bool operator>(const Resource &other) const
Definition: resource.h:116
Resource_Impl(const Type &initial_value)
Definition: resource.h:51
bool updated()
Definition: resource.h:86
bool operator>=(const Resource &other) const
Definition: resource.h:117
Resource()
Definition: resource.h:61
virtual ~Resource_BaseImpl()
Definition: resource.h:43
Type * operator->()
Definition: resource.h:76
Resource_Impl()
Definition: resource.h:50
bool operator!=(const Resource &other) const
Definition: resource.h:119
Resource(const Type &initial_value)
Definition: resource.h:71
const Type * operator->() const
Definition: resource.h:81
void set(const Type &value)
Definition: resource.h:93
bool operator<=(const Resource &other) const
Definition: resource.h:115
const Type & get() const
Definition: resource.h:104
Type value
Definition: resource.h:52
bool operator<(const Resource &other) const
Definition: resource.h:114
Resource(std::shared_ptr< Resource_Impl< Type > > object)
Definition: resource.h:66
const std::shared_ptr< Resource_Impl< Type > > & handle() const
Definition: resource.h:112
Resource proxy of a specific type.
Definition: resource.h:59
bool operator==(const Resource &other) const
Definition: resource.h:118
Type & get()
Definition: resource.h:99
Definition: resource.h:48