Added QueryInterface function to MimicCOM class.

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@649 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
rich_sposato 2006-05-18 05:05:21 +00:00
parent 04b3944796
commit a38d02bdd5
2 changed files with 22 additions and 8 deletions

View file

@ -110,12 +110,12 @@ public:
class MimicCOM class MimicCOM
{ {
public: public:
MimicCOM( void )
: m_count( 0 ) static MimicCOM * QueryInterface( void )
, m_AddRefCount( 0 )
, m_ReleaseCount( 0 )
{ {
s_constructions++; MimicCOM * p = new MimicCOM;
p->AddRef();
return p;
} }
virtual ~MimicCOM( void ) virtual ~MimicCOM( void )
@ -176,6 +176,14 @@ private:
/// Not implemented. /// Not implemented.
MimicCOM & operator = ( const MimicCOM & ); MimicCOM & operator = ( const MimicCOM & );
MimicCOM( void )
: m_count( 0 )
, m_AddRefCount( 0 )
, m_ReleaseCount( 0 )
{
s_constructions++;
}
static unsigned int s_constructions; static unsigned int s_constructions;
static unsigned int s_destructions; static unsigned int s_destructions;
@ -187,6 +195,9 @@ private:
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// $Log$ // $Log$
// Revision 1.3 2006/05/18 05:05:21 rich_sposato
// Added QueryInterface function to MimicCOM class.
//
// Revision 1.2 2006/04/05 22:53:12 rich_sposato // Revision 1.2 2006/04/05 22:53:12 rich_sposato
// Added StrongPtr class to Loki along with tests for StrongPtr. // Added StrongPtr class to Loki along with tests for StrongPtr.
// //

View file

@ -955,13 +955,13 @@ void DoComRefTest( void )
assert( dtorCount == MimicCOM::GetDtorCount() ); assert( dtorCount == MimicCOM::GetDtorCount() );
{ {
MimicCOM_ptr p1( new MimicCOM ); MimicCOM_ptr p1( MimicCOM::QueryInterface() );
} }
assert( ctorCount+1 == MimicCOM::GetCtorCount() ); assert( ctorCount+1 == MimicCOM::GetCtorCount() );
assert( dtorCount+1 == MimicCOM::GetDtorCount() ); assert( dtorCount+1 == MimicCOM::GetDtorCount() );
{ {
MimicCOM_ptr p2( new MimicCOM ); MimicCOM_ptr p2( MimicCOM::QueryInterface() );
MimicCOM_ptr p3( p2 ); MimicCOM_ptr p3( p2 );
MimicCOM_ptr p4; MimicCOM_ptr p4;
p4 = p2; p4 = p2;
@ -999,7 +999,7 @@ int main( unsigned int , const char * [] )
DoRefLinkTests(); DoRefLinkTests();
DoStrongRefCountTests(); DoStrongRefCountTests();
DoStrongRefLinkTests(); DoStrongReleaseTests();
DoStrongReleaseTests(); DoStrongReleaseTests();
DoWeakCycleTests(); DoWeakCycleTests();
@ -1035,6 +1035,9 @@ int main( unsigned int , const char * [] )
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// $Log$ // $Log$
// Revision 1.8 2006/05/18 05:05:21 rich_sposato
// Added QueryInterface function to MimicCOM class.
//
// Revision 1.7 2006/04/28 00:34:21 rich_sposato // Revision 1.7 2006/04/28 00:34:21 rich_sposato
// Added test for thread-safe StrongPtr policy. // Added test for thread-safe StrongPtr policy.
// //