 |
Gorgon Game Engine
|
Go to the documentation of this file.
31 if(ptr==
nullptr)
return;
33 if(references[ptr]==0)
41 if(ptr==
nullptr)
return;
52 auto f=references.find(ptr);
53 if(f==references.end())
return;
60 auto f=references.find(ptr);
61 if(f==references.end())
return;
73 auto f=references.find(ptr);
74 if(f==references.end())
return;
90 auto f=references.find(ptr);
91 if(f==references.end())
return;
98 if(!data.
IsValid())
return false;
104 auto f=references.find(ptr);
105 if(f==references.end())
return false;
116 references.erase(ptr);
126 auto f=references.find(ptr);
127 if(f==references.end())
return;
136 for(
auto it : references) {
137 std::cout<<it.first<<
": "<<it.second<<std::endl;
142 std::map<void*, int> references;
bool isreference
Is a reference, data is a ptr to the original type.
Definition: Data.h:191
bool operator==(const ParameterTemplate &) const
Definition: Runtime.h:222
void Unregister(const Data &data)
Unregisters an object from reference counter.
Definition: Runtime.h:111
Any data
Stored data.
Definition: Data.h:185
void Swap(Any &other)
Swaps the contents of the current any with another.
Definition: Any.h:141
void * optdata
Definition: Runtime.h:220
void Set(const Type &type, Any value)
Sets the data contained in this variable by modifying its type.
Definition: Runtime.h:185
std::string help
Definition: Runtime.h:213
void Register(const Data &data)
Registers a new object of reference counting, this will set reference count to one.
Definition: Runtime.h:24
bool optional
Definition: Runtime.h:217
This class allows references to be counted and destroyed properly.
Definition: Runtime.h:19
void Reset(const Data &data)
Resets the reference count to 0.
Definition: Runtime.h:85
This class can hold any other information providing type erasure.
Definition: Any.h:32
ReferenceCounter References
This system allows objects of automatic lifetime.
Definition: VirtualMachine.h:222
bool reference
Definition: Runtime.h:217
Data describes a piece of data.
Definition: Data.h:22
void Set(const Data &value)
Sets the data contained in this variable.
Definition: Runtime.h:179
std::string GetName() const
Returns the name of the variable.
Definition: Runtime.h:200
void SetReferenceable(const Data &value)
Sets the data contained in this variable.
Definition: Runtime.cpp:15
static VirtualMachine & Get()
Returns the current VM for this thread.
Definition: VirtualMachine.h:109
void ASSERT_FALSE(const std::string &message, int skip=1, int depth=4)
Definition: Assert.h:192
const Type & GetType() const
Returns the type of the data.
Definition: Data.h:173
std::string name
Definition: Runtime.h:213
void Set(Any value)
Sets the data contained in this variable without changing its type.
Definition: Runtime.h:169
This class stores information about types.
Definition: Reflection.h:1165
Type * ParameterTemplateType()
Definition: Runtime.cpp:8
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
bool variable
Definition: Runtime.h:217
std::vector< Value > options
Definition: Runtime.h:214
virtual void Assign(Data &l, const Data &r) const =0
Assigns the value of the second parameter to the first, reference types can ignore this function.
Variable(const std::string &name, const Type &type)
Constructor that sets the name, and type of the variable.
Definition: Runtime.h:163
bool IsReference() const
Returns if this data contains a reference.
Definition: Data.cpp:212
#define ASSERT(expression, message,...)
Replaces regular assert to allow messages and backtrace.
Definition: Assert.h:161
static Data Invalid()
Constructs an invalid data object.
Definition: Data.h:27
void list()
Definition: Runtime.h:135
Variable(const std::string &name, const Type &type, const Any &value)
Constructor that sets the name, type and value of the variable.
Definition: Runtime.h:155
bool IsPointer() const
Checks if any contains a pointer.
Definition: Any.h:327
bool IsRegistered(const Data &data) const
Definition: Runtime.h:97
This class contains a parsed value.
Definition: Instruction.h:82
Value type
Definition: Runtime.h:216
void GetRidOf(Data &data)
Never use without a proper reason.
Definition: Runtime.h:121
This class allows embedded types to become scripting types that are passed around as values.
Definition: Embedding.h:1300
void Delete() const
Attempts to delete the data contained in this data.
Definition: Data.cpp:136
Any GetData() const
Returns the data contained in this data element.
Definition: Data.h:133
Data & operator=(Data)
Assignment operator.
Definition: Data.cpp:96
bool IsReferenceAssigned() const
Definition: Runtime.h:204
This file contains classes that stores runtime and end programmer defined objects.
Data * parent
Definition: Data.h:196
void * defvaldata
Definition: Runtime.h:219
void * Pointer() const
Returns the pointer without type information.
Definition: Any.h:332
const Type * type
Type of the data.
Definition: Data.h:188
void Increase(void *ptr)
Increases the reference count of the given object. If it is not registered, this request is ignored.
Definition: Runtime.h:59
void Register(void *ptr)
Registers a new object of reference counting, this will set reference count to 0.
Definition: Runtime.h:39
bool constant
Definition: Runtime.h:217
void Decrease(const Data &data)
Decreases the reference count of the given object.
Definition: Runtime.h:68
This class holds information about a parameter without resolving constructs.
Definition: Runtime.h:212
Variable(const std::string &name="", const Data &data=Data::Invalid())
Creates an invalid variable.
Definition: Runtime.h:151
bool IsValid() const
Returns if the data is in a valid state.
Definition: Data.h:152
Value defaultvalue
Definition: Runtime.h:215
void Increase(const Data &data)
Increases the reference count of the given object. If it is not registered, this request is ignored.
Definition: Runtime.h:47
This class defines a virtual environment for scripts to run.
Definition: VirtualMachine.h:45
bool isconstant
This data is a constant and should not be changed.
Definition: Data.h:194
This class represents a variable. It contains the data and the name of the variable.
Definition: Runtime.h:146
std::string GetName() const
Returns the name of this member.
Definition: Reflection.h:325