shared_ptr
design, discussed one of the the URLs listed below.There are a few guidelines for using proxies:
SmartProxy(void* object, ReturnCode.Type& returnCode)
. A root proxy contains the reference count of the underlying object. This means that if you construct multiple root proxies per underlying object, each root will see a difference reference count and one root will destroy the object before the other roots are done using it. SmartProxy.getCounter()
alongside the pointer and construct all future proxies using SmartProxy(RefCounter*)
instead.
http://en.wikipedia.org/wiki/Proxy_pattern
http://blogs.sun.com/nsolter/entry/reference_counting_smart_pointers_made
Public Types | |
typedef void(* | BoolConversion )() |
Public Member Functions | |
virtual UAPI_EXPORT Root * | getRoot () const |
virtual UAPI_EXPORT SmartProxy & | operator= (const SmartProxy &other) |
UAPI_EXPORT | operator BoolConversion () const |
virtual UAPI_EXPORT bool | operator! () const |
Protected Member Functions | |
UAPI_EXPORT | SmartProxy (void *object, const char *name) |
UAPI_EXPORT | SmartProxy (void *object, bool loggingAllowed, const char *name) |
UAPI_EXPORT | SmartProxy (Root *root) |
UAPI_EXPORT | SmartProxy (const SmartProxy &other) |
UAPI_EXPORT | SmartProxy () |
virtual UAPI_EXPORT | ~SmartProxy () |
virtual UAPI_EXPORT void | deleteObject (void *object) |
UAPI_EXPORT void * | getObject () const |
virtual UAPI_EXPORT void | onDestruction () |
Friends | |
class | System |
Classes | |
class | Root |
typedef void(* android.speech.recognition.SmartProxy.BoolConversion)() |
UAPI_EXPORT android.speech.recognition.SmartProxy.SmartProxy | ( | void * | object, | |
const char * | name | |||
) | [explicit, protected] |
Creates a root SmartProxy for the specified pointer. If construction fails then !proxy
will return true.
object | a pointer to a shared object |
UAPI_EXPORT android.speech.recognition.SmartProxy.SmartProxy | ( | void * | object, | |
bool | loggingAllowed, | |||
const char * | name | |||
) | [explicit, protected] |
Creates a root SmartProxy for the specified pointer. If construction fails then !proxy
will return true.
object | a pointer to a shared object | |
loggingAllowed | true if the object and its dependencies are allowed logging |
UAPI_EXPORT android.speech.recognition.SmartProxy.SmartProxy | ( | Root * | root | ) | [explicit, protected] |
Constructs a new SmartProxy from an existing root proxy. If construction fails then !proxy
will return true.
root | the root proxy |
UAPI_EXPORT android.speech.recognition.SmartProxy.SmartProxy | ( | const SmartProxy & | other | ) | [protected] |
Constructs a copy of an existing SmartProxy. If construction failed then !proxy
will return true.
UAPI_EXPORT android.speech.recognition.SmartProxy.SmartProxy | ( | ) | [protected] |
Enables the construction of arrays of proxies. The proxy is initialized to null.
virtual UAPI_EXPORT android.speech.recognition.SmartProxy.~SmartProxy | ( | ) | [protected, virtual] |
Destroys the SmartProxy.
virtual UAPI_EXPORT Root* android.speech.recognition.SmartProxy.getRoot | ( | ) | const [virtual] |
Returns the root proxy.
virtual UAPI_EXPORT SmartProxy& android.speech.recognition.SmartProxy.operator= | ( | const SmartProxy & | other | ) | [virtual] |
Causes the current SmartProxy to point to the same object as another SmartProxy. If the operation fails then !proxy
will return true.
other | the SmartProxy whose object to point to |
virtual UAPI_EXPORT bool android.speech.recognition.SmartProxy.operator! | ( | ) | const [virtual] |
virtual UAPI_EXPORT void android.speech.recognition.SmartProxy.deleteObject | ( | void * | object | ) | [protected, virtual] |
Deletes the underlying object. Subclasses must override this method as only they know the actual type of the underlying object.
object | the underlying object |
UAPI_EXPORT void* android.speech.recognition.SmartProxy.getObject | ( | ) | const [protected] |
Returns the underlying object.
virtual UAPI_EXPORT void android.speech.recognition.SmartProxy.onDestruction | ( | ) | [protected, virtual] |
Invoked by the SmartProxy destructor.