Smart-pointer implementation of vgui_parent_child_link. More...
Public Types | |
typedef vcl_set< void * > | all_t |
Public Member Functions | |
vgui_parent_child_link_impl (vgui_tableau *p_, vgui_tableau *c_) | |
~vgui_parent_child_link_impl () | |
void | assign (vgui_tableau *t) |
vgui_tableau * | parent () const |
vgui_tableau * | child () const |
void | acquire () |
void | release () |
Static Public Attributes | |
static all_t * | all = 0 |
static int | all_refs = -1 |
Static Private Member Functions | |
static void | link (vgui_tableau *p, vgui_tableau *c) |
static void | unlink (vgui_tableau *p, vgui_tableau *c) |
Private Attributes | |
vgui_tableau * | p |
vgui_tableau * | c |
int | use_count |
Smart-pointer implementation of vgui_parent_child_link.
This container holds a single pointer for every impl object. The pointers are cast to and from void* to avoid (a) exposing the implementation class and (b) instantiating an extra class template.
Implementation notes:
[1] Since tableaux will hold parent_child_links and use them to refer to children, each parent_child_link must ref()erence its child.
[2] A parent_child_link should not ref()erence its parent as that would lead to cyclic dependencies and hence core leaks. Thus, we use a raw pointer to hold the parent.
[3] A vgui_tableau_sptr could be used to hold the child, but there is no real advantage in that.
[4] A parent_child_link's parent pointer must never be zero because a parent_child_link which does not have a parent is a useless parent_child_link (and so is most likely an error). Thus 'p' is a private data member of vgui_parent_child_link_impl and the constructor will cause assertion failure if given a null parent pointer.
[5] A parent_child_link's parent pointer cannot be changed because there is no legitimate use for that.
Definition at line 56 of file vgui_parent_child_link.cxx.
typedef vcl_set<void *> vgui_parent_child_link_impl::all_t |
Definition at line 60 of file vgui_parent_child_link.cxx.
vgui_parent_child_link_impl::vgui_parent_child_link_impl | ( | vgui_tableau * | p_, |
vgui_tableau * | c_ | ||
) | [inline] |
Definition at line 132 of file vgui_parent_child_link.cxx.
vgui_parent_child_link_impl::~vgui_parent_child_link_impl | ( | ) | [inline] |
Definition at line 165 of file vgui_parent_child_link.cxx.
void vgui_parent_child_link_impl::acquire | ( | ) | [inline] |
Definition at line 96 of file vgui_parent_child_link.cxx.
void vgui_parent_child_link_impl::assign | ( | vgui_tableau * | t | ) | [inline] |
Definition at line 185 of file vgui_parent_child_link.cxx.
vgui_tableau* vgui_parent_child_link_impl::child | ( | ) | const [inline] |
Definition at line 72 of file vgui_parent_child_link.cxx.
void vgui_parent_child_link_impl::link | ( | vgui_tableau * | p, |
vgui_tableau * | c | ||
) | [inline, static, private] |
Definition at line 124 of file vgui_parent_child_link.cxx.
vgui_tableau* vgui_parent_child_link_impl::parent | ( | ) | const [inline] |
Definition at line 71 of file vgui_parent_child_link.cxx.
void vgui_parent_child_link_impl::release | ( | ) | [inline] |
Definition at line 101 of file vgui_parent_child_link.cxx.
void vgui_parent_child_link_impl::unlink | ( | vgui_tableau * | p, |
vgui_tableau * | c | ||
) | [inline, static, private] |
Definition at line 109 of file vgui_parent_child_link.cxx.
vcl_set< void * > * vgui_parent_child_link_impl::all = 0 [static] |
Definition at line 61 of file vgui_parent_child_link.cxx.
int vgui_parent_child_link_impl::all_refs = -1 [static] |
Definition at line 62 of file vgui_parent_child_link.cxx.
vgui_tableau* vgui_parent_child_link_impl::c [private] |
Definition at line 81 of file vgui_parent_child_link.cxx.
vgui_tableau* vgui_parent_child_link_impl::p [private] |
Definition at line 80 of file vgui_parent_child_link.cxx.
int vgui_parent_child_link_impl::use_count [private] |
Definition at line 82 of file vgui_parent_child_link.cxx.