|
CeresEngine 0.2.0
A game development framework
|
A variable as used in an expression. More...
#include <CeresEngine/Foundation/Constraint/ConstraintVariable.hpp>
Classes | |
| class | Data |
Public Member Functions | |
| ConstraintVariable (String name, Any &&context=Any()) | |
| ConstraintVariable (const ConstraintVariable &)=default | |
| ConstraintVariable & | operator= (const ConstraintVariable &)=default |
| ConstraintVariable (ConstraintVariable &&) noexcept=default | |
| ConstraintVariable & | operator= (ConstraintVariable &&) noexcept=default |
| ~ConstraintVariable ()=default | |
| const String & | getName () const |
| Any & | getContext () const |
| void | setContext (Any &&context) |
| double | getValue () const |
| void | setValue (const double value) |
| bool | equals (const ConstraintVariable &other) |
| String | toString () const |
| Gets a string representation of the variable. | |
Private Attributes | |
| RC< Data > | mData |
| A pointer to the shared object of the variable. | |
Friends | |
| std::ostream & | operator<< (std::ostream &stream, const ConstraintVariable &variable) |
Writes the variable to the given stream. | |
| bool | operator< (const ConstraintVariable &lhs, const ConstraintVariable &rhs) |
A variable as used in an expression.
Variables don't use the normal C++ copy semantics: objects are actually counted references. The following example illustrates this:
Also note that a variable is nullable. A variable that has been constructed without a type cannot be used in expressions.
Another caveat: x == y is not a boolean, but an LinearExpression that can be evaluated and used in constraints. There are two ways to compare two variables, depending on whether you want to test for equality or equivalence:
|
inlineexplicit |
|
default |
|
defaultnoexcept |
|
default |
|
inline |
|
inline |
|
inline |
|
default |
|
defaultnoexcept |
| String CeresEngine::Constraint::ConstraintVariable::toString | ( | ) | const |
Gets a string representation of the variable.
|
friend |
|
friend |
Writes the variable to the given stream.
A pointer to the shared object of the variable.