A PtLockSpec is a lock specification; that is, it contains the parameters used to specify a lock. All methods that set locks or free locks take a PtLockSpec as a parameter.
Please see the chapter "Locking" for a complete set of the methods which use a PtLockSpec and for examples of setting and freeing locks.
Files to include | Class declaration | Base class |
poet.hxx | ptmode.hxx | none |
constructor | PtLockSpec(); |
destructor | ~PtLockSpec(); |
operator = | PtLockSpec& operator = (PtLockSpec& ); |
Decode | void Decode(PtLockEncode); |
DeepMode | inline PtDepthMode& DeepMode(); |
Encode | int Encode(PtLockEncode& ); |
LockType | inline PtLockType LockType(); |
Mode | inline PtLockMode& Mode(); |
RetryNum | inline unsigned short& RetryNum(); |
- PtLockSpec::PtLockSpec()
- PtLockSpec::PtLockSpec(PtLockMode, PtDepthMode)
- PtLockSpec::PtLockSpec(PtLockSpec& )
Each of these is discussed separately below.
- PtLockSpec::PtLockSpec()
Constructor, no parameters specified. The PtLockSpec can not be used until these parameters are given.
- PtLockSpec::PtLockSpec(PtLockMode, PtDepthMode)
Constructor, PtLockMode and PtDepthMode specified.
- PtLockSpec::PtLockSpec(PtLockSpec& )
Copy constructor. This is used when a new PtLockSpec is created using new or on the stack. For instance, you could create three identical PtLockSpecs with the following code:
- PtLockSpec::~PtLockSpec()
- void PtLockSpec::Decode(PtLockEncode)
This function is used internally by POET, and should not be used in your program.
- PtDepthMode& PtLockSpec::DeepMode()
Returns depth mode. See the chapter "Locking" for a list of valid depth modes.
- int PtLockSpec::Encode(PtLockEncode& )
This function is used internally by POET, and should not be used in your program.
- inline PtLockType PtLockSpec::LockType()
Returns the lock type to indicate whether the lock is a persistent lock. Lock types may be either of the following:
PtLK_NONPERS | The lock is not persistent. |
PtLK_PERS | The lock is persistent. |
Persistent locks are used internally for CheckIn/CheckOut.
- PtLockMode& PtLockSpec::Mode()
Returns lock mode. See the chapter "Locking" for a list of valid lock modes.
- inline unsigned short& PtLockSpec::RetryNum()
This function will not give your program any useful information. POET does not do retries on its locks.
- PtLockSpec& PtLockSpec::operator = (PtLockSpec& )
- PtLockSpec& PtLockSpec::operator = (PtLockMode mode)
- PtLockSpec& PtLockSpec::operator = (PtDepthMode deep)
Each of these is discussed separately below.
- PtLockSpec& PtLockSpec::operator = (PtLockSpec& )
Assignment operator. Sets both lock mode and depth mode to that of the PtLockSpec parameter.
- PtLockSpec first, second, third(PtLK_WRITEvWRITE, PtSHALLOW);
- first = second = third;
All three PtLockSpecs now have the parameters specified for third.
- PtLockSpec& PtLockSpec::operator = (PtLockMode mode)
Assignment operator which sets only the lock mode.
Be careful when making multiple assignments in one statement - note the following example:
Assignment operators group right-to-left. Therefore, the last statement in our example could also have been written like this:
In the first assignment the lock mode for third is set to PtDELETEvWRITE, which is pretty much what you expect. The second assignment sets second to the new value of third. Because third is a PtLockSpec the operator that will be used has the form:
This operator sets both the lock mode and the depth mode. Therefore, the first assignment sets only the lock mode, but the second sets both modes. At the end of the operation, all three PtLockSpecs contain the lock mode PtDELETEvWRITE and the depth mode PtSHALLOW.
- PtLockSpec& PtLockSpec::operator = (PtDepthMode deep)
Assignment operator which sets only the depth mode. See the previous method for an example of the problems that can occur when making multiple assignments in one statement using this operator.
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.