Root of UTL++ class hierarchy.
More...
#include <Object.h>
Inherited by utl::Number< double >, utl::Span< Time, Duration >, utl::TCollection< Vertex >, utl::Application, utl::ArithContext, utl::Base64decode, utl::Base64encode, utl::BBcodeParser, utl::BitArray, utl::BitArrayElem, utl::Bool, utl::BoyerMooreSearch< T >, utl::CachedObject, utl::CmdLineArgs, utl::Collection, utl::ConditionVar, utl::CRC32, utl::DBconnection, utl::DBfield, utl::DBresult, utl::DBresultIterator, utl::Decimal, utl::Exception, utl::ExtArray, utl::Factory, utl::FSobject, utl::FwdIt, utl::HostOS, utl::HttpRequest, utl::HttpResponse, utl::InetHostAddress, utl::LogMgr, utl::Mapping, utl::MaxObject, utl::MD5, utl::MD5sum, utl::Mutex, utl::Number< T >, utl::ObjectRegistry, utl::Ordering, utl::OStimer, utl::Pair, utl::Predicate, utl::RDparser, utl::ReCaptcha, utl::RegexMatch, utl::RWlock, utl::RWlockLF, utl::Semaphore, utl::ServerSocket, utl::SHA256, utl::SHA256sum, utl::Span< T, D >, utl::Stream, utl::String, utl::StringEscape, utl::StringTranslator, utl::StringVars, utl::TCollection< T >, utl::Thread, utl::Time, utl::Tokenizer, utl::TokenizerTokens, utl::UnixModeMask, utl::URI, utl::Vector< T >, utl::VectorMD< T >, utl::Vertex, utl::Vector< byte_t >, utl::Vector< uint_t >, utl::Vector< utl::Object *>, and utl::Vector< utl::PointerIntPair >.
|
void | serializeIn (Stream &is, uint_t mode=ser_default) |
| Serialize from an input stream. More...
|
|
void | serializeOut (Stream &os, uint_t mode=ser_default) const |
| Serialize to an output stream. More...
|
|
virtual void | serialize (Stream &stream, uint_t io, uint_t mode=ser_default) |
| Serialize to or from a stream. More...
|
|
void | serializeOutBoxed (Stream &os, uint_t mode=ser_default) const |
| Serialize a boxed object to an output stream. More...
|
|
static Object * | serializeInNullable (Stream &is, uint_t mode=ser_default) |
| Serialize a nullptr-able object from an input stream. More...
|
|
static void | serializeOutNullable (const Object *object, Stream &os, uint_t mode=ser_default) |
| Serialize a nullptr-able object to an output stream. More...
|
|
static void | serializeNullable (Object *&object, Stream &stream, uint_t io, uint_t mode=ser_default) |
| Serialize a nullptr-able object to or from a stream. More...
|
|
static Object * | serializeInBoxed (Stream &is, uint_t mode=ser_default) |
| Serialize a boxed object from an input stream. More...
|
|
static void | serializeBoxed (Object *&object, Stream &stream, uint_t io, uint_t mode=ser_default) |
| Serialize a boxed object to or from a stream. More...
|
|
Root of UTL++ class hierarchy.
Object provides a standard interface for functionality that is very commonly required. Most notably, Object defines virtual methods for functionality such as:
- copying
- comparison
- serialization
- dumping (e.g. for debugging purposes)
- run-time type identification (RTTI)
When you use the UTL_CLASS_DECL and UTL_CLASS_IMPL macros (macros.h) with your classes, the following methods are implemented for you:
- default constructor - calls init()
- copy constructor - calls init(), then copy()
- virtual destructor - calls deInit()
- clone - create copy of self (via copy())
- create - create new instance of same class
- operator= - copy another object (calls copy())
- pointer conversion - conversion to pointer
- const pointer conversion - conversion to const pointer
- getClass (virtual) - get self's class
- getClassName (virtual) - get the name of self's class
- getThisClass - get self's class
- getThisClassName - get the name of self's class
- getBaseClass - get the base class
- getBaseClassName - get the name of the base class
- Author
- Adam McKee
- See also
- RunTimeClass
Definition at line 52 of file Object.h.
◆ clear()
void utl::Object::clear |
( |
| ) |
|
◆ compare()
virtual int utl::Object::compare |
( |
const Object & |
rhs | ) |
const |
|
virtual |
Compare with another object.
If no overridden version succeeds in doing the comparison, then an attempt will be made to re-start the comparison process using one or both of the objects' keys. Usually, an override of compare() should call the superclass's compare() if it doesn't know how to compare itself with the rhs object.
- See also
- getKey
- Returns
- < 0 if self < rhs, 0 if self = rhs, > 0 if self > rhs
- Parameters
-
rhs | object to compare with |
Reimplemented in utl::Time, utl::Regex, utl::HttpResponse, utl::Directory, utl::SHA256sum, utl::Decimal, utl::Vector< T >, utl::Vector< utl::PointerIntPair >, utl::Vector< utl::Object *>, utl::Vector< byte_t >, utl::Vector< uint_t >, utl::URI, utl::String, utl::Pair, utl::Span< T, D >, utl::Span< Time, Duration >, utl::FileSpec, utl::InetHostAddress, utl::BitArray, utl::TimeSpan, utl::Predicate, utl::SortedCollection, utl::FSobject, utl::DBfield, utl::BinTreeBfsIt, utl::BinTreeIt, utl::Symlink, utl::MD5sum, utl::HttpRequest, utl::Bool, utl::Float, utl::ArrayIt, utl::UnixModeMask, utl::DequeIt, utl::HashtableIt, utl::SkipListIt, utl::TCollection< T >, utl::Token, utl::TCollection< Vertex >, utl::HeapIt, utl::ListIt, utl::Number< T >, utl::Number< double >, utl::FwdIt, utl::StringVars, utl::VectorMD< T >, utl::TBidIt< T >, utl::TFwdIt< T >, utl::TRandIt< T >, utl::MaxObject, utl::ServerSocket, and utl::CRC32.
Referenced by utl::SpanSizeOrdering< T, D >::cmp(), utl::compare(), utl::compareNullable(), and utl::Collection::operator()().
◆ copy()
virtual void utl::Object::copy |
( |
const Object & |
rhs | ) |
|
|
virtual |
Copy another instance.
When you override copy(), you should usually call the superclass's copy().
- Parameters
-
Reimplemented in utl::ScanEx, utl::MultiKeyOrdering, utl::ParseEx, utl::BinaryPredicate, utl::Vector< T >, utl::Vector< utl::PointerIntPair >, utl::Vector< utl::Object *>, utl::Vector< byte_t >, utl::Vector< uint_t >, utl::ParseNode, utl::Time, utl::UnaryPredicate, utl::Regex, utl::Array, utl::Exception, utl::HttpResponse, utl::RDparser, utl::MD5, utl::Directory, utl::SHA256sum, utl::Decimal, utl::Collection, utl::Stream, utl::String, utl::URI, utl::Pair, utl::Span< T, D >, utl::Span< Time, Duration >, utl::FileSpec, utl::InetHostAddress, utl::BufferedStream, utl::BitArray, utl::FSobject, utl::TCollection< T >, utl::TCollection< Vertex >, utl::BinTreeBfsIt, utl::BinTreeIt, utl::Symlink, utl::ArithContext, utl::ArrayIt, utl::DBfield, utl::MD5sum, utl::BitArrayElem, utl::HttpRequest, utl::Vertex, utl::Bool, utl::DequeIt, utl::HashtableIt, utl::SkipListIt, utl::UnixModeMask, utl::Token, utl::HeapIt, utl::ListIt, utl::IOmux, utl::Tokenizer, utl::FwdIt, utl::Number< T >, utl::Number< double >, utl::StringVars, utl::TBidIt< T >, utl::TFwdIt< T >, utl::TRandIt< T >, utl::VectorMD< T >, utl::SpanAllocator< T, D >, utl::FSobjectFilter, and utl::CRC32.
◆ vclone()
virtual void utl::Object::vclone |
( |
const Object & |
rhs | ) |
|
|
virtual |
Make an exact copy of another instance.
The default implementation just calls copy(), so you have to override this if you want different behavior for copy construction and cloning.
Reimplemented in utl::Hashtable, utl::Collection, and utl::Pair.
◆ steal()
virtual void utl::Object::steal |
( |
Object & |
rhs | ) |
|
|
virtual |
"Steal" the internal representation from another instance.
The default implementation just calls vclone(), so you have to override this if you want a "move" capability.
Reimplemented in utl::Vector< T >, utl::Vector< utl::PointerIntPair >, utl::Vector< utl::Object *>, utl::Vector< byte_t >, utl::Vector< uint_t >, utl::Regex, utl::Array, utl::Hashtable, utl::List, utl::Heap, utl::Collection, utl::SkipList, utl::String, utl::URI, utl::Pair, utl::FileSpec, utl::BitArray, utl::RBtree, utl::BinTree, utl::Token, utl::Deque, utl::TBidIt< T >, utl::TFwdIt< T >, and utl::TRandIt< T >.
Referenced by utl::TBidIt< T >::steal(), utl::TRandIt< T >::steal(), and utl::TFwdIt< T >::steal().
◆ dump()
◆ dumpWithClassName()
Front-end for dump() that prints the object's class name.
- Parameters
-
os | stream to dump to |
indent | (optional : 4) indent the object? |
level | level of 'verbosity' for the dump |
◆ getKey()
virtual const Object& utl::Object::getKey |
( |
| ) |
const |
|
virtual |
Get the key for this object.
The key for an object is used to re-start the comparison process when all overridden compare() have failed. Usually an object's key uniquely identifies the object, though it doesn't necessarily need to. By default, a class has no associated key.
- See also
- compare hasKey
- Returns
- object's key (= self if the object has no key)
Reimplemented in utl::NetServerClient, utl::Pair, utl::FSobject, utl::CachedObject, utl::Vertex, and utl::Thread.
Referenced by utl::SpanCol< T, D >::add(), utl::SpanAllocator< T, D >::alloc(), and utl::SpanSizeOrdering< T, D >::cmp().
◆ hasKey()
bool utl::Object::hasKey |
( |
| ) |
const |
|
inline |
Determine whether or not the object has a key.
- See also
- compare getKey
- Returns
- true iff the object has a key.
Definition at line 124 of file Object.h.
◆ getProxiedObject() [1/2]
virtual const Object& utl::Object::getProxiedObject |
( |
| ) |
const |
|
virtual |
◆ getProxiedObject() [2/2]
virtual Object& utl::Object::getProxiedObject |
( |
| ) |
|
|
virtual |
◆ hash()
virtual size_t utl::Object::hash |
( |
size_t |
size | ) |
const |
|
virtual |
◆ _isA()
bool utl::Object::_isA |
( |
const RunTimeClass * |
runTimeClass | ) |
const |
|
inline |
Determine whether self's class is a descendent of the given class.
The macro isA provides a more convenient usage.
- See also
- RunTimeClass
- Returns
- true iff self's class is a descendent of the given class
- Parameters
-
runTimeClass | class we are comparing with |
Definition at line 151 of file Object.h.
◆ serializeIn()
◆ serializeOut()
◆ serialize()
Serialize to or from a stream.
This is the only virtual method for serialization. You must override this in any class that has data to be serialized, and ensure that the superclass's serialize() gets called.
- Parameters
-
Reimplemented in utl::MultiKeyOrdering, utl::Vector< T >, utl::Vector< utl::PointerIntPair >, utl::Vector< utl::Object *>, utl::Vector< byte_t >, utl::Vector< uint_t >, utl::ObjectSpan< T, D >, utl::ObjectSpan< Time, Duration >, utl::BinaryPredicate, utl::Time, utl::UnaryPredicate, utl::Directory, utl::SHA256sum, utl::Collection, utl::Decimal, utl::TCollection< T >, utl::TCollection< Vertex >, utl::Pair, utl::String, utl::FileSpec, utl::InetHostAddress, utl::Span< T, D >, utl::Span< Time, Duration >, utl::FSobject, utl::BitArray, utl::Graph, utl::DBfield, utl::Symlink, utl::MD5sum, utl::Uint, utl::BinaryData, utl::Bool, utl::UnixModeMask, utl::Char, utl::Float, utl::Int, utl::Number< T >, utl::Number< double >, utl::StringVars, utl::SpanAllocator< T, D >, utl::VectorMD< T >, utl::FSobjectFilter, and utl::CRC32.
◆ serializeInNullable()
Serialize a nullptr-able object from an input stream.
- See also
- serializeInBoxed
- Returns
- newly created/serialized object (nullptr if none)
- Parameters
-
◆ serializeOutNullable()
Serialize a nullptr-able object to an output stream.
- See also
- serializeOutBoxed
- Parameters
-
object | object to serialize (can be nullptr) |
os | output stream to serialize to |
mode | see utl::serialize_t |
◆ serializeNullable()
Serialize a nullptr-able object to or from a stream.
- See also
- serializeBoxed
- Parameters
-
◆ serializeInBoxed()
Serialize a boxed object from an input stream.
Create a new object from scratch, given the classname and serialized data read from the input stream.
- Returns
- newly created/serialized object (nullptr if none)
- Parameters
-
◆ serializeOutBoxed()
Serialize a boxed object to an output stream.
The object's classname is written to the stream first, so that serializeInBoxed() will be able to re-create the object from scratch.
- Parameters
-
◆ serializeBoxed()
◆ toString()
virtual String utl::Object::toString |
( |
| ) |
const |
|
virtual |
Return a string representation of self.
Reimplemented in utl::Collection, utl::Time, utl::ObjectSpan< T, D >, utl::ObjectSpan< Time, Duration >, utl::TCollection< T >, utl::TCollection< Vertex >, utl::SHA256sum, utl::Decimal, utl::String, utl::Duration, utl::Pair, utl::URI, utl::InetHostAddress, utl::FSobject, utl::Span< T, D >, utl::Span< Time, Duration >, utl::MD5sum, utl::Symlink, utl::Bool, utl::BitArrayElem, utl::UnixModeMask, utl::Float, utl::Bytes, utl::Number< T >, utl::Number< double >, and utl::CRC32.
◆ operator String()
utl::Object::operator String |
( |
| ) |
const |
◆ allocatedSize()
size_t utl::Object::allocatedSize |
( |
| ) |
const |
Get the total allocated size of this object.
◆ innerAllocatedSize()
virtual size_t utl::Object::innerAllocatedSize |
( |
| ) |
const |
|
virtual |
Get the "inner" allocated size.
Reimplemented in utl::Array, utl::Hashtable, utl::Collection, utl::List, utl::Heap, utl::Vector< T >, utl::Vector< utl::PointerIntPair >, utl::Vector< utl::Object *>, utl::Vector< byte_t >, utl::Vector< uint_t >, utl::Pair, utl::SkipList, utl::String, utl::URI, utl::BitArray, utl::RBtree, utl::ObjectRegistry, utl::Deque, and utl::StringVars.
◆ operator<()
bool utl::Object::operator< |
( |
const Object & |
rhs | ) |
const |
|
inline |
◆ operator<=()
bool utl::Object::operator<= |
( |
const Object & |
rhs | ) |
const |
|
inline |
◆ operator>()
bool utl::Object::operator> |
( |
const Object & |
rhs | ) |
const |
|
inline |
◆ operator>=()
bool utl::Object::operator>= |
( |
const Object & |
rhs | ) |
const |
|
inline |
◆ operator==()
bool utl::Object::operator== |
( |
const Object & |
rhs | ) |
const |
|
inline |
◆ operator!=()
◆ addOwnedIt()
virtual void utl::Object::addOwnedIt |
( |
const class FwdIt * |
it | ) |
const |
|
virtual |
Notify self that it owns the given iterator.
◆ removeOwnedIt()
virtual void utl::Object::removeOwnedIt |
( |
const class FwdIt * |
it | ) |
const |
|
virtual |
Notify self that the given owned iterator has been destroyed.
The documentation for this class was generated from the following file: