libNuML 1.1.1
Library for reading / writing NuML documents
NMBase Class Referenceabstract

This is the base class for all numl objects. More...

#include <NMBase.h>

Inheritance diagram for NMBase:
NUMLDocument NUMLList OntologyTerm ResultComponent Dimension DimensionDescription OntologyTerms ResultComponents AtomicValue CompositeValue Tuple AtomicDescription CompositeDescription TupleDescription

Public Member Functions

virtual ~NMBase ()
 Destroy this object. More...
 
NMBaseoperator= (const NMBase &orig)
 Assignment operator for NMBase. More...
 
virtual bool accept (NUMLVisitor &v) const =0
 Accepts the given NUMLVisitor for this instance of NMBase. More...
 
virtual NMBaseclone () const =0
 Creates and returns a deep copy of this NMBase object. More...
 
const std::string & getMetaId () const
 Returns the value of the "metaid" attribute of this object. More...
 
std::string & getMetaId ()
 Returns the value of the "metaid" attribute of this object. More...
 
virtual const std::string & getId () const
 
virtual const std::string & getName () const
 
virtual LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces * getNamespaces () const
 Returns the content of the "annotation" subelement of this object as a character string. More...
 
const NUMLDocumentgetNUMLDocument () const
 Returns the parent NUMLDocument object. More...
 
NUMLDocumentgetNUMLDocument ()
 Returns the parent NUMLDocument object. More...
 
NMBasegetParentNUMLObject ()
 Returns the parent NUML object. More...
 
NMBasegetAncestorOfType (NUMLTypeCode_t type)
 Returns the ancestor NUML object that corresponds to the given NUMLTypeCode_t. More...
 
unsigned int getLine () const
 Returns the line number on which this object first appears in the XML representation of the NUML document. More...
 
unsigned int getColumn () const
 Returns the column number on which this object first appears in the XML representation of the NUML document. More...
 
bool isSetMetaId () const
 Predicate returning true or false depending on whether this object's "metaid" attribute has been set. More...
 
bool isSetName () const
 
int setMetaId (const std::string &metaid)
 Sets the value of the "metaid" attribute of this object. More...
 
virtual int setId (const std::string &sid)
 
virtual void setNUMLDocument (NUMLDocument *d)
 Sets the parent NUMLDocument of this NUML object. More...
 
virtual void setParentNUMLObject (NMBase *sb)
 Sets the parent NUML object of this NUML object. More...
 
int setNamespaces (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns)
 Sets the namespaces relevant of this NUML object. More...
 
int unsetMetaId ()
 Unsets the value of the "metaid" attribute of this NUML object. More...
 
unsigned int getLevel () const
 Returns the NUML Level of the overall NUML document. More...
 
unsigned int getVersion () const
 Returns the Version within the NUML Level of the overall NUML document. More...
 
virtual NUMLTypeCode_t getTypeCode () const
 Returns the libnuml type code for this object. More...
 
bool hasValidLevelVersionNamespaceCombination ()
 Predicate returning true or false depending on whether this object's level/version and namespace values correspond to a valid NUML specification. More...
 
virtual const std::string & getElementName () const =0
 Returns the XML element name of this object. More...
 
char * toNUML ()
 Returns a string that consists of the partial NUML describing this object. More...
 
void read (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream)
 Reads (initializes) this NUML object by reading from XMLInputStream. More...
 
void write (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const
 Writes (serializes) this NUML object by writing it to XMLOutputStream. More...
 
virtual void writeElements (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const
 Subclasses should override this method to write out their contained NUML objects as XML elements. More...
 
virtual bool hasRequiredAttributes () const
 
virtual bool hasRequiredElements () const
 
void setNUMLNamespaces (NUMLNamespaces *numlns)
 
NUMLNamespacesgetNUMLNamespaces () const
 
void syncAnnotation ()
 
bool isSetNotes () const
 
bool isSetAnnotation () const
 
virtual int setAnnotation (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *annotation)
 
virtual int setAnnotation (const std::string &annotation)
 
virtual int appendAnnotation (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *annotation)
 
virtual int appendAnnotation (const std::string &annotation)
 
int removeTopLevelAnnotationElement (const std::string elementName, const std::string elementURI="")
 
int replaceTopLevelAnnotationElement (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *annotation)
 
int replaceTopLevelAnnotationElement (const std::string &annotation)
 
int setNotes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *notes)
 
int setNotes (const std::string &notes, bool addXHTMLMarkup=false)
 
int appendNotes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *notes)
 
