Next: , Previous: Data Structures For ADTs, Up: Abstract Data Types


5.6.3 Access Functions For ADTs

Every access function implemented by an ADT should have a prototype conformant to the following convention:

     RETURN_TYPE pdf_FOO_* (pdf_FOO_t adt, args...)

where FOO is the name of the ADT.

The following standard functions shall be defined:

pdf_status_t pdf_FOO_new (args..., pdf_FOO_t *adt)
This is the function used to create a new instance of the ADT. The last parameter of the function should be a pointer to a pdf_FOO_t value. The returned status value should indicate the state of the operation.
pdf_FOO_destroy (pdf_FOO_t adt)
This is the function used to destroy an instance of the ADT. The memory occupied by the ADT data structure is freed.