cgv
ref_counted.h
1 #pragma once
2 
3 namespace cgv {
4  namespace data {
5 
6 class ref_ptr_tag;
7 
11 {
12 private:
14  mutable int ref_count;
15 protected:
16  friend class ref_ptr_tag;
18  inline ref_counted() : ref_count(0) {}
20  inline void set_ref_count(int c) const { ref_count = c; }
21 public:
23  inline int get_ref_count() const { return ref_count; }
24 };
25 
26  }
27 }
cgv::data::ref_counted::ref_counted
ref_counted()
constructor initializes the count to 0
Definition: ref_counted.h:18
cgv::data::ref_ptr_tag
struct used to make ref pointers to ref_counted friends of ref_counted
Definition: ref_ptr.h:23
cgv::data::ref_counted
Definition: ref_counted.h:11
cgv::data::ref_counted::get_ref_count
int get_ref_count() const
read access to current count
Definition: ref_counted.h:23
cgv::data::ref_counted::set_ref_count
void set_ref_count(int c) const
write access is also const to allow ref counted pointers to const instances
Definition: ref_counted.h:20
cgv
the cgv namespace
Definition: vr_calib.cxx:9