|
From: Roger H. <rog...@mi...> - 2005-01-04 15:54:41
|
Yes that sounds fine. I would like to informally reserve the name
C3DObject and similar
C3D prefixes for wrappers which bumps the reference count when they
they are
constructed and decrease it when their destructor is called.
I am about to start work on the new C++ replacements for the instance
data for all of
Quesa's shared objects if that is OK with everyone.
Roger.
On Wednesday, December 29, 2004, at 04:56 am, James W.Walker wrote:
> In the course of improving text 3DMF reading, I'm going to introduce a
> simple C++ wrapper class for a Quesa object. (One could make such a
> wrapper using boost::intrusive_pointer, but I didn't think we would
> want to require Boost.) Since this class could be useful for users of
> Quesa as well as in the implementation, I'm wondering whether I should
> put it in the SDK rather than in the source hierarchy?
>
> Here's the interface. Comments follow.
>
> class CQ3ObjectRef
> {
> public:
> // default constructor
> CQ3ObjectRef()
> : mObject( NULL ) {}
>
> // copy constructor
> CQ3ObjectRef( const CQ3ObjectRef& inOther );
>
> // constructor from a Quesa object
> // Note: assumes it is given a new reference
> explicit CQ3ObjectRef( TQ3SharedObject inObject )
> : mObject( inObject ) {}
>
> // destructor
> ~CQ3ObjectRef();
>
> // assignment operator
> CQ3ObjectRef& operator=( const CQ3ObjectRef& inOther );
>
> void swap( CQ3ObjectRef& ioOther );
>
> bool isvalid() const { return mObject != NULL; }
>
> TQ3SharedObject get() const { return mObject; }
>
> private:
> TQ3SharedObject mObject;
> };
>
> Notes:
> * This object can be used in STL containers.
> * All methods will have inline definitions.
> * No methods throw exceptions.
> * I tried to keep it simple, so I did not provide release() or reset()
> functions. In place of myob.reset( newref ) one can write myob =
> CObjectRef(newRef), and in place of
> TQ3Object x = myob.release();
> one can write
> TQ3Object x = Q3Shared_GetReference( myob.get() );
> --
> <http://www.jwwalker.com/>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real
> users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> Quesa-develop mailing list
> Que...@li...
> https://lists.sourceforge.net/lists/listinfo/quesa-develop
>
|