![]() |
chigraph
master
Systems programming language written for beginners in LLVM
|
A class holding a compound type defined in a GraphModule. More...
#include <chi/GraphStruct.hpp>
Public Member Functions | |
GraphStruct (GraphModule &mod, std::string name) | |
GraphType constructor; don't use this use GraphModule::newStruct. More... | |
void | addType (DataType ty, std::string name, size_t addBefore, bool updateReferences=true) |
Add a new type to the struct. More... | |
Context & | context () const |
Get the context. More... | |
DataType | dataType () |
Get the DataType of the struct. More... | |
void | modifyType (size_t id, DataType newTy, std::string newName, bool updateReferences=true) |
Change the type and name of a type. More... | |
GraphModule & | module () const |
Get the module. More... | |
const std::string & | name () const |
Get the name of the type. More... | |
void | removeType (size_t id, bool updateReferences=true) |
Remove a type from a struct. More... | |
std::vector< NodeInstance * > | setName (std::string newName, bool updateReferences=true) |
Set the name of the struct, and optionally update all references in the context. More... | |
const std::vector< NamedDataType > & | types () const |
Get the types the struct contains. More... | |
A class holding a compound type defined in a GraphModule.
Definition at line 18 of file GraphStruct.hpp.
chi::GraphStruct::GraphStruct | ( | GraphModule & | mod, |
std::string | name | ||
) |
GraphType constructor; don't use this use GraphModule::newStruct.
mod | Module to add to |
name | name of the type |
Definition at line 21 of file GraphStruct.cpp.
References name().
void chi::GraphStruct::addType | ( | DataType | ty, |
std::string | name, | ||
size_t | addBefore, | ||
bool | updateReferences = true |
||
) |
Add a new type to the struct.
ty | The type |
ty.vaid()
name | The name of the type |
addBefore | The type to add the new type before. Use types().size() to add to the end |
addBefore <= types().size()
updateReferences | Should the references to make and break nodes be updated? |
Definition at line 68 of file GraphStruct.cpp.
References module(), types(), chi::ChiModule::updateLastEditTime(), and chi::DataType::valid().
Referenced by types().
|
inline |
Get the context.
Definition at line 26 of file GraphStruct.hpp.
Referenced by dataType(), and setName().
DataType chi::GraphStruct::dataType | ( | ) |
Get the DataType of the struct.
Definition at line 111 of file GraphStruct.cpp.
References context(), chi::Context::findInstancesOfType(), chi::Context::llvmContext(), module(), name(), chi::GraphModule::nodeTypeFromName(), types(), and chi::DataType::valid().
Referenced by types().
void chi::GraphStruct::modifyType | ( | size_t | id, |
DataType | newTy, | ||
std::string | newName, | ||
bool | updateReferences = true |
||
) |
Change the type and name of a type.
id | The ID to change |
newTy | The new type |
newName | The new name |
updateReferences | Should the references to make and break nodes be updated? |
Definition at line 82 of file GraphStruct.cpp.
References module(), types(), chi::ChiModule::updateLastEditTime(), and chi::DataType::valid().
Referenced by types().
|
inline |
Get the module.
Definition at line 30 of file GraphStruct.hpp.
References setName().
Referenced by addType(), dataType(), modifyType(), chi::GraphModule::removeStruct(), removeType(), and setName().
|
inline |
Get the name of the type.
Definition at line 43 of file GraphStruct.hpp.
Referenced by dataType(), GraphStruct(), chi::GraphModule::removeStruct(), and setName().
void chi::GraphStruct::removeType | ( | size_t | id, |
bool | updateReferences = true |
||
) |
Remove a type from a struct.
id | The ID to remove |
updateReferences | Should the references to make and break nodes be updated? |
Definition at line 97 of file GraphStruct.cpp.
References module(), types(), and chi::ChiModule::updateLastEditTime().
Referenced by types().
std::vector< NodeInstance * > chi::GraphStruct::setName | ( | std::string | newName, |
bool | updateReferences = true |
||
) |
Set the name of the struct, and optionally update all references in the context.
newName | The new name |
!newName.empty()
updateReferences | Should all the references in the module be updated? |
updateReferences
is false Definition at line 24 of file GraphStruct.cpp.
References context(), chi::Context::findInstancesOfType(), module(), name(), chi::GraphModule::nodeTypeFromName(), and chi::ChiModule::updateLastEditTime().
Referenced by module().
|
inline |
Get the types the struct contains.
Definition at line 47 of file GraphStruct.hpp.
References addType(), dataType(), modifyType(), and removeType().
Referenced by addType(), dataType(), chi::graphStructToJson(), modifyType(), and removeType().