Up: GEOS SDK TechDocs | Up | Prev: ObjCompFindChildByOptr() ... | Next: ObjDeref() ...

ObjCompProcessChildren()

Boolean	ObjCompProcessChildren(
        optr		obj,				/* parent's optr */
        optr		firstChild,				/* optr of first child to process */
        ObjCompCallType		stdCallback,				/* standard callback type */
        void 		* cbData,				/* data passed to callback */
        word		masterOffset,				/* offset to master part */
        word		compOffset,				/* offset to comp field */
        word		linkOffset);				/* offset to link field */
        Boolean _pascal (*callback) (optr parent, optr child, void *cbData));

This routine performs a specific set of actions on all or some of an object's children. It is very rare that you will use this routine; typically, you should send a message to all of the parent's children. If, however, you use this routine, you must also write a callback routine that will be executed once for each affected child.

ObjCompProcessChildren() returns true (nonzero) only if it was stopped before all children had been processed. The only two ways this could be returned is if an error occurs or if your callback returns true when called.

The parameters for this routine are

obj
The optr of the composite whose children are to be processed.
firstChild
The optr of the first child to be processed. This routine will begin with the passed child and continue with all subsequent children. Pass the optr of the composite's first child--retrieved with the routine ObjCompFindChildByNumber() --to process all children.
stdCallback
A value of ObjCompCallType indicating how the data in the buffer pointed to by cbData will be passed to your callback routine. These values are detailed below.
cbData
A pointer to a buffer in which data can be passed to your callback routine. This buffer can be altered by your callback.
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.)
compOffset
The offset within the parent's instance chunk to the composite field.
linkOffset
The offset within the parent's instance chunk to the link field.
callback
A pointer to the actual callback routine that will be executed once for each child. The callback should be in your geode's fixed memory. The parameters and return values for the callback routine are given below.

The callback routine takes three parameters and returns a boolean value. It must be declared _pascal. The three parameters to the callback are listed below:

parent
The optr of the parent composite.
child
The optr of the current child being processed.
cbData
A pointer to the buffer passed by the original caller of ObjCompProcessChildren() . What is actually in this buffer may depend on the value in the original sdtCallback parameter; if the buffer is not saved and restored by ObjCompProcessChildren() between children, each child may receive data altered by the previous child.

The callback routine can access and alter the buffer pointed to by cbData , or it can query the child or do anything else with the exception of destroying the child. It should return a Boolean value: true if ObjCompProcessChildren() should be aborted, false if it should not.

The values you can pass to ObjCompProcessChildren() in stdCallback are of type ObjCompCallType . You can use one of the following values to specify how the buffer in cbData will be passed on to the next child's callback routine:

OCCT_SAVE_PARAMS_TEST_ABORT
Save the buffer passed in cbData before calling each child; abort the routine if the callback returns true .
OCCT_SAVE_PARAMS_DONT_TEST_ABORT
Save the buffer passed in cbData before calling each child; do not check the return value of the callback before proceeding to the next child.
OCCT_DONT_SAVE_PARAMS_TEST_ABORT
Do not save the buffer in cbData , and abort if the callback routine returns true .
OCCT_DONT_SAVE_PARAMS_DONT_TEST_ABORT
Do not save the buffer in cbData , and do not check the callback routine's return value.
OCCT_ABORT_AFTER_FIRST
Abort the processing after only one child (typically used to call the nth child).
OCCT_COUNT_CHILDREN
Counts the number of children rather than calling each.

Include: metaC.goh

See Also: @send, @call, MSG_META_SEND_CLASSED_EVENT.

ObjCompRemoveChild()

void	ObjCompRemoveChild(
        optr	obj,		/* parent's optr */
        optr	objToRemove		/* optr of child to be removed */
        word	flags,		/* CompChildFlags */
        word	masterOffset,		/* offset to master part */
        word	compOffset,		/* offset to comp field in master part */
        word	linkOffset);		/* offset to link field in master part */

This routine removes the given child from the specified parent composite. The child will be removed entirely from the object tree, but it will not be detached or freed. The parameters of this routine are listed below:

obj
The optr of the parent composite.
objToRemove
The optr of the child to be removed.
flags
A record of CompChildFlags indicating whether the parent and child should be marked dirty after the operation.
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.)
compOffset
The offset within the parent's instance chunk to the composite field.
linkOffset
The offset within the parent's instance chunk to the link field.

Include: metaC.goh

ObjDecInteractibleCount()

void	ObjDecInteractibleCount(
        MemHandle mh);			/* subject object block */

This routine decrements the given object block's interactable count. Do not decrement the interactable count without first incrementing it with ObjIncInteractibleCount() . Visible objects automatically decrement the interactable count in their MSG_VIS_CLOSE handlers.

Include: object.h

See Also: ObjIncInteractibleCount(), MSG_VIS_CLOSE, ObjLMemBlockHeader.

ObjDecInUseCount()

void	ObjDecInUseCount(
        MemHandle mh);		/* subject object block */

This routine decrements the given object block's in-use count. When the in-use count reaches zero, the block may safely be freed. You should not decrement the in-use count of a block without first incrementing it at some point with ObjIncInUseCount() .

Warnings: Do not decrement the in-use count without incrementing it first. An error will result.

Include: object.h

See Also: ObjIncInUseCount(), ObjDecInteractibleCount(), ObjLMemBlockHeader.


Up: GEOS SDK TechDocs | Up | Prev: ObjCompFindChildByOptr() ... | Next: ObjDeref() ...