A workspace is a database used for checking objects into and out of another database. Workspaces are described in the Programmer's Guide in the chapter "CheckIn/CheckOut." PtWorkspace is the class used to check objects into a workspace or to update the original database with the current version of the workspace's objects.
Files to include | Class declaration | Base class |
poet.hxx ptws.hxx | ptws.hxx | PtBase |
constructor | PtWorkspace(PtBase* parent); |
destructor | virtual ~PtWorkspace(); |
AbortCheckOut | int AbortCheckOut(); |
BeginCheckOut | int BeginCheckOut(); |
cast2PtWorkspace | virtual PtWorkspace* cast2PtWorkspace(); |
CheckIn | int CheckIn(); |
Close | virtual int Close(); |
CommitCheckOut | int CommitCheckOut(); |
IsWorkspace | virtual int IsWorkspace(); |
Open | virtual int Open(char* name, PtOpenMode mode = PtOPEN_RW, PtClassDict* = 0, PtAssoc* ass = __PtRootAssoc.first); |
Update | int UpdateSource(); |
- PtWorkspace::PtWorkspace(PtBase* parent)
Constructor. Requires a pointer to an opened PtBase for the database which originally created this workspace with PtBase:: CreateWorkspace().
PtBase* parent | The database which originally created this workspace |
- virtual PtWorkspace::~PtWorkspace()
- int PtWorkspace::AbortCheckOut()
Aborts the current check out. After this function is called, all changes to the workspace or the original database that are associated with the check out have been undone. This function terminates the transaction which was started by BeginCheckOut(). If you want to check out more objects, you must call BeginCheckOut() again.
- int PtWorkspace::BeginCheckOut()
Enables the workspace to check out objects from the original database using PtObject::CheckOut(), PtObjectSet::CheckOut(), or PtOnDemand::CheckOut(). All check outs made after a BeginCheckOut() are made within an internal transaction. AbortCheckOut() aborts all check outs, and CommitCheckOut() commits them.
This function will fail if you are currently in a user transaction.
- virtual PtWorkspace* cast2PtWorkspace()
This function corresponds to PtBase::cast2PtWorkspace(), which casts a PtBase pointer to a PtWorkspace pointer. Since a PtWorkspace is always a workspace, this function always returns a non-zero value.
- int PtWorkspace::CheckIn()
Checks all objects from the workspace into the database, and removes the persistent locks which were left when the objects were checked out. Any objects which were created in the workspace are given a new, permanent identity in the database. After CheckIn() returns, there are no more objects left in the workspace, and the workspace's files are deleted.
- virtual int PtWorkspace::Close()
Closes the workspace database.
- int PtWorkspace::CommitCheckOut()
Commits all check outs to the workspace. After this function is called all objects which were checked out are in the workspace, and they are locked in the original database. This function terminates the transaction which was started by BeginCheckOut(). If you want to check out more objects, you must call BeginCheckOut() again.
- virtual int PtWorkspace::IsWorkspace()
This function corresponds to PtBase::IsWorkspace(), which reports whether a given database is a workspace. Since a PtWorkspace is always a workspace, this function always returns a non-zero value.
- virtual int PtWorkspace::Open(const PtString& name, PtOpenMode mode = PtOPEN_RW, PtClassDict* = 0, PtAssoc* ass = __PtRootAssoc.first)
Opens the workspace as a database. You will normally specify only the first parameter.
This differs from PtBase:: Open() in that it refuses to open the database if the PtBase pointer which was passed as a parameter to the PtWorkspace's constructor does not point to a PtBase which has opened the original database.
- int PtWorkspace::UpdateSource()
Writes all objects from the workspace into the database, but the objects remain checked out, and their locks remain in the original database. Any new objects which have been created in the workspace are given permanent object identities in the original database, and their permanent object identities are also assigned to them in the workspace.
Copyright (c) 1996 POET Software, Inc. All rights reserved. Reproduction in whole or in part in any form or medium without the express permission of POET Software, Inc. is prohibited.