|
Zen API
|
Root of all Zen classes.
The kObject class provides infrastructure to support object destruction, reference counting, and type introspection.
The kObject_Destroy method can be used to destroy an instance of any class. The kObject_Dispose method provides support for recursive destruction, often used in conjunction with Zen data collections. Refer to Object Destruction for more information.
The kObject_Clone method can be used to create a deep copy of an object. The implementation of this method requires additional support from derived types; refer to the documentation for a specific derived type to determine whether cloning is supported.
The kObject_Clone and kObject_Dispose methods are often used together to manage collections of data objects:
All kObject-derived instances are reference counted. The kObject_Share method can optionally be used to increment an object's reference count, while the kObject_Destroy/kObject_Dispose methods are always used to decrement an object's reference count. Refer to Reference Counting for more information.
The kObject_Type method can be used to access type information for any kObject instance. The kType object returned by this method can be used to learn about the object's class, including its name, base classes, implemented interfaces, and methods. The kObject_Is method provides a convenient way to determine whether an object derives from a specific base class or implements an interface.
The kObject_Equals and kObject_HashCode methods can be helpful for object comparisons, but require support from derived types and are infrequently overridden. The kString class overrides both of these methods to support the use of kString objects as hash keys in kMap data collections.
Inherited by kAlloc, kArray1, kArray2, kArray3, kArrayList, kAssembly, kBackTrace, kBox, kDirectory, kDynamicLib, kEvent, kHttpServer, kHttpServerChannel, kHttpServerRequest, kHttpServerResponse, kImage, kList, kLock, kMap, kMath, kMsgQueue, kNetwork, kPath, kPeriodic, kPlugin, kQueue, kSemaphore, kSerializer, kSocket, kStream, kString, kTcpServer, kThread, kTimer, kType, kUtils, and kXml.
Public Member Functions | |
| kAlloc | kObject_Alloc (kObject object) |
| Gets the memory allocator associated with this object. More... | |
| kStatus | kObject_Clone (kObject *object, kObject source, kAlloc allocator) |
| Constructs a new object by copying an existing object, including any aggregated child elements. More... | |
| kStatus | kObject_Destroy (kObject object) |
| Destroys the object. More... | |
| kStatus | kObject_Dispose (kObject object) |
| Destroys the object and any aggregated child elements. More... | |
| kBool | kObject_Equals (kObject object, kObject other) |
| Determines whether the object is equal to another object. More... | |
| kSize | kObject_HashCode (kObject object) |
| Gets a hash code representing the state of this object. More... | |
| kBool | kObject_Is (kObject object, kType type) |
| Determines whether this object is an instance of the specified type. More... | |
| kBool | kObject_IsShared (kObject object) |
| Reports whether the object is currently shared (reference count greater than one). More... | |
| kStatus | kObject_SetPool (kObject object, kObjectPool pool) |
| Sets the object pool associated with this object. More... | |
| kStatus | kObject_Share (kObject object) |
| Increments the reference count associated with this object. More... | |
| kSize | kObject_Size (kObject object) |
| Estimates the memory consumed by this object, including any aggregated child elements. More... | |
| kType | kObject_Type (kObject object) |
| Returns the type of the object. More... | |
Related | |
| #define | kObject_Type_(OBJ) kxObject_Type_(OBJ) |
| Macro version of kObject_Type. | |
| #define | kObject_Is_(OBJ, TYPE) kxObject_Is_(OBJ, TYPE) |
| Macro version of kObject_Is. | |
| #define | kObject_Alloc_(OBJ) kxObject_Allocator_(OBJ) |
| Macro version of kObject_Alloc. | |