Function CDM_SpanSetGetElements


Definition:#include <CDM.h>
Prototype:int CDM_SpanSetGetElements(CDM_SpanSet SpanSet, int *objcPtr, CDM_Span **objvPtr);
Arguments:

SpanSet: The Span set whose elements will be placed in the array. (CDM_SpanSet)
objcPtr: A pointer to an integer, where the number of Span objects placed in the array will be saved. (int *)
objvPtr: A location where the pointer to the array of Span objects will be stored. (CDM_Span **)

C/C++ API Sections
Tcl API Sections
Description
Return Value
Notes
See Also
Index

Description:

This function returns a count and a pointer to an array of the elements (Spans) in an Span set object (of type CDM_SpanSet). It returns the count by storing it in the address pointed by the "objcPtr" parameter (of type int *). Similarly, it returns the array pointer by storing it in the address pointed by the "objvPtr" parameter (of type CDM_Span **). The memory pointed to is managed by CDM and should not be freed by the caller.

In case of an error, TCL_ERROR will be returned and an error message will be left in the current active Tcl interpreter (CDM_Interp). Otherwise TCL_OK will be returned after storing the count and array pointer.

Return Value:

This function returns a count and a pointer to an array of the elements (Spans) in an Span set object (of type CDM_SpanSet). It returns the count by storing it in the address pointed by the "objcPtr" parameter (of type int *). Similarly, it returns the array pointer by storing it in the address pointed by the "objvPtr" parameter (of type CDM_Span **). The memory pointed to is managed by CDM and should not be freed by the caller.

In case of an error, TCL_ERROR will be returned and an error message describing the error will be left at the current Tcl interpreter (CDM_Interp). Otherwise TCL_OK will be returned.

Notes:

Usage example:
      int objc;
      CDM_Span **objv;
      CDM_SpanSet set = CDM_GetSpans(Annotation);
      int status = CDM_SpanSetGetElements(set, objc, objv);
      if (status != TCL_OK) {
        // An error occured. What is the error message?
        Tcl_interp *interp = CDM_GetActiveInterpreter();
        if (interp) {
          const char* msg = Tcl_GetStringResult(interp);
        }
      }
      // Make an iteration over all Spans...
      for (int i = 0; i < objc, i++) {
        // Now, objv[i] is an Span...
      }
      

See Also:

CDM_AttributeSetGetElements, CDM_AnnotationSetGetElements


Generated by: petasis@aias on Wed Aug 16 10:31:57 PM EEST 2006.