In file counter.h:

class XxxCounterADT : public XxxSmallFixedADT

This ADT is a counter which can be used in a relation to provide a sequence of unique ordered integer values

Inheritance:


Public Fields

static XxxBasicType CounterTypeId
Type ID accessible without object

Public Methods

virtual XxxBool CanCastTo (XxxBasicType TargetType, const XxxADTMetaInfo* SourceMetaInfo, const XxxADTMetaInfo* TargetMetaInfo)
Determines if it is possible to cast a counter into another type
virtual XxxErrCode CastTo (XxxBasicType TargetType, const XxxADTMetaInfo* SourceMetaInfo, const XxxADTMetaInfo* TargetMetaInfo, XxxADTValue* OldObject, XxxADTValue* NewObject)
Executes a cast from counter into another type
virtual XxxErrCode DefaultVal (XxxADTValue* ObjectRef, const XxxADTMetaInfo* MetaInfo)
Assigns a "default" value--the next value to be assigned
virtual XxxBool Equals (const XxxADTValue* Obj1, const XxxADTMetaInfo*, const XxxADTValue* Obj2, const XxxADTMetaInfo*)
A method to determine if two objects of this type are identical
virtual XxxBool GreaterThan (const XxxADTValue* Val1, const XxxADTMetaInfo*, const XxxADTValue* Val2, const XxxADTMetaInfo*)
Compares two objects of this type
virtual XxxBool LessThan (const XxxADTValue* Val1, const XxxADTMetaInfo*, const XxxADTValue* Val2, const XxxADTMetaInfo*)
Compares two objects of this type
virtual void Print (ostream& OStr, const XxxADTMetaInfo* MetaInfo)
Prints the name of the ADT
virtual XxxErrCode ReadText (istream& InStream, XxxADTValue* ObjectRef, const XxxADTMetaInfo* MetaInfo)
Reads a text version of the object into the tuple representation of it, after memory has been allocated for the tuple representation
virtual XxxErrCode WriteText (ostream& OutStream, const XxxADTValue* Object, const XxxADTMetaInfo* MetaInfo)
Makes a readable text string version of the object from the tuple representation
XxxCounterADT (XxxBasicType Id)
Constructor
virtual ~XxxCounterADT ()
Destructor

Protected Classes

class CounterMetaInfo : public XxxADTMetaInfo
Meta-info for counters
int nextValue
The next value to be assigned
XxxShoreObjectId myId
Strangely enough, the OID of this object in SHORE
CounterMetaInfo ()
Constructor
virtual ~CounterMetaInfo ()
Destructor
virtual XxxErrCode Replicate (XxxADTMetaInfo*& NewMI)
Makes a copy of this meta-info object
virtual void Print (ostream& OStr)
Prints this meta-info object to the output stream
virtual XxxBool IsCompatible (const XxxADTMetaInfo* OtherMI)
"Constant" values for counters should not define their own meta-infos
virtual XxxErrCode SerializeCopySize (int &Size)
Returns the number of bytes necessary to hold the serialized version of this meta-info object
virtual XxxErrCode SerializeCopy (char *Data)
Creates a binary version of this meta-info object

Protected Methods

virtual XxxErrCode makeMetaInfo (const MetaInfoHandle& MIHandle, XxxADTMetaInfo* &MetaInfo)
Make the meta-info object associated with its handle and pins the counter
virtual XxxErrCode parseMetaInfo (const char* MetaInfoString, MetaInfoHandle& MIHandle)
parse a new meta-info object for this class

Inherited from XxxSmallFixedADT:


Inherited from XxxSmallADT:

Public Methods

virtual XxxBool IsSmall(const XxxADTMetaInfo*)

Documentation

This ADT is a counter which can be used in a relation to provide a sequence of unique ordered integer values. This is useful for adding a record ID to a record when inserting it into a relation. The meta-info stores the most recently-assigned value, so it is always accessible as a default value for insertion. This data type guarantees that all objects bound to a single meta-info object will have unique values. It is not necessarily guaranteed that all values are used.
class CounterMetaInfo: public XxxADTMetaInfo
Meta-info for counters. This structure holds information on the domain of the counter as well as the most-recently assigned value.