int appendNotes (const std::string &notes)
 
int unsetNotes ()
 
int unsetAnnotation ()
 
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * getNotes () const
 
std::string getNotesString () const
 
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * getAnnotation () const
 
std::string getAnnotationString () const
 

Protected Member Functions

virtual void writeXMLNS (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const
 Subclasses should override this method to write their xmlns attriubutes (if any) to the XMLOutputStream. More...
 
 NMBase (const std::string &id="", const std::string &name="")
 Only subclasses may create NMBase objects. More...
 
 NMBase (unsigned int level, unsigned int version)
 Creates a new NMBase object with the given sboTerm. More...
 
 NMBase (NUMLNamespaces *numlns)
 Creates a new NMBase object with the given NUMLNamespaces. More...
 
 NMBase (const NMBase &orig)
 Copy constructor. More...
 
virtual NMBasecreateObject (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream)
 Subclasses should override this method to create, store, and then return an NUML object corresponding to the next XMLToken in the XMLInputStream. More...
 
virtual bool readOtherXML (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream)
 Subclasses should override this method to read (and store) XHTML, MathML, etc. More...
 
virtual int getElementPosition () const
 The NUML XML Schema is written such that the order of child elements is significant. More...
 
NUMLErrorLoggetErrorLog ()
 
void logError (unsigned int id, const unsigned int level=2, const unsigned int version=3, const std::string &details="")
 Convenience method for easily logging problems from within method implementations. More...
 
void logUnknownAttribute (std::string attribute, const unsigned int level, const unsigned int version, const std::string element)
 Helper to log a common type of error. More...
 
void logUnknownElement (const std::string element, const unsigned int level, const unsigned int version)
 Helper to log a common type of error. More...
 
void logEmptyString (std::string attribute, const unsigned int level, const unsigned int version, std::string element)
 Helper to log a common type of error. More...
 
virtual void readAttributes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes &attributes)
 Subclasses should override this method to read values from the given XMLAttributes set into their specific fields. More...
 
virtual void writeAttributes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const
 Subclasses should override this method to write their XML attributes to the XMLOutputStream. More...
 
void checkOrderAndLogError (NMBase *object, int expected)
 Checks that NUML element has been read in the proper order. More...
 
void checkNUMLListPopulated (NMBase *object)
 Checks that an NUML NUMLList element has been populated. More...
 
void checkDefaultNamespace (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns, const std::string &elementName)
 Checks that the given default namespace in the given element is valid. More...
 
void checkXHTML (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *)
 Checks that the XHTML is valid. More...
 
void checkAnnotation ()
 Checks the annotation does not declare an numl namespace. More...
 

Protected Attributes

std::string mMetaId
 
std::string mId
 
std::string mName
 
NUMLDocumentmNUML
 
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * mNotes
 
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * mAnnotation
 
NUMLNamespacesmNUMLNamespaces
 
unsigned int mLine
 
unsigned int mColumn
 
int mDept
 
NMBasemParentNUMLObject
 
bool mHasBeenDeleted
 
std::string mEmptyString
 

Private Member Functions

void setNMBaseFields (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken &element)
 Stores the location (line and column) and any XML namespaces (for roundtripping) declared on this NUML (XML) element. More...
 
bool readAnnotation (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream)
 
bool readNotes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream)
 
bool getHasBeenDeleted ()
 

Detailed Description

This is the base class for all numl objects.

Constructor & Destructor Documentation

◆ ~NMBase()

NMBase::~NMBase ( )
virtual

Destroy this object.

◆ NMBase() [1/4]

NMBase::NMBase ( const std::string &  id = "",
const std::string &  name = "" 
)
protected

Only subclasses may create NMBase objects.

@docnote The native C++ implementation of this method defines a default argument value. In the documentation generated for different libNUML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java, a default argument is handled by declaring two separate methods, with one of them having the argument and the other one lacking the argument. However, the libNUML documentation will be identical for both methods. Consequently, if you are reading this and do not see an argument even though one is described, please look for descriptions of other variants of this method near where this one appears in the documentation.

◆ NMBase() [2/4]

NMBase::NMBase ( unsigned int  level,
unsigned int  version 
)
protected

Creates a new NMBase object with the given sboTerm.

Only subclasses may create NMBase objects.

◆ NMBase() [3/4]

NMBase::NMBase ( NUMLNamespaces numlns)
protected

Creates a new NMBase object with the given NUMLNamespaces.

Only subclasses may create NMBase objects.

◆ NMBase() [4/4]

NMBase::NMBase ( const NMBase orig)
protected

Copy constructor.

Creates a copy of this NMBase object.

Member Function Documentation

◆ accept()

virtual bool NMBase::accept ( NUMLVisitor v) const
pure virtual

Accepts the given NUMLVisitor for this instance of NMBase.

Parameters
vthe NUMLVisitor instance to be used.
Returns
the result of calling v.visit().

Implemented in AtomicDescription, AtomicValue, CompositeDescription, CompositeValue, Dimension, DimensionDescription, NUMLDocument, NUMLList, OntologyTerm, and ResultComponent.

◆ appendAnnotation() [1/2]

virtual int NMBase::appendAnnotation ( const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *  annotation)
virtual

◆ appendAnnotation() [2/2]

int NMBase::appendAnnotation ( const std::string &  annotation)
virtual

◆ appendNotes() [1/2]

int NMBase::appendNotes ( const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *  notes)

◆ appendNotes() [2/2]

int NMBase::appendNotes ( const std::string &  notes)

◆ checkAnnotation()

void NMBase::checkAnnotation ( )
protected

Checks the annotation does not declare an numl namespace.

If the annotation declares an numl namespace an error is logged.

◆ checkDefaultNamespace()

void NMBase::checkDefaultNamespace ( const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *  xmlns,
const std::string &  elementName 
)
protected

Checks that the given default namespace in the given element is valid.

If the given default namespace is not valid, an error is logged.

◆ checkNUMLListPopulated()

void NMBase::checkNUMLListPopulated ( NMBase object)
protected

Checks that an NUML NUMLList element has been populated.

If a NUMLList element has been declared with no elements, an error is logged.

◆ checkOrderAndLogError()

void NMBase::checkOrderAndLogError ( NMBase object,
int  expected 
)
protected

Checks that NUML element has been read in the proper order.

If object is not in the expected position, an error is logged.

◆ checkXHTML()

void NMBase::checkXHTML ( const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *  xhtml)
protected

Checks that the XHTML is valid.

If the xhtml does not conform to the specification of valid xhtml within an numl document, an error is logged.

◆ clone()

virtual NMBase * NMBase::clone ( ) const
pure virtual

Creates and returns a deep copy of this NMBase object.

Returns
a (deep) copy of this NMBase object

Implemented in AtomicDescription, AtomicValue, CompositeDescription, CompositeValue, Dimension, DimensionDescription, NUMLDocument, NUMLList, OntologyTerm, OntologyTerms, ResultComponent, ResultComponents, Tuple, and TupleDescription.

◆ createObject()

NMBase * NMBase::createObject ( LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &  stream)
protectedvirtual

Subclasses should override this method to create, store, and then return an NUML object corresponding to the next XMLToken in the XMLInputStream.

Returns
the NUML object corresponding to next XMLToken in the XMLInputStream or NULL if the token was not recognized.

Reimplemented in CompositeDescription, CompositeValue, Dimension, DimensionDescription, NUMLDocument, OntologyTerms, ResultComponent, ResultComponents, Tuple, and TupleDescription.

◆ getAncestorOfType()

NMBase * NMBase::getAncestorOfType ( NUMLTypeCode_t  type)

Returns the ancestor NUML object that corresponds to the given NUMLTypeCode_t.

This function allows any object to determine its exact location/function within a model. For example a StoichiometryMath object has ancestors of type SpeciesReference, ListOfProducts/ListOfReactants/ListOfModifiers, Reaction, ListOfReactions and Model; any of which can be accessed via this function.

Parameters
typethe NUMLTypeCode_t of the ancestor to be returned.
Returns
the ancestor NUML object of this NUML object, that corresponds to the given NUMLTypeCode_t, NULL if none exists.

◆ getAnnotation()

XMLNode * NMBase::getAnnotation ( ) const

◆ getAnnotationString()

std::string NMBase::getAnnotationString ( ) const

◆ getColumn()

unsigned int NMBase::getColumn ( ) const

Returns the column number on which this object first appears in the XML representation of the NUML document.

Returns
the column number of this NUML object.
See also
getLine()

◆ getElementName()

virtual const std::string & NMBase::getElementName ( ) const
pure virtual

Returns the XML element name of this object.

This is overridden by subclasses to return a string appropriate to the NUML component. For example, Model defines it as returning "model", CompartmentType defines it as returning "compartmentType", etc.

Implemented in AtomicDescription, AtomicValue, CompositeDescription, CompositeValue, Dimension, DimensionDescription, NUMLDocument, NUMLList, OntologyTerm, OntologyTerms, ResultComponent, ResultComponents, Tuple, and TupleDescription.

◆ getElementPosition()

int NMBase::getElementPosition ( ) const
protectedvirtual

The NUML XML Schema is written such that the order of child elements is significant.

LibNUML can read elements out of order. If you override this method to indicate the ordinal position of element with respect to its siblings, libNUML will log an error if the element is read out of order.

Returns
the ordinal position of the element with respect to its siblings or -1 (default) to indicate the position is not significant.

Reimplemented in Dimension, DimensionDescription, NUMLDocument, OntologyTerms, ResultComponents, Tuple, and TupleDescription.

◆ getErrorLog()

NUMLErrorLog * NMBase::getErrorLog ( )
protected
Returns
the NUMLErrorLog used to log errors during while reading and validating NUML.

◆ getHasBeenDeleted()

bool NMBase::getHasBeenDeleted ( )
private

◆ getId()

const string & NMBase::getId ( ) const
virtual

◆ getLevel()

unsigned int NMBase::getLevel ( ) const

Returns the NUML Level of the overall NUML document.

Returns
the NUML level of this NUML object.
See also
getVersion()

◆ getLine()

unsigned int NMBase::getLine ( ) const

Returns the line number on which this object first appears in the XML representation of the NUML document.

Returns
the line number of this NUML object.
See also
getColumn()

◆ getMetaId() [1/2]

string & NMBase::getMetaId ( )

Returns the value of the "metaid" attribute of this object.

The optional attribute named "metaid", present on every major NUML component type, is for supporting metadata annotations using RDF (Resource Description Format). The attribute value has the data type XML ID, the XML identifier type, which means each "metaid" value must be globally unique within an NUML file. (Importantly, this uniqueness criterion applies across any attribute with type XML ID, not just the "metaid" attribute used by NUML—something to be aware of if your application-specific XML content inside the "annotation" subelement happens to use XML ID.) The "metaid" value serves to identify a model component for purposes such as referencing that component from metadata placed within "annotation" subelements.

Returns
the metaid of this NUML object.
See also
isSetMetaId()
setMetaId(const std::string& metaid)

◆ getMetaId() [2/2]

const string & NMBase::getMetaId ( ) const

Returns the value of the "metaid" attribute of this object.

The optional attribute named "metaid", present on every major NUML component type, is for supporting metadata annotations using RDF (Resource Description Format). The attribute value has the data type XML ID, the XML identifier type, which means each "metaid" value must be globally unique within an NUML file. (Importantly, this uniqueness criterion applies across any attribute with type XML ID, not just the "metaid" attribute used by NUML—something to be aware of if your application-specific XML content inside the "annotation" subelement happens to use XML ID.) The "metaid" value serves to identify a model component for purposes such as referencing that component from metadata placed within "annotation" subelements.

Returns
the metaid of this NUML object.
See also
isSetMetaId()
setMetaId(const std::string& metaid)

◆ getName()

const string & NMBase::getName ( ) const
virtual

◆ getNamespaces()

LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces * NMBase::getNamespaces ( ) const
virtual

Returns the content of the "annotation" subelement of this object as a character string.

Whereas the NMBase "notes" subelement is a container for content to be shown directly to humans, the "annotation" element is a container for optional software-generated content not meant to be shown to humans. Every object derived from NMBase can have its own value for "annotation". The element's content type is XML type any, allowing essentially arbitrary well-formed XML data content.

NUML places a few restrictions on the organization of the content of annotations; these are intended to help software tools read and write the data as well as help reduce conflicts between annotations added by different tools. Please see the NUML specifications for more details.

The annotations returned by this method will be in string form.

Returns
the annotation string of this NUML object.
See also
getAnnotation()
isSetAnnotation()
setAnnotation(const XMLNode* annotation)
setAnnotation(const std::string& annotation)
appendAnnotation(const XMLNode* annotation)
appendAnnotation(const std::string& annotation)
unsetAnnotation() Returns a list of the XML Namespaces declared on this NUML document.
Returns
the XML Namespaces associated with this NUML object

Reimplemented in NUMLDocument.

◆ getNotes()

XMLNode * NMBase::getNotes ( ) const

◆ getNotesString()

std::string NMBase::getNotesString ( ) const

◆ getNUMLDocument() [1/2]

NUMLDocument * NMBase::getNUMLDocument ( )

Returns the parent NUMLDocument object.

LibNUML uses the class NUMLDocument as a top-level container for storing NUML content and data associated with it (such as warnings and error messages). An NUML model in libNUML is contained inside an NUMLDocument object. NUMLDocument corresponds roughly to the class Sbrml defined in the NUML Level 2 specification, but it does not have a direct correspondence in NUML Level 1. (But, it is created by libNUML no matter whether the model is Level 1 or Level 2.)

This method allows the NUMLDocument for the current object to be retrieved.

Returns
the parent NUMLDocument object of this NUML object.

◆ getNUMLDocument() [2/2]

const NUMLDocument * NMBase::getNUMLDocument ( ) const

Returns the parent NUMLDocument object.

LibNUML uses the class NUMLDocument as a top-level container for storing NUML content and data associated with it (such as warnings and error messages). An NUML model in libNUML is contained inside an NUMLDocument object. NUMLDocument corresponds roughly to the class Sbrml defined in the NUML Level 2 specification, but it does not have a direct correspondence in NUML Level 1. (But, it is created by libNUML no matter whether the model is Level 1 or Level 2.)

This method allows the NUMLDocument for the current object to be retrieved.

Returns
the parent NUMLDocument object of this NUML object.

◆ getNUMLNamespaces()

NUMLNamespaces * NMBase::getNUMLNamespaces ( ) const

◆ getParentNUMLObject()

NMBase * NMBase::getParentNUMLObject ( )

Returns the parent NUML object.

This method is convenient when holding an object nested inside other objects in an NUML model. It allows direct access to the <model> element containing it.

Returns
the parent NUML object of this NUML object.

◆ getTypeCode()

NUMLTypeCode_t NMBase::getTypeCode ( ) const
virtual

◆ getVersion()

unsigned int NMBase::getVersion ( ) const

Returns the Version within the NUML Level of the overall NUML document.

Returns
the NUML version of this NUML object.
See also
getLevel()

◆ hasRequiredAttributes()

bool NMBase::hasRequiredAttributes ( ) const
virtual

◆ hasRequiredElements()

bool NMBase::hasRequiredElements ( ) const
virtual

◆ hasValidLevelVersionNamespaceCombination()

bool NMBase::hasValidLevelVersionNamespaceCombination ( )

Predicate returning true or false depending on whether this object's level/version and namespace values correspond to a valid NUML specification.

The valid combinations of NUML Level, Version and Namespace as of this release of libNUML are the following:

  • Level 1 Version 1 "http://www.numl.org/numl/level1"
Returns
true if the level, version and namespace values of this NUML object correspond to a valid set of values, false otherwise.

◆ isSetAnnotation()

bool NMBase::isSetAnnotation ( ) const

◆ isSetMetaId()

bool NMBase::isSetMetaId ( ) const

Predicate returning true or false depending on whether this object's "metaid" attribute has been set.

The optional attribute named "metaid", present on every major NUML component type, is for supporting metadata annotations using RDF (Resource Description Format). The attribute value has the data type XML ID, the XML identifier type, which means each "metaid" value must be globally unique within an NUML file. (Importantly, this uniqueness criterion applies across any attribute with type XML ID, not just the "metaid" attribute used by NUML—something to be aware of if your application-specific XML content inside the "annotation" subelement happens to use XML ID.) The "metaid" value serves to identify a model component for purposes such as referencing that component from metadata placed within "annotation" subelements.

Returns
true if the "metaid" attribute of this NUML object has been set, false otherwise.
See also
getMetaId()
setMetaId(const std::string& metaid)

◆ isSetName()

bool NMBase::isSetName ( ) const

◆ isSetNotes()

bool NMBase::isSetNotes ( ) const

◆ logEmptyString()

void NMBase::logEmptyString ( std::string  attribute,
const unsigned int  level,
const unsigned int  version,
std::string  element 
)
protected

Helper to log a common type of error.

◆ logError()

void NMBase::logError ( unsigned int  id,
const unsigned int  level = 2,
const unsigned int  version = 3,
const std::string &  details = "" 
)
protected

Convenience method for easily logging problems from within method implementations.

This is essentially a short form of getErrorLog()->logError(...)

@docnote The native C++ implementation of this method defines a default argument value. In the documentation generated for different libNUML language bindings, you may or may not see corresponding arguments in the method declarations. For example, in Java, a default argument is handled by declaring two separate methods, with one of them having the argument and the other one lacking the argument. However, the libNUML documentation will be identical for both methods. Consequently, if you are reading this and do not see an argument even though one is described, please look for descriptions of other variants of this method near where this one appears in the documentation.

◆ logUnknownAttribute()

void NMBase::logUnknownAttribute ( std::string  attribute,
const unsigned int  level,
const unsigned int  version,
const std::string  element 
)
protected

Helper to log a common type of error.

◆ logUnknownElement()

void NMBase::logUnknownElement ( const std::string  element,
const unsigned int  level,
const unsigned int  version 
)
protected

Helper to log a common type of error.

◆ operator=()

NMBase & NMBase::operator= ( const NMBase orig)

Assignment operator for NMBase.

◆ read()

void NMBase::read ( LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &  stream)

Reads (initializes) this NUML object by reading from XMLInputStream.

◆ readAnnotation()

bool NMBase::readAnnotation ( LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &  stream)
private
Returns
true if read an <annotation> element from the stream

◆ readAttributes()

void NMBase::readAttributes ( const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes &  attributes)
protectedvirtual

Subclasses should override this method to read values from the given XMLAttributes set into their specific fields.

Be sure to call your parents implementation of this method as well.

Reimplemented in AtomicDescription, AtomicValue, CompositeDescription, CompositeValue, NUMLDocument, NUMLList, OntologyTerm, ResultComponent, Tuple, and TupleDescription.

◆ readNotes()

bool NMBase::readNotes ( LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &  stream)
private
Returns
true if read a <notes> element from the stream

◆ readOtherXML()

bool NMBase::readOtherXML ( LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &  stream)
protectedvirtual

Subclasses should override this method to read (and store) XHTML, MathML, etc.

directly from the XMLInputStream.

Returns
true if the subclass read from the stream, false otherwise.

◆ removeTopLevelAnnotationElement()

int NMBase::removeTopLevelAnnotationElement ( const std::string  elementName,
const std::string  elementURI = "" 
)

◆ replaceTopLevelAnnotationElement() [1/2]

int NMBase::replaceTopLevelAnnotationElement ( const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *  annotation)

◆ replaceTopLevelAnnotationElement() [2/2]

int NMBase::replaceTopLevelAnnotationElement ( const std::string &  annotation)

◆ setAnnotation() [1/2]

virtual int NMBase::setAnnotation ( const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *  annotation)
virtual

◆ setAnnotation() [2/2]

int NMBase::setAnnotation ( const std::string &  annotation)
virtual

◆ setId()

int NMBase::setId ( const std::string &  sid)
virtual

◆ setMetaId()

int NMBase::setMetaId ( const std::string &  metaid)

Sets the value of the "metaid" attribute of this object.

The string metaid is copied. The value of metaid must be an identifier conforming to the syntax defined by the XML 1.0 data type ID. Among other things, this type requires that a value is unique among all the values of type XML ID in an NUMLDocument. Although NUML only uses XML ID for the "metaid" attribute, callers should be careful if they use XML ID's in XML portions of a model that are not defined by NUML, such as in the application-specific content of the "annotation" subelement.

Parameters
metaidthe identifier string to use as the value of the "metaid" attribute
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
  • LIBNUML_OPERATION_SUCCESS
  • LIBNUML_INVALID_ATTRIBUTE_VALUE
  • LIBNUML_UNEXPECTED_ATTRIBUTE
See also
getMetaId()
isSetMetaId()

◆ setNamespaces()

int NMBase::setNamespaces ( LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *  xmlns)

Sets the namespaces relevant of this NUML object.

Parameters
xmlnsthe namespaces to set
Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
  • LIBNUML_OPERATION_SUCCESS

◆ setNMBaseFields()

void NMBase::setNMBaseFields ( const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken &  element)
private

Stores the location (line and column) and any XML namespaces (for roundtripping) declared on this NUML (XML) element.

◆ setNotes() [1/2]

int NMBase::setNotes ( const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *  notes)

◆ setNotes() [2/2]

int NMBase::setNotes ( const std::string &  notes,
bool  addXHTMLMarkup = false 
)

◆ setNUMLDocument()

void NMBase::setNUMLDocument ( NUMLDocument d)
virtual

Sets the parent NUMLDocument of this NUML object.

Parameters
dthe NUMLDocument object to use

Reimplemented in NUMLDocument, NUMLList, and ResultComponent.

◆ setNUMLNamespaces()

void NMBase::setNUMLNamespaces ( NUMLNamespaces numlns)

◆ setParentNUMLObject()

void NMBase::setParentNUMLObject ( NMBase sb)
virtual

Sets the parent NUML object of this NUML object.

Parameters
sbthe NUML object to use

Reimplemented in NUMLDocument, NUMLList, and ResultComponent.

◆ syncAnnotation()

void NMBase::syncAnnotation ( )

◆ toNUML()

char * NMBase::toNUML ( )

Returns a string that consists of the partial NUML describing this object.

This is primarily provided for testing and debugging purposes. It may be removed in a future version of libNUML.

Returns
the partial NUML that describes this NUML object.

◆ unsetAnnotation()

int NMBase::unsetAnnotation ( )

◆ unsetMetaId()

int NMBase::unsetMetaId ( )

Unsets the value of the "metaid" attribute of this NUML object.

The optional attribute named "metaid", present on every major NUML component type, is for supporting metadata annotations using RDF (Resource Description Format). The attribute value has the data type XML ID, the XML identifier type, which means each "metaid" value must be globally unique within an NUML file. (Importantly, this uniqueness criterion applies across any attribute with type XML ID, not just the "metaid" attribute used by NUML—something to be aware of if your application-specific XML content inside the "annotation" subelement happens to use XML ID.) The "metaid" value serves to identify a model component for purposes such as referencing that component from metadata placed within "annotation" subelements.

Returns
integer value indicating success/failure of the function. The possible values returned by this function are:
  • LIBNUML_OPERATION_SUCCESS
  • LIBNUML_OPERATION_FAILED

◆ unsetNotes()

int NMBase::unsetNotes ( )

◆ write()

void NMBase::write ( LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &  stream) const

Writes (serializes) this NUML object by writing it to XMLOutputStream.

◆ writeAttributes()

void NMBase::writeAttributes ( LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &  stream) const
protectedvirtual

Subclasses should override this method to write their XML attributes to the XMLOutputStream.

Be sure to call your parents implementation of this method as well. For example:

NMBase::writeAttributes(stream); stream.writeAttribute( "id" , mId ); stream.writeAttribute( "name", mName ); ...

Reimplemented in AtomicDescription, AtomicValue, CompositeDescription, CompositeValue, NUMLDocument, NUMLList, OntologyTerm, ResultComponent, Tuple, and TupleDescription.

◆ writeElements()

void NMBase::writeElements ( LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &  stream) const
virtual

Subclasses should override this method to write out their contained NUML objects as XML elements.

Be sure to call your parents implementation of this method as well. For example:

NMBase::writeElements(stream); mTuples.write(stream); mResultComponents.write(stream); ...

Reimplemented in NUMLDocument, NUMLList, and ResultComponent.

◆ writeXMLNS()

void NMBase::writeXMLNS ( LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &  stream) const
protectedvirtual

Subclasses should override this method to write their xmlns attriubutes (if any) to the XMLOutputStream.

Reimplemented in DimensionDescription.

Member Data Documentation

◆ mAnnotation

LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* NMBase::mAnnotation
protected

◆ mColumn

unsigned int NMBase::mColumn
protected

◆ mDept

int NMBase::mDept
protected

◆ mEmptyString

std::string NMBase::mEmptyString
protected

◆ mHasBeenDeleted

bool NMBase::mHasBeenDeleted
protected

◆ mId

std::string NMBase::mId
protected

◆ mLine

unsigned int NMBase::mLine
protected

◆ mMetaId

std::string NMBase::mMetaId
protected

◆ mName

std::string NMBase::mName
protected

◆ mNotes

LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* NMBase::mNotes
protected

◆ mNUML

NUMLDocument* NMBase::mNUML
protected

◆ mNUMLNamespaces

NUMLNamespaces* NMBase::mNUMLNamespaces
protected

◆ mParentNUMLObject

NMBase* NMBase::mParentNUMLObject
protected

The documentation for this class was generated from the following files: