C++ MonsterDoc:
CCGIThread

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

Class Overview

This class provides the CGI request handling in the Monsterworks' Framework.

Inheritance

The class is a subclass of the PowerPlant LThread class.

Requirements

Use of this class requires a substantial portion of the PowerPlant Framework as well as the following from the Monsterworks' Framework:

Files

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

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

Members by Access

public

CCGIThread(
const AppleEvent& inEvent,
const AppleEvent& outReply,
long inRefCon );

virtual
~CCGIThread(
void
);

virtual
void
ShutDown(
void
);

virtual
void
CheckMe(
void
);

virtual
void
Run(
void
);

protected

virtual
void*
HandleWWWEvent(
void
) = 0;

string
Parameter(
ECGIKeys inKey
) const;

inline
OSErr
Parameter(
AEKeyword inKey,
DescType inDesiredType,
DescType* outActualType,
void* outData,
Size inMaxSize,
Size* outRealSize
) const;

string
GetPostValue(
const string& inName
) const;

SInt32
RefCon(
void
) const;

void
SetReply(
const string& inReply
);

inline
OSErr
SetReply(
AEKeyword inKey,
DescType inType,
const void* inData,
Size inSize
);

void
SuspendEvent(
void
);

void
ResumeEvent(
void
);

private

CCGIThread(
void
);

CCGIThread(
const CCGIThread&
);

const CCGIThread&
operator=(
const CCGIThread&
);

const AppleEvent
myEvent;

AppleEvent
myReply;

long
myRefCon;

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

Members by Inheritance

statics

This class introduces no static methods.

overrides

virtual
void
Run(
void
);

new virtuals

virtual
~CCGIThread(
void
);

virtual
void
ShutDown(
void
);

virtual
void
CheckMe(
void
);

virtual
void*
HandleWWWEvent(
void
) = 0;

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

Member Descriptions

Member Data

const AppleEvent
myEvent;

myEvent stores the AppleEvent of the CGI request.

AppleEvent
myReply;

myReply stores the AppleEvent to be used to reply to the CGI request.

long
myRefCon;

myRefCon stores the reference constant associated to the CGI request AppleEvent.


Ctor/Dtor/Copy

CCGIThread

Constructs a CCGIThread.

CCGIThread(
const AppleEvent& inEvent,
const AppleEvent& outReply,
long inRefCon
);

The three arguments are placed in the private data members of the thread.

CCGIThread(
void
);

The default constructor is not implemented for this class.

CCGIThread(
const CCGIThread&
);

The copy constructor is not implemented for this class.

operator=

The assignment operator is not implemented for this class.

const CCGIThread&
operator=(
const CCGIThread&
);

~CCGIThread

This destructs the CCGIThread.

warnNote that you should call the LThread::DeleteThread method to delete any subclass of LThread.

virtual
~CCGIThread(
void
);


Object Validation

CheckMe

This method will check the internal structure of a CCGIThread.

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

virtual
void
CheckMe(
void
);


Thread Methods

Run

This will run the thread and call any necessary routines needed for the Monsterworks' Framework.

stopIf you override this method, you must call SuspendEvent before calling Yield to allow for proper threading of AppleEvents.

virtual
void
Run(
void
);

ShutDown

This method will be called if the application must quit before the thread's Run method completes. Before overriding this method, consider whether a stack-based data member in your CCGIThread class would solve the problem.

virtual
void
ShutDown(
void
);

SuspendEvent

This method suspends the AppleEvent to allow threading and updates the application's window.

void
SuspendEvent(
void
);

ResumeEvent

This method resumes the AppleEvent to inform the OS that the event is ready to be returned. It also updates the application's window.

void
ResumeEvent(
void
);


Event Handling

HandleWWWEvent

This method should handle the CGI processing and then call SetReply to return a reply to the server.

virtual
void*
HandleWWWEvent(
void
) = 0;

The return value of this method is unused by the framework and will be the return value from the thread's Run method.

Parameter

Returns parameters from the CGI Request AppleEvent.

string
Parameter(
ECGIKeys inKey
) const;

inKey
is the name of the parameter requested.
<<return>>
is the value of the parameter requested.

inline
OSErr
Parameter(
AEKeyword inKey,
DescType inDesiredType,
DescType* outActualType,
void* outData,
Size inMaxSize,
Size* outRealSize
) const;

This is an inline call to AEGetParamPtr.

GetPostValue

Returns the value associated with the input in the POST parameter.

string
GetPostValue(
const string& inName
) const;

inName
is the name of the parameter requested.
<<return>>
is the value of the parameter requested,
it will be empty if the parameter is not found.

RefCon

Returns the reference constant associated with the CGI AppleEvent.

SInt32
RefCon(
void
) const;

SetReply

Sets the parameters of the reply AppleEvent to return to the server.

void
SetReply(
const string& inReply
);

inReply
is sent as the reply page to the browser.

inline
OSErr
SetReply(
AEKeyword inKey,
DescType inType,
const void* inData,
Size inSize
);

This is an inline call to AEPutParamPtr.


©1999-2004 Monsterworks

Last Modified: Tuesday, October 3, 2000