45 template<
typename Type>
56 template<
typename Type>
66 : object(object), generation(-1)
71 : object(new
Resource_Impl<Type>(initial_value)), generation(-1)
77 return &
object->value;
82 return &
object->value;
87 bool updated = (generation !=
object->generation);
88 generation =
object->generation;
92 void set(
const Type &value)
94 object->value = value;
95 generation = ++
object->generation;
100 return object->value;
105 return object->value;
108 operator Type&() {
return object->value; }
109 operator const Type&()
const {
return object->value; }
111 const std::shared_ptr<Resource_Impl<Type> > &
handle()
const {
return object; }
121 std::shared_ptr<Resource_Impl<Type> >
object;
virtual ~Resource_BaseImpl()
Definition resource.h:42
Resource_Impl(const Type &initial_value)
Definition resource.h:50
Type value
Definition resource.h:51
Resource_Impl()
Definition resource.h:49
int generation
Definition resource.h:52
bool operator<=(const Resource &other) const
Definition resource.h:114
bool operator>=(const Resource &other) const
Definition resource.h:116
Type & get()
Definition resource.h:98
const Type & get() const
Definition resource.h:103
const std::shared_ptr< Resource_Impl< Type > > & handle() const
Definition resource.h:111
bool operator==(const Resource &other) const
Definition resource.h:117
Resource()
Definition resource.h:60
bool updated()
Definition resource.h:85
void set(const Type &value)
Definition resource.h:92
bool operator<(const Resource &other) const
Definition resource.h:113
Type * operator->()
Definition resource.h:75
bool operator!=(const Resource &other) const
Definition resource.h:118
Resource(const Type &initial_value)
Definition resource.h:70
const Type * operator->() const
Definition resource.h:80
bool operator>(const Resource &other) const
Definition resource.h:115
Resource(std::shared_ptr< Resource_Impl< Type > > object)
Definition resource.h:65
@ object
Definition json_value.h:50