Class: TDocumentSession

Declaration: BasicDocument.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

TCompoundDocumentSession

Purpose:

TDocumentSession provides the runtime environment for a document. Specifically, it opens the document, files it in, and starts up the document server.

Instantiation:

Allocate on the heap or the stack. Only one document session can be created per task, and a document session supports only one document. Each running document resides in a separate task.

Deriving Classes:

Derived classes can provide specialized or extended runtime capabilities, such as collaboration support.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Invariants:

(GetDocument() != NIL).

Member Function: TDocumentSession::TDocumentSession

  1. TDocumentSession (TDocumentStore &, TStore::EAccessMode, TDocumentStore::ESharingMode =TDocumentStore::kNonShared)
  2. TDocumentSession ()

Interface Category:

API.

Purpose:

  1. Constructs a new document session for a specific document. This constructor sets up the environment to allow local and remote manipulation of the document data.
  2. Default constructor.

Calling Context:

  1. Called to create a TDocumentSession object. Document sessions are usually created only by a TDocumentProgram. Clients of the Basic Document Framework are not expected to use this class directly.
  2. Called by the stream-in operators and derived classes.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

PreConditions: Assertion (GetSession() ==NIL). PostConditions: Assertion (GetSession() != NIL). Assertion (GetDocument() != NIL).

Member Function: TDocumentSession::~TDocumentSession

virtual ~ TDocumentSession ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy a TDocumentSession object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

PostConditions: Assertion (GetSession() ==NIL).

Member Function: TDocumentSession::GetDocument

TDocument * GetDocument () const

Interface Category:

API.

Purpose:

Provides access to the document associated with this session. This is the only running document for the task.

Calling Context:

Call this function directly.

Parameters:

Return Value:

TDocument * -The document associated with this session.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentSession::Run

virtual void Run ()

Interface Category:

API.

Purpose:

Starts the document session server process running. This function opens the document, starts the server, and registers the document session with the document registry. This function does not return until the document server is exited.

Calling Context:

Called only once.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

PreConditions: Assertion (IsRunning ==false). PostConditions: Assertion (IsRunning ==true).

Member Function: TDocumentSession::GetSession

static TDocumentSession * GetSession ()

Interface Category:

API.

Purpose:

Provides access to the current session for the task.

Calling Context:

Called from anywhere in the same task.

Parameters:

Return Value:

TDocumentSession * -The session for the local task.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentSession::GetRequestProcessor

static TRequestProcessor * GetRequestProcessor ()

Interface Category:

API.

Purpose:

Returns the document session's request processor. If there is no request processor, this function creates a new one.

Calling Context:

Called from anywhere in the same task.

Parameters:

Return Value:

Returns the document session's request processor.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentSession::Main

virtual void Main ()

Interface Category:

API.

Purpose:

Main routine for a document session. All the work of opening and closing the document, starting the server, and so on, is done here. This function hands control off to the server and does not return until the server exits. This function is protected.

Calling Context:

Called only by TDocumentSession.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This is the function that derived classes override to provide behavior specific to a particular type of session, such as creating the appropriate command dispatcher for a collaborative session.

Member Function: TDocumentSession::SetUpAfterStart

virtual void SetUpAfterStart ()

Interface Category:

API.

Purpose:

Does any necessary initialization. This function is protected.

Calling Context:

Called by TDocumentSession to let derived classes do additional initialization prior to telling the Document registry that the document can handle outside requests.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TDocumentSession::CleanUpBeforeShutdown

virtual void CleanUpBeforeShutdown ()

Interface Category:

API.

Purpose:

Does any necessary clean up. This function is protected.

Calling Context:

Called by TDocumentSession to let derived classes do additional work prior to deleting the instance.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.