libSBML C API  5.18.0
SBaseExtensionPoint_t Class Reference

Detailed Description

Base class for extending SBML components

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.

This class is used as part of the mechanism that connects plugin objects (implemented using SBasePlugin_t or SBMLDocumentPlugin_t) to a given package extension. For instance, an implementation of an extended version of Model_t (e.g., LayoutModelPlugin_t in the Layout package) would involve the creation of an extension point using SBaseExtensionPoint_t and a mediator object created using SBasePluginCreator_t, to "plug" the extended Model_t object (LayoutModelPlugin_t) into the overall LayoutExtension_t object.

The use of SBaseExtensionPoint_t is relatively straightforward. The class needs to be used for each extended SBML object implemented using SBMLDocumentPlugin_t or SBasePlugin_t. Doing so requires knowing just two things:

  • The short-form name of the parent package being extended. The parent package is often simply core SBML, identified in libSBML by the nickname "core", but a SBML Level 3 package could conceivably extend another Level 3 package.
  • The libSBML type code assigned to the object being extended. For example, if an extension of Model_t is implemented, the relevant type code is SBMLTypeCode_t::SBML_MODEL, found in SBMLTypeCode_t.

The typical use of SBaseExtensionPoint_t is illustrated by the following code fragment:

SBaseExtensionPoint_t docExtPoint("core", SBML_DOCUMENT);
SBaseExtensionPoint_t modelExtPoint("core", SBML_MODEL);
SBasePluginCreator_t<GroupsModelPlugin_t, GroupsExtension_t> modelPluginCreator(modelExtPoint, pkgURIs);

The code above shows two core SBML components being extended: the document object, and the Model_t object. These extended objects are created elsewhere (not shown) as the GroupsSBMLDocumentPlugin_t and GroupsModelPlugin_t objects. The corresponding SBaseExtensionPoint_t objects are handed as arguments to the constructor for SBasePluginCreator_t to create the connection between the extended core components and the overall package extension (here, for the Groups package, with the GroupsExtension_t object).

The code above is typically placed in the implementation of the init() method of the package class derived from SBMLExtension_t. (For the example above, it would be in the GroupsExtension.cpp file.)

Public Member Functions

SBaseExtensionPoint_tSBaseExtensionPoint_clone (const SBaseExtensionPoint_t *extPoint)
 Creates a deep copy of the given SBaseExtensionPoint_t structure. More...
 
SBaseExtensionPoint_tSBaseExtensionPoint_create (const char *pkgName, int typeCode)
 Creates a new SBaseExtensionPoint_t structure with the given arguments. More...
 
int SBaseExtensionPoint_free (SBaseExtensionPoint_t *extPoint)
 Frees the given SBaseExtensionPoint_t structure. More...
 
char * SBaseExtensionPoint_getPackageName (const SBaseExtensionPoint_t *extPoint)
 Returns the package name for the given SBaseExtensionPoint_t structure. More...
 
int SBaseExtensionPoint_getTypeCode (const SBaseExtensionPoint_t *extPoint)
 Returns the type code for the given SBaseExtensionPoint_t structure. More...
 

Member Function Documentation

SBaseExtensionPoint_t * SBaseExtensionPoint_clone ( const SBaseExtensionPoint_t extPoint)

Creates a deep copy of the given SBaseExtensionPoint_t structure.

Parameters
extPointthe SBaseExtensionPoint_t structure to be copied.
Returns
a (deep) copy of the given SBaseExtensionPoint_t structure.
SBaseExtensionPoint_t * SBaseExtensionPoint_create ( const char *  pkgName,
int  typeCode 
)

Creates a new SBaseExtensionPoint_t structure with the given arguments.

Parameters
pkgNamethe package name for the new structure.
typeCodethe SBML Type code for the new structure.
Returns
the newly created SBaseExtensionPoint_t structure or NULL in case the given pkgName is invalid (NULL).
int SBaseExtensionPoint_free ( SBaseExtensionPoint_t extPoint)

Frees the given SBaseExtensionPoint_t structure.

Parameters
extPointthe SBaseExtensionPoint_t structure to be freed.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
char * SBaseExtensionPoint_getPackageName ( const SBaseExtensionPoint_t extPoint)

Returns the package name for the given SBaseExtensionPoint_t structure.

Parameters
extPointthe SBaseExtensionPoint_t structure.
Returns
the package name for the given SBaseExtensionPoint_t structure or NULL.
int SBaseExtensionPoint_getTypeCode ( const SBaseExtensionPoint_t extPoint)

Returns the type code for the given SBaseExtensionPoint_t structure.

Parameters
extPointthe SBaseExtensionPoint_t structure.
Returns
the type code for the given SBaseExtensionPoint_t structure or LIBSBML_INVALID_OBJECT in case an invalid object is given.