BLOC Generic Objects
The BLOC library allows programs to implement and manage what it refers to as objects.
An object is an instance of a data structure combined with its supporting routines.
Every object that is managed is also instantiated by the library, using an ObjectType structure.
Programs may declare as many of these structures as they need to represent all of the object types they wish to implement.
This structure describes and implements the attributes and functions an object needs.
Using an instance of this structure, the library can create new objects and initialise them properly before handing them back to the calling code.
A family of functions exist for managing objects, the prototypes for which can be found in BLOC/object.h.
A description of all of these functions and structures can be found in this directory too.
All objects created by the library can be operated on with the generic functions and macros provided by the library. These functions are type agnostic since they operate on an internal header structure placed just before the object in memory. When an object is created, the library allocates enough room for its own metadata as well as for the object. This does, however, mean that objects cannot be copied using memcpy or any similar techniques, since that will omit the object header.
Object Types
Every object has several minimal requirements, which include a structure and an ObjectType instance.
If the object is private (i.e. can only be operated on with defined functions), then the structure can exist in the C file implementing the object.
Otherwise, it will have to appear in a header file along side the external ObjectType declaration.
More infomation about the ObjectType structure can be found here.