#include <bgobject.h>
Class diagram for BGObject:
Public Members | |||
![]() | ![]() | long | cid ( ) |
![]() | ![]() | Returns unique class identifier. More... | |
![]() | ![]() | virtual BGString | toString ( ) = 0 |
![]() | ![]() | Generates string representation of this object. More... | |
![]() | ![]() | virtual unsigned long | hash ( ) = 0 |
![]() | ![]() | Generates a 'unique' hashvalue of this object. More... | |
![]() | ![]() | virtual bool | equals ( BGObject &obj ) = 0 |
![]() | ![]() | Returns true, if specified object is equal to own instance. More... | |
![]() | ![]() | virtual BGString | className ( ) = 0 |
![]() | ![]() | Return the class name for this class. More... |
Some useful methods are defined here, which are implemented in all derived classes (i.e. toString for debugging purposes). Very cool is the cid() method which returns a unique long value for each class. Use that before casting to specific type. The equals method is responsible for comparision between two instances. Hash() will return a pseudo unique long value.
long BGObject::cid () |
Returns unique class identifier.
virtual BGString BGObject::toString () [pure virtual]
|
Generates string representation of this object.
This is useful for logging, etc. - This method will replace dump !
Reimplemented in BGArray, BGInetAddress, BGServerSocket, BGSocket, and BGString.
virtual unsigned long BGObject::hash () [pure virtual]
|
Generates a 'unique' hashvalue of this object.
Note: The returned pointer will point to class buffer. Therefore do not delete it, dupe it if you need it outside of instance lifecycle.
Reimplemented in BGArray, BGInetAddress, BGServerSocket, BGSocket, and BGString.
virtual bool BGObject::equals (BGObject & obj) [pure virtual]
|
Returns true, if specified object is equal to own instance.
First we compare class identifier. If both object has same class type, we dispatch to compare method, which should always be able to compare instances with same type.
obj | Object reference to compare with us |
Reimplemented in BGArray, BGInetAddress, BGServerSocket, BGSocket, and BGType.
virtual BGString BGObject::className () [pure virtual]
|
Return the class name for this class.
Subclasses should overwrite this method to return their own name.
Reimplemented in BGArray, BGInetAddress, BGServerSocket, BGSocket, and BGString.