int nextValue
The next value to be assigned

XxxShoreObjectId myId
Strangely enough, the OID of this object in SHORE

CounterMetaInfo()
Constructor

virtual ~CounterMetaInfo()
Destructor

virtual XxxErrCode Replicate(XxxADTMetaInfo*& NewMI)
Makes a copy of this meta-info object

virtual void Print(ostream& OStr)
Prints this meta-info object to the output stream

virtual XxxBool IsCompatible(const XxxADTMetaInfo* OtherMI)
"Constant" values for counters should not define their own meta-infos

virtual XxxErrCode SerializeCopySize(int &Size)
Returns the number of bytes necessary to hold the serialized version of this meta-info object
Returns:
XXX_NOT_OK if the object cannot be serialized, XXX_OK otherwise
Parameters:
Size - (out) The required number of bytes

virtual XxxErrCode SerializeCopy(char *Data)
Creates a binary version of this meta-info object
Returns:
XXX_NOT_OK if the object cannot be serialized, XXX_OK otherwise
Parameters:
Data - An array of bytes of at least the size specified by the SerializeCopySize() function.

static XxxBasicType CounterTypeId
Type ID accessible without object

XxxCounterADT(XxxBasicType Id)
Constructor

virtual ~XxxCounterADT()
Destructor

virtual void Print(ostream& OStr, const XxxADTMetaInfo* MetaInfo)
Prints the name of the ADT

virtual XxxBool Equals(const XxxADTValue* Obj1, const XxxADTMetaInfo*, const XxxADTValue* Obj2, const XxxADTMetaInfo*)
A method to determine if two objects of this type are identical

virtual XxxErrCode DefaultVal(XxxADTValue* ObjectRef, const XxxADTMetaInfo* MetaInfo)
Assigns a "default" value--the next value to be assigned

virtual XxxErrCode WriteText(ostream& OutStream, const XxxADTValue* Object, const XxxADTMetaInfo* MetaInfo)
Makes a readable text string version of the object from the tuple representation

virtual XxxErrCode ReadText(istream& InStream, XxxADTValue* ObjectRef, const XxxADTMetaInfo* MetaInfo)
Reads a text version of the object into the tuple representation of it, after memory has been allocated for the tuple representation

virtual XxxBool LessThan(const XxxADTValue* Val1, const XxxADTMetaInfo*, const XxxADTValue* Val2, const XxxADTMetaInfo*)
Compares two objects of this type
Returns:
XXX_TRUE if the first argument is "less than" the second

virtual XxxBool GreaterThan(const XxxADTValue* Val1, const XxxADTMetaInfo*, const XxxADTValue* Val2, const XxxADTMetaInfo*)
Compares two objects of this type
Returns:
XXX_TRUE if the first argument is "greater than" the second

virtual XxxBool CanCastTo(XxxBasicType TargetType, const XxxADTMetaInfo* SourceMetaInfo, const XxxADTMetaInfo* TargetMetaInfo)
Determines if it is possible to cast a counter into another type

virtual XxxErrCode CastTo(XxxBasicType TargetType, const XxxADTMetaInfo* SourceMetaInfo, const XxxADTMetaInfo* TargetMetaInfo, XxxADTValue* OldObject, XxxADTValue* NewObject)
Executes a cast from counter into another type

virtual XxxErrCode parseMetaInfo(const char* MetaInfoString, MetaInfoHandle& MIHandle)
parse a new meta-info object for this class
Parameters:
MetaInfoString - A string containing information on the contents of the meta-info. In the counter's case, empty.
MIHandle - (out) A handle on the newly-created meta info

virtual XxxErrCode makeMetaInfo(const MetaInfoHandle& MIHandle, XxxADTMetaInfo* &MetaInfo)
Make the meta-info object associated with its handle and pins the counter
Parameters:
ObjName - The name given to the object if one is provided
MIHandle - (in) A handle on the meta info
MetaInfo - (out) A pointer to a newly-created MI object
Found - (out) XXX_FALSE if the MI was not found


This class has no child classes.
Author:
Mark A. Paskin, paskin@cs.cornell.edu
Version:
June 26, 1997
See Also:

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de