libSBML C++ API  5.20.2
SBaseExtensionPoint 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 or SBMLDocumentPlugin) to a given package extension. For instance, an implementation of an extended version of Model (e.g., LayoutModelPlugin in the Layout package) would involve the creation of an extension point using SBaseExtensionPoint and a mediator object created using SBasePluginCreator, to "plug" the extended Model object (LayoutModelPlugin) into the overall LayoutExtension object.

The use of SBaseExtensionPoint is relatively straightforward. The class needs to be used for each extended SBML object implemented using SBMLDocumentPlugin or SBasePlugin. 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 is implemented, the relevant type code is SBMLTypeCode_t::SBML_MODEL, found in SBMLTypeCode_t.

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

SBaseExtensionPoint docExtPoint("core", SBML_DOCUMENT);
SBaseExtensionPoint modelExtPoint("core", SBML_MODEL);
SBasePluginCreator<GroupsModelPlugin, GroupsExtension> modelPluginCreator(modelExtPoint, pkgURIs);
@ SBML_MODEL
Definition: SBMLTypeCodes.h:75
@ SBML_DOCUMENT
Definition: SBMLTypeCodes.h:68
Definition: SBaseExtensionPoint.h:65
Definition: SBasePluginCreator.h:64

The code above shows two core SBML components being extended: the document object, and the Model object. These extended objects are created elsewhere (not shown) as the GroupsSBMLDocumentPlugin and GroupsModelPlugin objects. The corresponding SBaseExtensionPoint objects are handed as arguments to the constructor for SBasePluginCreator to create the connection between the extended core components and the overall package extension (here, for the Groups package, with the GroupsExtension object).

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

Public Member Functions

SBaseExtensionPointclone () const
 Creates and returns a deep copy of this SBaseExtensionPoint object. More...
 
const std::string & getElementName () const
 the target element name More...
 
const std::string & getPackageName () const
 Returns the package name of this extension point. More...
 
virtual int getTypeCode () const
 Returns the libSBML type code of this extension point. More...
 
bool isElementOnly () const
 
SBaseExtensionPointoperator= (const SBaseExtensionPoint &rhs)
 
 SBaseExtensionPoint (const SBaseExtensionPoint &rhs)
 Copy constructor. More...
 
 SBaseExtensionPoint (const std::string &pkgName, int typeCode)
 Constructor for SBaseExtensionPoint. More...
 
 SBaseExtensionPoint (const std::string &pkgName, int typeCode, const std::string &elementName, bool elementOnly=false)
 Constructor for SBaseExtensionPoint. More...
 
virtual ~SBaseExtensionPoint ()
 Destroys this SBaseExtensionPoint object. More...
 

Private Attributes

std::string mElementName
 
bool mElementOnly
 
std::string mPackageName
 
int mTypeCode
 

Constructor & Destructor Documentation

◆ SBaseExtensionPoint() [1/3]

SBaseExtensionPoint::SBaseExtensionPoint ( const std::string &  pkgName,
int  typeCode 
)

Constructor for SBaseExtensionPoint.

The use of SBaseExtensionPoint is relatively straightforward. The class needs to be used for each extended SBML object implemented using SBMLDocumentPlugin or SBasePlugin. 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 and the mechanism supports this.
  • The libSBML type code assigned to the object being extended. For example, if an extension of Model is implemented, the relevant type code is SBML_MODEL, found in SBMLTypeCode_t.
Parameters
pkgNamethe short-form name of the parent package where that this package extension is extending.
typeCodethe type code of the object being extended.

◆ SBaseExtensionPoint() [2/3]

SBaseExtensionPoint::SBaseExtensionPoint ( const std::string &  pkgName,
int  typeCode,
const std::string &  elementName,
bool  elementOnly = false 
)

Constructor for SBaseExtensionPoint.

The use of SBaseExtensionPoint is relatively straightforward. The class needs to be used for each extended SBML object implemented using SBMLDocumentPlugin or SBasePlugin. 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 and the mechanism supports this.
  • The libSBML type code assigned to the object being extended. For example, if an extension of Model is implemented, the relevant type code is SBML_MODEL, found in SBMLTypeCode_t.
Parameters
pkgNamethe short-form name of the parent package where that this package extension is extending.
typeCodethe type code of the object being extended.
elementNameelement name for the target element, in case multiple elements match the same type code (as will be the case for ListOf classes).
elementOnlyflag to be used during the registration of the package, when set then the plugin is only applied to elements whose elementName match.

◆ ~SBaseExtensionPoint()

SBaseExtensionPoint::~SBaseExtensionPoint ( )
virtual

Destroys this SBaseExtensionPoint object.

◆ SBaseExtensionPoint() [3/3]

SBaseExtensionPoint::SBaseExtensionPoint ( const SBaseExtensionPoint rhs)

Copy constructor.

This creates a copy of an SBaseExtensionPoint instance.

Parameters
rhsthe object to copy.

Member Function Documentation

◆ clone()

SBaseExtensionPoint * SBaseExtensionPoint::clone ( ) const

Creates and returns a deep copy of this SBaseExtensionPoint object.

Returns
the (deep) copy of this SBaseExtensionPoint object.

◆ getElementName()

const std::string & SBaseExtensionPoint::getElementName ( ) const

the target element name

◆ getPackageName()

const std::string & SBaseExtensionPoint::getPackageName ( ) const

Returns the package name of this extension point.

◆ getTypeCode()

int SBaseExtensionPoint::getTypeCode ( ) const
virtual

Returns the libSBML type code of this extension point.

◆ isElementOnly()

bool SBaseExtensionPoint::isElementOnly ( ) const

◆ operator=()

SBaseExtensionPoint & SBaseExtensionPoint::operator= ( const SBaseExtensionPoint rhs)

Member Data Documentation

◆ mElementName

std::string SBaseExtensionPoint::mElementName
private

◆ mElementOnly

bool SBaseExtensionPoint::mElementOnly
private

◆ mPackageName

std::string SBaseExtensionPoint::mPackageName
private

◆ mTypeCode

int SBaseExtensionPoint::mTypeCode
private