ubit
Protected Member Functions | List of all members
ubit::UPtr Class Reference

Smart Pointer for UObject instances. More...

#include <uobject.hpp>

Inheritance diagram for ubit::UPtr:
ubit::uptr< CC > ubit::uptr< class ubit::UEdit > ubit::uptr< class ubit::UMenu > ubit::uptr< class ubit::UPosControl > ubit::uptr< const ubit::UColor > ubit::uptr< const ubit::UStr > ubit::uptr< const UColor > ubit::uptr< Macro > ubit::uptr< U3Dbox > ubit::uptr< ubit::U3Dpos > ubit::uptr< ubit::UAlertbox > ubit::uptr< ubit::UAttr > ubit::uptr< ubit::UBox > ubit::uptr< ubit::UButton > ubit::uptr< ubit::UCall > ubit::uptr< ubit::UChoice > ubit::uptr< ubit::UColor > ubit::uptr< ubit::UCtlmenu > ubit::uptr< ubit::UDialog > ubit::uptr< ubit::UDoc > ubit::uptr< ubit::UDocbox > ubit::uptr< ubit::UElem > ubit::uptr< ubit::UErrorHandler > ubit::uptr< ubit::UFinderDir > ubit::uptr< ubit::UFloat > ubit::uptr< ubit::UFont > ubit::uptr< ubit::UHspacing > ubit::uptr< ubit::UIconbox > ubit::uptr< ubit::UIma > ubit::uptr< ubit::UInt > ubit::uptr< ubit::UListbox > ubit::uptr< ubit::UNode > ubit::uptr< ubit::UPanAction > ubit::uptr< ubit::UPos > ubit::uptr< ubit::UPosControl > ubit::uptr< ubit::UScale > ubit::uptr< ubit::UScrollpane > ubit::uptr< ubit::USize > ubit::uptr< ubit::USizeControl > ubit::uptr< ubit::UStr > ubit::uptr< ubit::UTextfield > ubit::uptr< ubit::UTimer > ubit::uptr< ubit::UVspacing > ubit::uptr< ubit::UZoomAction > ubit::uptr< ubit::UZoommenu > ubit::uptr< UBox > ubit::uptr< UButton > ubit::uptr< ULabel > ubit::uptr< UPosControl > ubit::uptr< UShape > ubit::uptr< UStr >

Protected Member Functions

void deferenceError () const
 

Detailed Description

Smart Pointer for UObject instances.

All classes that derive from UObject support UPtr SMART POINTERS (SP), which provide automatic memory management (based on reference counting). UObject(s) are automatically deleted when nothing reference them, i.e. when the last reference from a UPtr or from anoher UObject is removed.

UPtr is the base class for upr<> templates as shown in the examples below:

   uptr<UBox> box = new UBox();             // 'box' is a Ubit Smart Pointer
   uptr<UButton> btn = ubutton("Do It!");   // ubutton() == *new UButton()
   box->add(*btn);                    // the UButton is a child of the UBox
   box = null;  // destroys this UBox because it has no parent and no other
                // uptr<> pointing to it (its UButton child is not destroyed 
                // because 'btn' points to it)
   btn = null;  // destroys this UBox because it has no parent and no other
                // uptr<> pointing to it.

NOTES:

See also
: class UObject and the uptr<> template.

The documentation for this class was generated from the following files: