Chapter 3:
Graph Structure Management Functions
 

The graph structure management functions are executed once for each graph that your application draws. Memory must be allocated as part of the initialization process for each graph. The memory must be freed when your application is finished with the graph.

 

AllocGraphPtr(); Allocate a Graph Pointer

 

FreeGraphPtr(); Free Graph Pointer

   

AllocGraphPtr()

 

This function creates a graph structure and returns a pointer to the structure. A graph pointer must be allocated for each graph created by your application. The return value GraphPtr is used by all other API calls requiring a graph pointer. You can create as many graph structures as is required by your application within the limits of your computer's memory.

Syntax:

GraphPtr PUBLIC
     AllocGraphPtr (
     void
);

Input:

None

Return:

GraphPtr

 

NULL = Allocation unsuccessful, do not use the pointer.

 

Non-zero = Valid graph pointer.

Notes:

This function allocates approximately 7K of memory for each graph pointer. The memory allocated by AllocGraphPtr() must be freed by FreeGraphPtr(). The graph structure is not directly available to your program. Your application controls the graph structure using APIs available through the library.

Example:

GraphPtrIDH_GraphPtr gpGraph;
gpGraph = AllocGraphPtr();
if(!gpGraph)
     /* process error */

Also See:

AccGraphDataStatus(), FreeGraphPtr()

FreeGraphPtr()

 

This routine disposes of the storage used for a Graph structure. It is called when the structure is no longer needed.

Syntax:

void PUBLIC
FreeGraphPtr (
     GraphPtr pGraph
);

Input:

pGraph: A graph pointer allocated by AllocGraphPtr()

Return:

None

Example:

status = Load_TIFFGraphPath (
     &iopath,
     pNewGraph, nCloneMode);
/* kill the ram file */
IOclose(&iopath);
FreeRamFile(pRamFile);
if (status)
{
     FreeGraphPtr(pNewGraph);
     pNewGraph = 0L;
     return pNewGraph;
}

Also See:

AllocGraphPtr()