Inheritance diagram for SPtr:
Public Methods | |
SPtr () | |
SPtr (T *in) | |
SPtr (const char *classID, bool factory=false) | |
SPtr (const SRef< T > &in) | |
SPtr (const SPtr< T > &in) | |
~SPtr () | |
void | release () |
void | createInstance (const char *classID, IBase *reserved=NULL) |
operator T *& () const | |
T * | operator-> () const |
T * | operator= (T *in) |
T * | operator= (const SPtr< T > &in) |
T * | operator= (const SRef< T > &in) |
bool | operator< (const SPtr< T > &in) const |
template<class U> bool | operator== (const SPtr< U > &in) const |
template<class U> bool | operator!= (const SPtr< U > &in) const |
T * | detach () |
T * | getRef () |
T * | ptr () const |
SPtr
class and the reference count of the plug-in, the latter being accessed through the IBase::addRef
and IBase::release
member functions. The high level model of the SPtr is that it adds a reference to a component in its constructor, and releases it in the destructor. However, it also has member functions that allow it to work properly as the target in an output parameter, and the assignee in an SRef return value. There are constructors that accomplish various tasks within the plug-in system (see individual descriptions), and operators for testing and comparisons (again, see individual descriptions).
It is highly reccommended that clients use either an SPtr or SQPtr (see below) to hold pointers to interfaces. Among the advantages of using the smart pointer classes is the fact that they clean up the references to any outstanding plug-in interfaces in the case of an exception being thrown through or out of the function holding the interface pointer(s).
|
This is the default constructor for the |
|
This constructor takes in a raw interface pointer. It adds a reference to the instance (via the
|
|
This constructor takes in the name of a plug-in. It passes this name to the plug-in manager to create a new instance of the requested plug-in. It requests an interface pointer of type
|
|
This constructor takes in an
|
|
This constructor creates an empty (NULL) smart pointer.
|
|
This is the destructor of the |
|
This function takes in the name of a plug-in. It passes this name to the plug-in manager to create a new instance of the requested plug-in. It requests an interface pointer of type
|
|
This function is used to pass control of the interface pointer out of the smart pointer class. It sets its internal pointer to |
|
This function increments the reference count of the plug-in instance and returns the value of the |
|
This operator is invoked under several circumstances. Among the interesting ones are:
|
|
This operator returns
|
|
This operator is used to access the member functions of the
SPtr<IMyInterface> plugin("MyPlugin"); plugin->myFunction(); |
|
This operator returns true if this object is considered to be less than the argument.
|
|
This assigment operator takes in an
Reimplemented in SQPtr. |
|
Reimplemented in SQPtr. |
|
This function takes in a raw interface pointer. It adds a reference to the instance (via the
Reimplemented in SQPtr. |
|
This operator returns
|
|
This function simply returns the pointer value of the internal interface pointer. It is usually used to pass the interface pointer into functions where the conversion operators will not be invoked, such as |
|
This function releases the reference on the underlying plug-in instance (see |
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.