libSBML C++ API  5.20.2
RelAbsVector Class Reference

Detailed Description

render Vectors with an absolute value and a relative value.

For many elements in the render extension, it is necessary to specify coordinates not in terms of absolute values, but rather in terms of relative values or even a combination of absolute and relative values. Such a pair of values where one represents an absolute value and the other represents a relative value can be expressed by a RelAbsVector. The RelAbsVector class represents a pair of numerical values where one value represents an absolute value and the other value is a relative value in percent.

The relative and absolute values to initialize a RelAbsVector object can either be given as numerical datatypes (double) or as a valid value string. A value string is a combination of an absolute value and a relative value and the absolute value if given has to come first. So valid value strings would be: "5.0e3+20%", or "100%" or "4".

Public Member Functions

virtual RelAbsVectorclone () const
 Creates and returns a deep copy of this RelAbsVector object. More...
 
bool empty () const
 
void erase ()
 resets this element by setting the two coordinates to 0.0 More...
 
double getAbsoluteValue () const
 Returns the absolute coordinate value. More...
 
std::string getCoordinate () const
 Returns the coordinate value. More...
 
double getRelativeValue () const
 Returns the relative coordinate value. More...
 
bool isSetAbsoluteValue () const
 Predicate returning true if this RelAbsVector's "abs" attribute is set. More...
 
bool isSetCoordinate () const
 Predicate returning true if this RelAbsVector's coordinate attribute is set. More...
 
bool isSetRelativeValue () const
 Predicate returning true if this RelAbsVector's "rel" attribute is set. More...
 
bool operator!= (const RelAbsVector &other) const
 Inverse comparison operator. More...
 
RelAbsVector operator+ (const RelAbsVector &other) const
 addition operator for RelAbsVector objects More...
 
RelAbsVector operator/ (double x) const
 Divides a RelAbsVector object by a double value. More...
 
RelAbsVectoroperator= (const RelAbsVector &rhs)
 Assignment operator for RelAbsVector. More...
 
bool operator== (const RelAbsVector &other) const
 Comparison operator. More...
 
 RelAbsVector (const RelAbsVector &orig)
 Copy constructor for RelAbsVector. More...
 
 RelAbsVector (const std::string &coordString)
 Constructor with a value string. More...
 
 RelAbsVector (double a=0.0, double r=0.0)
 Constructor with two values. More...
 
int setAbsoluteValue (double abs)
 Sets the absolute coordinate value. More...
 
int setCoordinate (const std::string &coordString)
 Sets the coordinates from the given string. More...
 
int setCoordinate (double abs, double rel=0.0)
 Sets the relative and absolute value. More...
 
int setRelativeValue (double rel)
 Sets the relative coordinate value. More...
 
std::string toString () const
 
int unsetAbsoluteValue ()
 Unsets the value of the "abs" attribute of this RelAbsVector. More...
 
int unsetCoordinate ()
 Unsets the value of the "rel" attribute of this RelAbsVector. More...
 
int unsetRelativeValue ()
 Unsets the value of the relative coordinate attribute of this RelAbsVector. More...
 
virtual ~RelAbsVector ()
 Destroy this RelAbsVector object. More...
 

Constructor & Destructor Documentation

◆ RelAbsVector() [1/3]

RelAbsVector::RelAbsVector ( double  a = 0.0,
double  r = 0.0 
)

Constructor with two values.

First value sets the absolute value, second sets the relative value (%).

Parameters
aabsolute value
rrelative value in % (50 -> 50%)

◆ RelAbsVector() [2/3]

RelAbsVector::RelAbsVector ( const std::string &  coordString)

Constructor with a value string.

If the string does not represent a valid value, the relative and the absolute component of the RelAbsVector are set to NaN.

Parameters
coordStringvalue as a string

◆ RelAbsVector() [3/3]

RelAbsVector::RelAbsVector ( const RelAbsVector orig)

Copy constructor for RelAbsVector.

Parameters
origthe RelAbsVector instance to copy.

◆ ~RelAbsVector()

RelAbsVector::~RelAbsVector ( )
virtual

Destroy this RelAbsVector object.

Member Function Documentation

◆ clone()

RelAbsVector * RelAbsVector::clone ( ) const
virtual

Creates and returns a deep copy of this RelAbsVector object.

Returns
a (deep) copy of this RelAbsVector object.

◆ empty()

bool RelAbsVector::empty ( ) const
Returns
an indication whether this element has been set (i.e., no zero entries for either relative or absolute coordinate)

