libSBML C++ API  5.18.0
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 (double a=0.0, double r=0.0)
 Constructor with two values. More...
 
 RelAbsVector (const std::string &coordString)
 Constructor with a value string. More...
 
 RelAbsVector (const RelAbsVector &orig)
 Copy constructor for RelAbsVector. More...
 
int setAbsoluteValue (double abs)
 Sets the absolute coordinate value. More...
 
int setCoordinate (double abs, double rel=0.0)
 Sets the relative and absolute value. More...
 
int setCoordinate (const std::string &coordString)
 Sets the coordinates from the given string. 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::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::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::RelAbsVector ( const RelAbsVector orig)

Copy constructor for RelAbsVector.

Parameters
origthe RelAbsVector instance to copy.
RelAbsVector::~RelAbsVector ( )
virtual

Destroy this RelAbsVector object.

Member Function Documentation

RelAbsVector * RelAbsVector::clone ( ) const
virtual

Creates and returns a deep copy of this RelAbsVector object.

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

resets this element by setting the two coordinates to 0.0

double RelAbsVector::getAbsoluteValue ( ) const

Returns the absolute coordinate value.

Returns
absolute value
std::string RelAbsVector::getCoordinate ( ) const

Returns the coordinate value.

Returns
absolute value
double RelAbsVector::getRelativeValue ( ) const

Returns the relative coordinate value.

Returns
absolute value
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.
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.
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.
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.
RelAbsVector RelAbsVector::operator+ ( const RelAbsVector other) const

addition operator for RelAbsVector objects

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
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.
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.
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.
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.
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
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.
std::string RelAbsVector::toString ( ) const
Returns
a string representation of this object
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:
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:
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: