Up: GEOS SDK TechDocs | Up | Prev: ObjFreeChunk() ... | Next: ObjIsClassADescendant() ...

ObjInitDetach()

void	ObjInitDetach(
        MetaMessages 		msg,
        optr		obj			/* object being detached */
        word		callerID,			/* an identifier token for the caller */
        optr		ackOD);			/* object to which ack is sent */

Initialize the detach sequence for the specified object. The detach sequence severs all ties between the system and the object, allowing it to be destroyed without other objects or geodes trying to contact it. It is highly unlikely you will ever call this routine; typically, you will instead use MSG_META_DETACH or one of the generic or visible object messages, which will call this routine. The parameters for this routine are

msg
The detach message.
obj
The optr of the object to be detached.
callerID
The caller object's ID.
ackOD
The optr of the caller object or another object which is to receive acknowledgment notification of the detach.

Include: metaC.goh

See Also: MSG_META_DETACH, MSG_GEN_DESTROY, MSG_VIS_REMOVE, ObjIncDetach(), ObjEnableDetach(), MSG_META_ACK.

ObjInitializeMaster()

void	ObjInitializeMaster(
        optr 		obj,				/* object to be initialized */
        ClassStruct		* class);				/* class in master group */

This routine initializes the appropriate master part of the passed object, resizing the instance chunk if necessary. It takes two parameters:

obj
The optr of the object whose master part is to be initialized.
class
A pointer to the class definition of a class in the appropriate master group. This does not have to be the master class; it must only be a class in the master goup.

Warnings: This routine may resize and/or move chunks or object blocks, thereby invalidating pointers and segment addresses.

Include: object.h

See Also: ObjResizeMaster(), ObjInitializePart(), ClassStruct.

ObjInitializeMasterHandles()

void	ObjInitializeMasterHandles(
        MemHandle		mh,				/* handle portion of optr */
        ChunkHandle		ch,				/* chunk portion of optr */
        ClassStruct		* class);				/* class in master group */

This routine is the same as ObjInitializeMaster() except it specifies the object via its handles rather than its optr.

Include: object.h

ObjInitializePart()

void	ObjInitializePart(
        optr 	obj,			/* object to have a part initialized */
        word	masterOffset);			/* offset to master offset in chunk */

This routine initializes all master parts of the given object down to and including the master part specified in masterOffset . It will resize the chunk if necessary and even resolve variant classes above the master group specified, if necessary. This routine takes two parameters:

obj
The optr of the object to be initialized.
masterOffset
The offset within the parent's instance chunk to the master group's offset (the value that would appear in the parent class' Class_masterOffset field in its ClassStruct structure).

Warnings: This routine may move and/or resize chunks or object blocks, thereby invalidating pointers and segment addresses.

Include: object.h

See Also: ObjResizeMaster(), ObjInitializeMaster(), MSG_META_RESOLVE_VARIANT_SUPERCLASS.

ObjInitializePartHandles()

void	ObjInitializePartHandles(
        Memhandle		mh,					/* handle portion of optr */
        ChunkHandle		ch,					/* chunk portion of optr */
        word		masterOffset);					/* master group offset */

This routine is the same as ObjInitializePart() except that it specifies the object via its handles rather than an optr.

Include: object.h

ObjInstantiate()

optr	ObjInstantiate(
        MemHandle		block,				/* block in which new object
						 * will be instantiated */
        ClassStruct		* class);				/* class of new object */

This routine instantiates a new object, allocating the proper size instance chunk. It returns the optr of the new object; this optr can then be used to send setup messages or other messages (such as adding the object to an object tree, setting it usable, etc.).

The new object's instance data will be initialized to all zeroes if it has no master parts (is a direct descendant of MetaClass ). If it is a member of some master group, only enough space for the base structure (the master offsets and the class pointer) will be allocated. In either case, initialization of the instance data will occur at a later time.

ObjInstantiate() takes two parameters:

block
The memory handle of an object block in which the object's instance chunk will be allocated. This block must be an object block, though it need not be run by the caller's thread. If the block is run by another thread, the routine will be executed as a remote call.
class
A pointer to the ClassStruct structure of the class of the new object. This pointer will be set in the object's class pointer (the first four bytes of the instance chunk).

Warnings: This routine, because it allocates a new chunk, may cause LMem and Object blocks to move or resize, thereby invalidating any pointers and segment addresses. Be sure to dereference pointers after calls to this routine.

Include: object.h

See Also: ObjInstantiateForThread().

ObjInstantiateForThread()

optr	ObjInstantiateForThread(
        ThreadHandle		thread,				/* thread to run new object */
        ClassStruct		*class);				/* class of new object */

This routine is similar to ObjInstantiate() except you pass the thread to run the new object rather than the memory handle to an object block (to store the new object). To specify the current thread, pass "0" in thread. This routine automatically allocates memory blocks as needed. It returns the optr to the new object.

Include: object.h

See Also: ObjInstantiate().


Up: GEOS SDK TechDocs | Up | Prev: ObjFreeChunk() ... | Next: ObjIsClassADescendant() ...