◆ erase()

void RelAbsVector::erase ( )

resets this element by setting the two coordinates to 0.0

◆ getAbsoluteValue()

double RelAbsVector::getAbsoluteValue ( ) const

Returns the absolute coordinate value.

Returns
absolute value

◆ getCoordinate()

std::string RelAbsVector::getCoordinate ( ) const

Returns the coordinate value.

Returns
absolute value

◆ getRelativeValue()

double RelAbsVector::getRelativeValue ( ) const

Returns the relative coordinate value.

Returns
absolute value

◆ isSetAbsoluteValue()

bool RelAbsVector::isSetAbsoluteValue ( ) const

Predicate returning true if this RelAbsVector's "abs" attribute is set.

Returns
true if this RelAbsVector's "abs" attribute has been set, otherwise false is returned.

◆ isSetCoordinate()

bool RelAbsVector::isSetCoordinate ( ) const

Predicate returning true if this RelAbsVector's coordinate attribute is set.

Returns
true if this RelAbsVector's coordinate attribute has been set, otherwise false is returned.

◆ isSetRelativeValue()

bool RelAbsVector::isSetRelativeValue ( ) const

Predicate returning true if this RelAbsVector's "rel" attribute is set.

Returns
true if this RelAbsVector's "rel" attribute has been set, otherwise false is returned.

◆ operator!=()

bool RelAbsVector::operator!= ( const RelAbsVector other) const

Inverse comparison operator.

Return false if two RelAbsVector objects are equal.

Returns
bool false if the two RelAbsValueObjects are equal and true otherwise.

◆ operator+()

RelAbsVector RelAbsVector::operator+ ( const RelAbsVector other) const

addition operator for RelAbsVector objects

◆ operator/()

RelAbsVector RelAbsVector::operator/ ( double  x) const

Divides a RelAbsVector object by a double value.

Parameters
xdivisor
Returns
result of division as a new RelAbsVector object

◆ operator=()

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

Assignment operator for RelAbsVector.

Parameters
rhsthe RelAbsVector object whose values are to be used as the basis of the assignment.

◆ operator==()

bool RelAbsVector::operator== ( const RelAbsVector other) const

Comparison operator.

Return true if two RelAbsVector objects are equal.

Returns
bool true if the two RelAbsValueObjects are equal and false otherwise.

◆ setAbsoluteValue()

int RelAbsVector::setAbsoluteValue ( double  abs)

Sets the absolute coordinate value.

Calling this function with an argument of 0.0 or NaN is equivalent to unsetting the value.

Parameters
absdouble value of the "abs" attribute to be set.

◆ setCoordinate() [1/2]

int RelAbsVector::setCoordinate ( const std::string &  coordString)

Sets the coordinates from the given string.

If the string does not represent a valid value, the relative and the absolute component of the RelAbsVector are set to NaN.

Calling this function with either cooredinate having a value of "0.0" or "NaN" is equivalent to unsetting the value.

Parameters
coordStringvalue string

◆ setCoordinate() [2/2]

int RelAbsVector::setCoordinate ( double  abs,
double  rel = 0.0 
)

Sets the relative and absolute value.

Calling this function with an argument of 0.0 or NaN is equivalent to unsetting the value.

Parameters
absabsolute value
relrelative value. If the relative value is omitted, it is set to 0.

◆ setRelativeValue()

int RelAbsVector::setRelativeValue ( double  rel)

Sets the relative coordinate value.

Calling this function with an argument of 0.0 or NaN is equivalent to unsetting the value.

Parameters
reldouble value of the "rel" attribute to be set.

◆ toString()

std::string RelAbsVector::toString ( ) const
Returns
a string representation of this object

◆ unsetAbsoluteValue()

int RelAbsVector::unsetAbsoluteValue ( )

Unsets the value of the "abs" attribute of this RelAbsVector.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. This particular function only does one thing irrespective of user input or object state, and thus will only return a single value:

◆ unsetCoordinate()

int RelAbsVector::unsetCoordinate ( )

Unsets the value of the "rel" attribute of this RelAbsVector.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. This particular function only does one thing irrespective of user input or object state, and thus will only return a single value:

◆ unsetRelativeValue()

int RelAbsVector::unsetRelativeValue ( )

Unsets the value of the relative coordinate attribute of this RelAbsVector.

Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. This particular function only does one thing irrespective of user input or object state, and thus will only return a single value: