ConversionOption Class Reference

List of all members.


Detailed Description

Class of object that encapsulates a conversion option.

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 of SBML documents. These converters allow their behaviors to be controlled by setting property values. Converter properties are communicated using objects of class ConversionProperties, and within such objects, individual options are encapsulated using ConversionOption objects.

A ConversionOption object consists of four parts:

  • A key, acting as the name of the option;
  • A value of this option;
  • A type for the value; this is chosen from the enumeration type ConversionOptionType_t; and
  • 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 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

Public Member Functions

virtual ConversionOption * clone () const
 Creates and returns a deep copy of this ConversionOption object.
 ConversionOption (std::string key, std::string value="", ConversionOptionType_t type=CNV_TYPE_STRING, std::string description="")
 Creates a new ConversionOption.
 ConversionOption (std::string key, const char *value, std::string description="")
 Creates a new ConversionOption specialized for string-type options.
 ConversionOption (std::string key, bool value, std::string description="")
 Creates a new ConversionOption specialized for Boolean-type options.
 ConversionOption (std::string key, double value, std::string description="")
 Creates a new ConversionOption specialized for double-type options.
 ConversionOption (std::string key, float value, std::string description="")
 Creates a new ConversionOption specialized for float-type options.
 ConversionOption (std::string key, int value, std::string description="")
 Creates a new ConversionOption specialized for integer-type options.
 ConversionOption (const ConversionOption &option)
 Copy constructor; creates a copy of an ConversionOption object.
virtual bool getBoolValue () const
 Returns the value of this option as a Boolean.
virtual std::string getDescription () const
 Returns the description string for this option.
virtual double getDoubleValue () const
 Returns the value of this option as a double.
virtual float getFloatValue () const
 Returns the value of this option as a float.
virtual int getIntValue () const
 Returns the value of this option as an integer.
virtual std::string getKey () const
 Returns the key for this option.
virtual ConversionOptionType_t getType () const
 Returns the type of this option.
virtual std::string getValue () const
 Returns the value of this option.
ConversionOption & operator= (const ConversionOption &option)
 Assignment operator for ConversionOption.
virtual void setBoolValue (bool value)
 Set the value of this option to a given Boolean value.
virtual void setDescription (std::string description)
 Sets the description text for this option.
virtual void setDoubleValue (double value)
 Set the value of this option to a given double value.
virtual void setFloatValue (float value)
 Set the value of this option to a given float value.
virtual void setIntValue (int value)
 Set the value of this option to a given int value.
virtual void setKey (std::string key)
 Sets the key for this option.
virtual void setType (ConversionOptionType_t type)
 Sets the type of this option.
virtual void setValue (std::string value)
 Sets the value for this option.
virtual ~ConversionOption ()
 Destroys this object.

Constructor & Destructor Documentation

ConversionOption::ConversionOption ( std::string  key,
std::string  value = "",
ConversionOptionType_t  type = CNV_TYPE_STRING,
std::string  description = "" 
)

Creates a new ConversionOption.

This is the general constructor, taking arguments for all aspects of an option. Other constructors exist with different arguments.

Parameters:
keythe key for this option
valuean optional value for this option
typethe type of this option
descriptionthe description for this option
ConversionOption::ConversionOption ( std::string  key,
const char *  value,
std::string  description = "" 
)

Creates a new ConversionOption specialized for string-type options.

Parameters:
keythe key for this option
valuethe value for this option
descriptionan optional description
ConversionOption::ConversionOption ( std::string  key,
bool  value,
std::string  description = "" 
)

Creates a new ConversionOption specialized for Boolean-type options.

Parameters:
keythe key for this option
valuethe value for this option
descriptionan optional description
ConversionOption::ConversionOption ( std::string  key,
double  value,
std::string  description = "" 
)

Creates a new ConversionOption specialized for double-type options.

Parameters:
keythe key for this option
valuethe value for this option
descriptionan optional description
ConversionOption::ConversionOption ( std::string  key,
float  value,
std::string  description = "" 
)

Creates a new ConversionOption specialized for float-type options.

Parameters:
keythe key for this option
valuethe value for this option
descriptionan optional description
ConversionOption::ConversionOption ( std::string  key,
int  value,
std::string  description = "" 
)

Creates a new ConversionOption specialized for integer-type options.

Parameters:
keythe key for this option
valuethe value for this option
descriptionan optional description

Copy constructor; creates a copy of an ConversionOption object.

Parameters:
optionthe ConversionOption object to copy.

Destroys this object.


Member Function Documentation

Creates and returns a deep copy of this ConversionOption object.

Returns:
a (deep) copy of this ConversionOption object.
bool ConversionOption::getBoolValue ( ) const [virtual]

Returns the value of this option as a Boolean.

Returns:
the value of this option.
string ConversionOption::getDescription ( ) const [virtual]

Returns the description string for this option.

Returns:
the description of this option.
double ConversionOption::getDoubleValue ( ) const [virtual]

Returns the value of this option as a double.

Returns:
the value of this option.
float ConversionOption::getFloatValue ( ) const [virtual]

Returns the value of this option as a float.

Returns:
the value of this option as a float
int ConversionOption::getIntValue ( ) const [virtual]

Returns the value of this option as an integer.

Returns:
the value of this option, as an int
string ConversionOption::getKey ( ) const [virtual]

Returns the key for this option.

Returns:
the key, as a string.

Returns the type of this option.

Returns:
the type of this option.
string ConversionOption::getValue ( ) const [virtual]

Returns the value of this option.

Returns:
the value of this option, as a string.
ConversionOption & ConversionOption::operator= ( const ConversionOption &  option)

Assignment operator for ConversionOption.

void ConversionOption::setBoolValue ( bool  value) [virtual]

Set the value of this option to a given Boolean value.

Invoking this method will also set the type of the option to CNV_TYPE_BOOL.

Parameters:
valuethe Boolean value to set
void ConversionOption::setDescription ( std::string  description) [virtual]

Sets the description text for this option.

Parameters:
descriptionthe description to set for this option.
void ConversionOption::setDoubleValue ( double  value) [virtual]

Set the value of this option to a given double value.

Invoking this method will also set the type of the option to CNV_TYPE_DOUBLE.

Parameters:
valuethe value to set
void ConversionOption::setFloatValue ( float  value) [virtual]

Set the value of this option to a given float value.

Invoking this method will also set the type of the option to CNV_TYPE_SINGLE.

Parameters:
valuethe value to set
void ConversionOption::setIntValue ( int  value) [virtual]

Set the value of this option to a given int value.

Invoking this method will also set the type of the option to CNV_TYPE_INT.

Parameters:
valuethe value to set
void ConversionOption::setKey ( std::string  key) [virtual]

Sets the key for this option.

Parameters:
keya string representing the key to set.

Sets the type of this option.

Parameters:
typethe type value to use.
void ConversionOption::setValue ( std::string  value) [virtual]

Sets the value for this option.

Parameters:
valuethe value to set, as a string.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines