C++ MonsterDoc:
CCGIFactory

Home
Contact
Copyright
|| All Classes ||
||overview|| ||access|| ||inheritance|| ||descriptions||

Class Overview

This class provides a factory pattern for the Monsterworks' Framework. It embodies the singleton pattern and must be created on the heap (not on the stack) because of its protected destructor. You should use it to insure that the CCGIThreads, CCGIApp and CCGITerminator used by your application are compatible.

Inheritance

This class has no ancestors.

Requirements

This class requires large portions of PowerPlant and the Monsterworks' Framework.

Files

  • CCGIThreadApp.h
  • CCGIThreadApp.ip
  • CCGIThreadApp.cp

||overview|| ||access|| ||inheritance|| ||descriptions||

Members by Access

public

CCGIFactory(
void
);

virtual
void
DeleteFactory(
void
);

virtual
void
CheckMe(
void
);

static
void
CheckUs(
void
);

virtual
CCGIThread*
CreateThread(
const AppleEvent& inEvent,
const AppleEvent& outReply,
long inRefCon
) = 0;

virtual
CCGIApp*
CreateApp(
void
) = 0;

virtual
void
CreateTerminator(
void
) = 0;

static
CCGIFactory*
CCGIFactoryP(
void
);

virtual
void
TerminateThreads(
void
);

protected

virtual
~CCGIFactory(
void
);

class CCGITerminator;

virtual
CCGITerminator*
SetTerminator(
CCGITerminator* inTerminator
);

private

CCGIFactory(
void
);

const CCGIFactory&
operator=(
const CCGIFactory&
);

CCGITerminator*
myTerminatorP;

static CCGIFactory*
ourFactoryP;

||overview|| ||access|| ||inheritance|| ||descriptions||

Members by Inheritance

statics

static
void
CheckUs(
void
);

static
CCGIFactory*
CCGIFactoryP
(
void
);

overrides

This class overrides no methods.

new virtuals

virtual
void
DeleteFactory(
void
);

virtual
void
CheckMe(
void
);

virtual
CCGIThread*
CreateThread(
const AppleEvent& inEvent,
const AppleEvent& outReply,
long inRefCon
) = 0;

virtual
CCGIApp*
CreateApp(
void
) = 0;

virtual
void
CreateTerminator(
void
) = 0;

virtual
void
TerminateThreads(
void
);

virtual
~CCGIFactory(
void
);

virtual
CCGITerminator*
SetTerminator(
CCGITerminator* inTerminator
);

||overview|| ||access|| ||inheritance|| ||descriptions||

Member Descriptions

Member Data

CCGITerminator*
myTerminatorP;

The CCGITerminator which will terminate the CCGIThreads when TerminateThreads is called.

static
CCGIFactory*
ourFactoryP;

This is really just a static name for this since the CCGIFactory follows the singleton pattern.


Ctor/Dtor/Copy

CCGIFactory

Constructs a CCGIFactory.

CCGIFactory(
void
);

The default constructor is implemented by this class.

CCGIFactory(
const CCGIFactory&
);

The copy constructor is not implemented by this class.

operator=

The assignment operator for this class is not implemented.

const CCGIFactory&
operator=(
const CCGIFactory&
);

DeleteFactory

Deletes the CCGIFactory.

WarnThis method will not delete the CCGIApp created by the factory nor any running CCGIThreads. Users should be careful about deleting the CCGIFactory if either of these classes have been instantiated. You can eliminate all such classes by calling CCGIApp::DeleteApp prior to deleting the factory.

virtual
void
DeleteFactory(
void
);

~CCGIFactory

Destructs the CCGIFactory.

virtual
~CCGIFactory(
void
);


Object Validation

CheckMe

Checks the internal structure of the object and will throw an exception if something is wrong.

warnThis method will probably throw an exception if called from within a constructor of a CCGIFactory. The solution the framework takes to avoid this is to statically bind all calls to CheckMe from within member methods.

virtual
void
CheckMe(
void
);

CheckUs

Checks the internal structure of the class and will throw an exception if something is wrong.

warnThis method will probably throw an exception if called from within a constructor of a CCGIFactory. The solution the framework takes to avoid this is to statically bind all calls to CheckUs from within member methods.

static
void
CheckUs(
void
);


Factory Methods

CreateThread

This method is used to create a CCGIThread.

noteThis method is declared to be pure virtual so you will need to override the CCGIFactory class to implement it. See the TCGIFactory template factory for an example.

virtual
CCGIThread*
CreateThread(
const AppleEvent& inEvent,
const AppleEvent& outReply,
long inRefCon
) = 0;

CreateApp

This method is used to create a CCGIApp.

noteThis method is declared to be pure virtual so you will need to override the CCGIFactory class to implement it. See the TCGIFactory template factory for an example.

virtual
CCGIApp*
CreateApp (
void
) = 0;

CreateTerminator

This method is used to create a CCGITerminator. The terminator created will be stored in the CCGIFactory's member data.

noteThis method is declared to be pure virtual so you will need to override the CCGIFactory class to implement it. See the TCGIFactory template factory for an example.

virtual
void
CreateTerminator(
void
) = 0;


Thread Management

TerminateThreads

This method is used to delete all CCGIThreads.

noteThis method can safely be called from within a CCGIThread, however, control will not return to the point of the call in that case.

virtual
void
TerminateThreads(
void
);

SetTerminator

This method is used to set the object's CCGITerminator.

warnYou are responsible for calling DeleteThread on the return value.

virtual
CCGITerminator*
SetTerminator(
CCGITerminator* inTerminator
);


Static Pointer

CCGIFactoryP

This method provides static access to this.

static
CCGIFactory*
CCGIFactoryP (
void
);


©1999-2004 Monsterworks

Last Modified: Monday, October 2, 2000