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
{
public:
MimicCOM( void )
: m_count( 0 )
, m_AddRefCount( 0 )
, m_ReleaseCount( 0 )
static MimicCOM * QueryInterface( void )
{
s_constructions++;
MimicCOM * p = new MimicCOM;
p->AddRef();
return p;
}
virtual ~MimicCOM( void )
@ -176,6 +176,14 @@ private:
/// Not implemented.
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_destructions;
@ -187,6 +195,9 @@ private:
// ----------------------------------------------------------------------------
// $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
// Added StrongPtr class to Loki along with tests for StrongPtr.
//

View file

@ -955,13 +955,13 @@ void DoComRefTest( void )
assert( dtorCount == MimicCOM::GetDtorCount() );
{
MimicCOM_ptr p1( new MimicCOM );
MimicCOM_ptr p1( MimicCOM::QueryInterface() );
}
assert( ctorCount+1 == MimicCOM::GetCtorCount() );
assert( dtorCount+1 == MimicCOM::GetDtorCount() );
{
MimicCOM_ptr p2( new MimicCOM );
MimicCOM_ptr p2( MimicCOM::QueryInterface() );
MimicCOM_ptr p3( p2 );
MimicCOM_ptr p4;
p4 = p2;
@ -999,7 +999,7 @@ int main( unsigned int , const char * [] )
DoRefLinkTests();
DoStrongRefCountTests();
DoStrongRefLinkTests();
DoStrongReleaseTests();
DoStrongReleaseTests();
DoWeakCycleTests();
@ -1035,6 +1035,9 @@ int main( unsigned int , const char * [] )
// ----------------------------------------------------------------------------
// $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
// Added test for thread-safe StrongPtr policy.
//