CQ3ObjectRef
Abstract
Wrapper for Quesa objects.
Discussion
The main purpose for using a C++ wrapper for a Quesa object is to
prevent memory leaks. The wrapper's destructor disposes the object.
This class is designed to be usable in STL container classes.
It is not like std::auto_ptr, in that the copy constructor adds a
reference rather than transferring ownership. One could base such
a wrapper on boost::intrusive_pointer, but I chose not to require
Boost.
Due to a HeaderDoc bug, it is not possible to automatically
document more than one constructor. Besides the constructor from
a TQ3Object, there is a default constructor (which holds NULL)
and a copy constructor.
This wrapper is not fully functional with objects that are not
reference-counted (such as views and picks) because the copy
constructor calls Q3Shared_GetReference.
Member Functions
Constructor from a TQ3Object.
public:
explicit CQ3ObjectRef (
TQ3SharedObject inObject
) (
: mObject( inObject
);
Discussion
It is assumed that you pass a new reference
to this constructor.
Parameter Descriptions
- inObject
- A new reference to a Quesa object,
or NULL.
Get the value held by the wrapper.
public:
TQ3SharedObject get (void) const;
- function result
- A TQ3Object, or NULL.
Test whether this object holds a Quesa object.
public:
bool isvalid (void) const;
- function result
- True if it holds a non-NULL Quesa object.
Assignment operator.
public:
CQ3ObjectRef& operator= (
const CQ3ObjectRef& inOther
);
Discussion
The previous object held by this wrapper
is disposed, and a new reference replaces
it.
Parameter Descriptions
- inOther
- Another CQ3ObjectRef.
Swap contents with another CQ3ObjectRef.
public:
void swap (
CQ3ObjectRef& ioOther
);
Parameter Descriptions
- ioOther
- Another CQ3ObjectRef.
Member Data
The Quesa object held by the wrapper.
private:
TQ3SharedObject mObject;
© 1999-2008 Quesa Developers (Last Updated 5/10/2008)