![]() |
Gorgon Game Engine
|
This class represents a variable. It contains the data and the name of the variable. More...
Public Member Functions | |
Variable (const std::string &name, const Type &type) | |
Constructor that sets the name, and type of the variable. More... | |
Variable (const std::string &name, const Type &type, const Any &value) | |
Constructor that sets the name, type and value of the variable. More... | |
Variable (const std::string &name="", const Data &data=Data::Invalid()) | |
Creates an invalid variable. More... | |
std::string | GetName () const |
Returns the name of the variable. More... | |
bool | IsReferenceAssigned () const |
void | Set (Any value) |
Sets the data contained in this variable without changing its type. More... | |
void | Set (const Data &value) |
Sets the data contained in this variable. More... | |
void | Set (const Type &type, Any value) |
Sets the data contained in this variable by modifying its type. More... | |
void | SetReferenceable (const Data &value) |
Sets the data contained in this variable. More... | |
![]() | |
Data () | |
Constructs an invalid data. More... | |
Data (const Data &other) | |
Copy constructor. More... | |
Data (const Type &type) | |
Default value constructor. Value of the data is determined from the type. More... | |
Data (const Type &type, const Any &data, bool isreference=false, bool isconstant=false) | |
Any constructor. Allows both data and type to be specified. More... | |
Data (const Type *type, const Any &data, bool isreference=false, bool isconstant=false) | |
Any constructor. Allows both data and type to be specified. More... | |
Data (Data &&other) | |
Move constructor. More... | |
virtual | ~Data () |
void | Delete () const |
Attempts to delete the data contained in this data. More... | |
Data | DeReference () |
Any | GetData () const |
Returns the data contained in this data element. More... | |
Data | GetReference () |
const Type & | GetType () const |
Returns the type of the data. More... | |
template<class T_ > | |
std::enable_if<!std::is_pointer< T_ >::value, const typename std::remove_reference< T_ >::type & >::type | GetValue () const |
Returns the value of this data in the requested format. More... | |
template<class T_ > | |
std::enable_if< std::is_pointer< T_ >::value &&std::is_const< typename std::remove_pointer< T_ >::type >::value, T_ >::type | GetValue () const |
Returns the value of this data in the requested format. More... | |
template<class T_ > | |
std::enable_if< std::is_pointer< T_ >::value &&!std::is_const< typename std::remove_pointer< T_ >::type >::value, T_ >::type | GetValue () const |
Returns the value of this data in the requested format. More... | |
bool | IsConstant () const |
Returns if this data is constant. More... | |
bool | IsNull () const |
bool | IsReference () const |
Returns if this data contains a reference. More... | |
bool | IsValid () const |
Returns if the data is in a valid state. More... | |
void | MakeConstant () |
Makes this data a constant. More... | |
Data & | operator= (Data) |
Assignment operator. More... | |
bool | operator== (const Data &r) const |
template<class T_ > | |
std::enable_if< std::is_pointer< T_ >::value, T_ >::type | ReferenceValue () const |
Returns the value of this data in the requested format. More... | |
template<class T_ > | |
std::enable_if<!std::is_pointer< T_ >::value, T_ >::type | ReferenceValue () const |
Returns the value of this data in the requested format. More... | |
void | RemoveParent () |
void | SetParent (const Data data) |
std::string | ToString () const |
Additional Inherited Members | |
![]() | |
static Data | Invalid () |
Constructs an invalid data object. More... | |
![]() | |
Any | data |
Stored data. More... | |
bool | isconstant |
This data is a constant and should not be changed. More... | |
bool | isreference |
Is a reference, data is a ptr to the original type. More... | |
Data * | parent |
const Type * | type |
Type of the data. More... | |
This class represents a variable. It contains the data and the name of the variable.
Variable | ( | const std::string & | name = "" , |
const Data & | data = Data::Invalid() |
||
) |
Creates an invalid variable.
Constructor that sets the name, type and value of the variable.
Unless this variable is declared inside an executing code, definedin should be left nullptr.
Constructor that sets the name, and type of the variable.
Default value of the specified type is used as value. Unless this variable is declared inside an executing code, definedin should be left nullptr.
std::string GetName | ( | ) | const |
Returns the name of the variable.
bool IsReferenceAssigned | ( | ) | const |
void Set | ( | Any | value | ) |
Sets the data contained in this variable without changing its type.
References Data::data, Data::isconstant, Data::isreference, Data::parent, and Any::Swap().
void Set | ( | const Data & | value | ) |
Sets the data contained in this variable.
References Data::operator=().
Sets the data contained in this variable by modifying its type.
Also this function resets the tags unless they are re-specified
References Data::data, Data::isconstant, Data::isreference, Data::parent, Any::Swap(), and Data::type.
void SetReferenceable | ( | const Data & | value | ) |
Sets the data contained in this variable.
If it is a reference, the value that is referenced is updated
References Type::Assign(), VirtualMachine::Get(), Data::GetType(), ReferenceCounter::Increase(), Data::isconstant, Data::IsReference(), and VirtualMachine::References.