17 static std::map<const void*, bool> on_release_map;
18 auto iter = on_release_map.find(value_ptr);
19 if (access_mode ==
'q')
20 return iter == on_release_map.end() ? false : iter->second;
21 if (access_mode ==
's') {
22 if (iter == on_release_map.end())
23 on_release_map[value_ptr] =
true;
28 if (iter != on_release_map.end())
43std::map<const void*, abst_view*>& ref_view_map()
45 static std::map<const void*, abst_view*> view_map;
67 std::map<const void*, abst_view*>& vm = ref_view_map();
68 if (vm.find(ptr) == vm.end()) {
73 next_in_list = v->next_in_list;
75 v->next_in_list =
this;
77 next_in_list->prev_in_list =
this;
85 std::map<const void*, abst_view*>& vm = ref_view_map();
86 if (vm.find(ptr) == vm.end())
88 if (vm[ptr] ==
this) {
89 if (next_in_list == 0)
92 vm[ptr] = next_in_list;
93 next_in_list->prev_in_list = 0;
97 if (prev_in_list == 0) {
98 if (next_in_list == 0)
100 std::cerr <<
"ups, abst_view::detach_from_reference called for view that is not representative and has no previous element in list" << std::endl;
104 prev_in_list->next_in_list = next_in_list;
106 next_in_list->prev_in_list = prev_in_list;
109 next_in_list = prev_in_list = 0;
113void update_views(
void* member_ptr)
115 std::map<const void*, abst_view*>& vm = ref_view_map();
116 if (vm.find(member_ptr) != vm.end()) {
virtual void update()
this virtual update allows for example to ask a view to update the viewed value. The default implemen...
virtual bool controls(const void *ptr) const =0
return whether the control controls the value pointed to by ptr
static bool access_on_release(const void *value_ptr, char access_mode)
access on_release value for given value ptr to 'q'uery, 's'et or 'u'nset
static bool on_release(const void *value_ptr)
return whether value_change signal was sent due to a release event
bool shows(const void *ptr) const
add default implementation passing the query to the controls() method
abst_control(const std::string &name)
construct from name
type independent &base class of all views
void detach_from_reference()
detach view again
abst_view(const std::string &name)
pass name on to node, careful the implementation of this is in the source file control....
void update_views()
calls the update method of all other attached views
void attach_to_reference(const void *ptr)
links all views to a reference into a doubly linked list in order to allow controls of the reference ...
~abst_view()
ensures detachment of view