SourcePro® 2024.1 |
SourcePro® API Reference Guide |
Contains virtual functions for identifying, hashing, comparing, storing and retrieving collectable objects. More...
#include <rw/collect.h>
Public Member Functions | |
virtual | ~RWCollectable () |
virtual RWspace | binaryStoreSize () const |
virtual int | compareTo (const RWCollectable *) const |
virtual RWCollectable * | copy () const |
virtual unsigned | hash () const |
virtual RWClassID | isA () const |
virtual bool | isEqual (const RWCollectable *t) const |
virtual RWCollectable * | newSpecies () const |
RWspace | recursiveStoreSize () const |
virtual void | restoreGuts (RWFile &) |
virtual void | restoreGuts (RWvistream &) |
virtual void | saveGuts (RWFile &) const |
virtual void | saveGuts (RWvostream &) const |
RWStringID | stringID () const |
Static Public Member Functions | |
static RWClassID | classID (const RWStringID &name) |
static RWClassID | classIsA () |
static bool | isAtom (RWClassID id) |
static RWspace | nilStoreSize () |
Friends | |
RWFile & | operator<< (RWFile &f, const RWCollectable &obj) |
RWvostream & | operator<< (RWvostream &v, const RWCollectable &obj) |
RWFile & | operator>> (RWFile &f, RWCollectable &obj) |
RWFile & | operator>> (RWFile &f, RWCollectable *&pCl) |
RWvistream & | operator>> (RWvistream &s, RWCollectable *&pCl) |
RWvistream & | operator>> (RWvistream &v, RWCollectable &obj) |
Class RWCollectable is an abstract base class for collectable objects. This class contains virtual functions for identifying, hashing, comparing, storing and retrieving collectable objects. While these virtual functions have simple default definitions, objects that inherit this base class typically redefine one or more of them.
|
virtual |
All functions that inherit class RWCollectable have virtual destructors. This allows them to be deleted by such member functions as removeAndDestroy() without knowing their type.
|
virtual |
Returns the number of bytes used by the virtual function saveGuts(RWFile&) to store an object. Typically, this involves adding up the space required to store all primitives, plus the results of calling recursiveStoreSize() for all objects inheriting from RWCollectable. See the Essential Tools Module User's Guide for details.
Reimplemented in RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWCollection, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, and RWDBValue.
|
inlinestatic |
|
virtual |
The function compareTo() is necessary to sort the items in a collection. If p1
and p2
are pointers to RWCollectable objects, the statement:
should return:
0 if *p1
"is equal to" *p2
;
>0 if *p1
is "larger" than *p2
;
<0 if *p1
is "smaller" than *p2
.
Note that the meaning of "is equal to," "larger" and "smaller" is left to the user. The default definition provided by the base class is based on the addresses, i.e.,
and is probably not very useful.
In derived classes, it is recommended that compareTo() first perform ordering on the RWCollectable type (via the isA() method). If both sides are of the same type, then ordering based on the rules for that type should be applied.
Reimplemented in RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, and RWDBValue.
|
virtual |
Returns a new, copy-constructed object of the same type as self. The caller is responsible for deleting the object.
Reimplemented in RWBag, RWBinaryTree, RWBTree, RWBTreeDictionary, RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, RWDBValue, RWDlistCollectables, RWHashDictionary, RWHashTable, RWIdentityDictionary, RWIdentitySet, RWOrdered, RWSet, RWSlistCollectables, RWSlistCollectablesQueue, RWSlistCollectablesStack, and RWSortedVector.
|
virtual |
Returns a hash value. This function is necessary for collection classes that use hash table look-up. The default definition provided by the base class hashes the object's address.
It is important that the hash value be the same for all objects that return true
to isEqual().
Reimplemented in RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, and RWDBValue.
|
virtual |
Returns a class identification number (with a typedef of unsigned short
). The default definition returns __RWCOLLECTABLE
. Identification numbers greater than or equal to 0x8000 (hex) are reserved for Rogue Wave objects. User-defined classes should define isA() to return a number between 0 and 0x7FFF.
Reimplemented in RWBag, RWBinaryTree, RWBTree, RWBTreeDictionary, RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWCollection, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, RWDBValue, RWDlistCollectables, RWHashDictionary, RWHashTable, RWIdentityDictionary, RWIdentitySet, RWOrdered, RWSet, RWSlistCollectables, RWSlistCollectablesQueue, RWSlistCollectablesStack, and RWSortedVector.
|
static |
Returns true
if id is the RWClassID that is associated with an RWCollectable class that has a programmer-chosen RWStringID.
|
virtual |
Behaves as if compareTo(t) was invoked, returning true
if the result equals 0, false
otherwise.
Reimplemented in RWBag, RWBinaryTree, RWBTree, RWBTreeDictionary, RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, RWDBValue, RWDlistCollectables, RWHashDictionary, RWHashTable, RWIdentityDictionary, RWIdentitySet, RWOrdered, RWSet, RWSlistCollectables, RWSlistCollectablesQueue, RWSlistCollectablesStack, and RWSortedVector.
|
virtual |
Returns a new, default-constructed object of the same type as self. The caller is responsible for deleting the object.
Reimplemented in RWBag, RWBinaryTree, RWBTree, RWBTreeDictionary, RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, RWDBValue, RWDlistCollectables, RWHashDictionary, RWHashTable, RWIdentityDictionary, RWIdentitySet, RWOrdered, RWSet, RWSlistCollectables, RWSlistCollectablesQueue, RWSlistCollectablesStack, and RWSortedVector.
|
static |
RWspace RWCollectable::recursiveStoreSize | ( | ) | const |
Returns the number of bytes required to store the object using the global operator:
Recursively calls binaryStoreSize(), taking duplicate objects into account.
|
virtual |
Reads an object's state from a binary file, using class RWFile, replacing the previous state.
Reimplemented in RWBTreeDictionary, RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWCollection, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, RWDBValue, RWHashDictionary, and RWSlistCollectablesStack.
|
virtual |
Reads an object's state from an input stream, replacing the previous state.
Reimplemented in RWBTreeDictionary, RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWCollection, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, RWDBValue, RWHashDictionary, and RWSlistCollectablesStack.
|
virtual |
Writes an object's state to a binary file, using class RWFile.
Reimplemented in RWBinaryTree, RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWCollection, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, and RWDBValue.
|
virtual |
Writes an object's state to an output stream.
Reimplemented in RWBinaryTree, RWCollectableAssociation, RWCollectableDate, RWCollectableDateTime, RWCollectableInt, RWCollectableString, RWCollectableTime, RWCollectableWString, RWCollection, RWDBBlob, RWDBCheckConstraint, RWDBCollectableExpr, RWDBForeignKey, RWDBRow, RWDBUniqueConstraint, and RWDBValue.
|
inline |
Returns the identification string for the class. Acts virtual, although it is not. See the discussion on RWStringID in the Essential Tools Module User's Guide for more information on how to make a non-virtual function act like a virtual function.
|
friend |
Saves the object obj to an RWFile. Recursively calls the virtual function saveGuts(), taking duplicate objects into account. See the discussion on Persistence in the Essential Tools Module User's Guide for more information.
|
friend |
Saves the object obj to a virtual stream. Recursively calls the virtual function saveGuts(), taking duplicate objects into account. See the discussion on Persistence in the Essential Tools Module User's Guide for more information.
|
friend |
Restores an object inheriting from RWCollectable into obj from an RWFile, replacing the previous contents of obj. Recursively calls the virtual function restoreGuts(), taking duplicate objects into account. For more information, see the discussion on Persistence in the Essential Tools Module User's Guide.
Various exceptions that could be thrown are RWInternalErr (if the RWFactory does not know how to make the object), and RWExternalErr (corrupted stream or file).
|
friend |
Looks at the next object on the input stream or RWFile, respectively, and either creates a new object of the proper type off the heap and returns a pointer to it, or else returns a pointer to a previously read instance. Recursively calls the virtual function restoreGuts(), taking duplicate objects into account. If an object is created off the heap, then you are responsible for deleting it. For more information, see the discussion on Persistence in the Essential Tools Module User's Guide.
Various exceptions that could be thrown are RWInternalErr (if the RWFactory does not know how to make the object), and RWExternalErr (corrupted stream or file). If an exception is thrown during this call, pCl may point to the partly restored object.
|
friend |
Looks at the next object on the input stream or RWFile, respectively, and either creates a new object of the proper type off the heap and returns a pointer to it, or else returns a pointer to a previously read instance. Recursively calls the virtual function restoreGuts(), taking duplicate objects into account. If an object is created off the heap, then you are responsible for deleting it. For more information, see the discussion on Persistence in the Essential Tools Module User's Guide.
Various exceptions that could be thrown are RWInternalErr (if the RWFactory does not know how to make the object), and RWExternalErr (corrupted stream or file). If an exception is thrown during this call, pCl may point to the partly restored object.
|
friend |
Restores an object inheriting from RWCollectable into obj from a virtual stream, replacing the previous contents of obj. Recursively calls the virtual function restoreGuts(), taking duplicate objects into account. For more information, see the discussion on Persistence in the Essential Tools Module User's Guide.
Various exceptions that could be thrown are RWInternalErr (if the RWFactory does not know how to make the object), and RWExternalErr (corrupted stream or file).
Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |