libSBML C API  5.18.0
ConversionOption_t Class Reference

Detailed Description

A single configuration setting for an SBML converter.

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. It is a class used in the implementation of extra functionality provided by libSBML.

LibSBML provides a number of converters that can perform transformations on SBML documents. These converters allow their behaviors to be controlled by setting property values. Converter properties are communicated using objects of class ConversionProperties_t, and within such objects, individual options are encapsulated using ConversionOption_t objects.

A ConversionOption_t structure consists of four parts:

  • A key, acting as the name of the option.
  • A value of this option.
  • A type for the value; the type code is chosen froman enumeration whose names all begin with the prefix CNV_TYPE_. (See the separate subsection below for more information.)
  • A description consisting of a text string that describes the option in some way.

There are no constraints on the values of keys or descriptions; authors of SBML converters are free to choose them as they see fit.

Conversion option data types

An option in ConversionOption_t must have a data type declared, to indicate whether it is a string value, an integer, and so forth. The possible types of values are taken from the enumeration ConversionOptionType_t. The following are the possible values:

Enumerator Meaning
CNV_TYPE_BOOL Indicates the value type is a Boolean.
CNV_TYPE_DOUBLE Indicates the value type is a double-sized float.
CNV_TYPE_INT Indicates the value type is an integer.
CNV_TYPE_SINGLE Indicates the value type is a float.
CNV_TYPE_STRING Indicates the value type is a string.
See also
ConversionProperties_t
Examples:
flattenModel.c, promoteParameters.c, and stripPackage.c.

Public Member Functions

ConversionOption_tConversionOption_clone (const ConversionOption_t *co)
 Creates and returns a deep copy of the ConversionOption_t structure. More...
 
ConversionOption_tConversionOption_create (const char *key)
 Creates a new ConversionOption_t with the given key. More...
 
ConversionOption_tConversionOption_createWithKeyAndType (const char *key, ConversionOptionType_t type)
 Creates a new ConversionOption_t with given key and type. More...
 
int ConversionOption_getBoolValue (const ConversionOption_t *co)
 Returns the value (as boolean) for the given option. More...
 
const char * ConversionOption_getDescription (const ConversionOption_t *co)
 Returns the description for the given option. More...
 
double ConversionOption_getDoubleValue (const ConversionOption_t *co)
 Returns the value (as double) for the given option. More...
 
float ConversionOption_getFloatValue (const ConversionOption_t *co)
 Returns the value (as float) for the given option. More...
 
int ConversionOption_getIntValue (const ConversionOption_t *co)
 Returns the value (as integer) for the given option. More...
 
const char * ConversionOption_getKey (const ConversionOption_t *co)
 Returns the key for the given option. More...
 
ConversionOptionType_t ConversionOption_getType (const ConversionOption_t *co)
 Returns the type for the given option. More...
 
const char * ConversionOption_getValue (const ConversionOption_t *co)
 Returns the value for the given option. More...
 
void ConversionOption_setBoolValue (ConversionOption_t *co, int value)
 Sets the value for the option. More...
 
void ConversionOption_setDescription (ConversionOption_t *co, const char *description)
 Sets the description for the option. More...
 
void ConversionOption_setDoubleValue (ConversionOption_t *co, double value)
 Sets the value for the option. More...
 
void ConversionOption_setFloatValue (ConversionOption_t *co, float value)
 Sets the value for the option. More...
 
void ConversionOption_setIntValue (ConversionOption_t *co, int value)
 Sets the value for the option. More...
 
void ConversionOption_setKey (ConversionOption_t *co, const char *key)
 Sets the key for the option. More...
 
void ConversionOption_setType (ConversionOption_t *co, ConversionOptionType_t type)
 Sets the type for the option. More...
 
void ConversionOption_setValue (ConversionOption_t *co, const char *value)
 Sets the value for the option. More...
 

Member Function Documentation

ConversionOption_t * ConversionOption_clone ( const ConversionOption_t co)

Creates and returns a deep copy of the ConversionOption_t structure.

Parameters
cothe conversion option to clone.
Returns
a (deep) copy of the ConversionOption_t structure.
ConversionOption_t * ConversionOption_create ( const char *  key)

Creates a new ConversionOption_t with the given key.

Parameters
keythe key for this option.
Examples:
flattenModel.c, promoteParameters.c, and stripPackage.c.
ConversionOption_t * ConversionOption_createWithKeyAndType ( const char *  key,
ConversionOptionType_t  type 
)

Creates a new ConversionOption_t with given key and type.

Parameters
keythe key for this option.
typethe type of this option.
int ConversionOption_getBoolValue ( const ConversionOption_t co)

Returns the value (as boolean) for the given option.

Parameters
cothe conversion option.
Returns
the value, 1 (true), or 0 (false).
const char * ConversionOption_getDescription ( const ConversionOption_t co)

Returns the description for the given option.

Parameters
cothe conversion option.
Returns
the description, as a string.
double ConversionOption_getDoubleValue ( const ConversionOption_t co)

Returns the value (as double) for the given option.

Parameters
cothe conversion option.
Returns
the value, as a double.
float ConversionOption_getFloatValue ( const ConversionOption_t co)

Returns the value (as float) for the given option.

Parameters
cothe conversion option.
Returns
the value, as a float.
int ConversionOption_getIntValue ( const ConversionOption_t co)

Returns the value (as integer) for the given option.

Parameters
cothe conversion option.
Returns
the value, as a integer.
const char * ConversionOption_getKey ( const ConversionOption_t co)

Returns the key for the given option.

Parameters
cothe conversion option.
Returns
the key, as a string.
ConversionOptionType_t ConversionOption_getType ( const ConversionOption_t co)

Returns the type for the given option.

Parameters
cothe conversion option.
Returns
the type
const char * ConversionOption_getValue ( const ConversionOption_t co)

Returns the value for the given option.

Parameters
cothe conversion option.
Returns
the value, as a string.
void ConversionOption_setBoolValue ( ConversionOption_t co,
int  value 
)

Sets the value for the option.

Parameters
cothe conversion option.
valuea bool representing the value to set.
void ConversionOption_setDescription ( ConversionOption_t co,
const char *  description 
)

Sets the description for the option.

Parameters
cothe conversion option.
descriptiona string representing the description to set.
Examples:
flattenModel.c, promoteParameters.c, and stripPackage.c.
void ConversionOption_setDoubleValue ( ConversionOption_t co,
double  value 
)

Sets the value for the option.

Parameters
cothe conversion option.
valuea double representing the value to set.
void ConversionOption_setFloatValue ( ConversionOption_t co,
float  value 
)

Sets the value for the option.

Parameters
cothe conversion option.
valuea float representing the value to set.
void ConversionOption_setIntValue ( ConversionOption_t co,
int  value 
)

Sets the value for the option.

Parameters
cothe conversion option.
valuean integer representing the value to set.
void ConversionOption_setKey ( ConversionOption_t co,
const char *  key 
)

Sets the key for the option.

Parameters
cothe conversion option.
keya string representing the key to set.
void ConversionOption_setType ( ConversionOption_t co,
ConversionOptionType_t  type 
)

Sets the type for the option.

Parameters
cothe conversion option.
typethe type for this option.
Examples:
flattenModel.c, promoteParameters.c, and stripPackage.c.
void ConversionOption_setValue ( ConversionOption_t co,
const char *  value 
)

Sets the value for the option.

Parameters
cothe conversion option.
valuea string representing the value to set.
Examples:
flattenModel.c, promoteParameters.c, and stripPackage.c.