A class holding a compound type defined in a GraphModule
| 16 | |
| 17 | /// A class holding a compound type defined in a GraphModule |
| 18 | struct GraphStruct { |
| 19 | /// GraphType constructor; don't use this use GraphModule::newStruct |
| 20 | /// \param mod Module to add to |
| 21 | /// \param name name of the type |
| 22 | GraphStruct(GraphModule& mod, std::string name); |
| 23 | |
| 24 | /// Get the context |
| 25 | /// \return The Context |
| 26 | Context& context() const { return *mContext; } |
| 27 | |
| 28 | /// Get the module |
| 29 | /// \return The GraphModule |
| 30 | GraphModule& module() const { return *mModule; } |
| 31 | |
| 32 | /// Set the name of the struct, and optionally update all references in the context |
| 33 | /// \warning If updateReferences is false or not all the modules that use this struct are |
| 34 | /// loaded, then there WILL be broken references. |
| 35 | /// \param newName The new name |
| 36 | /// \pre `!newName.empty()` |
| 37 | /// \param updateReferences Should all the references in the module be updated? |
| 38 | /// \return The nodes that were updated, garunteed to be empty of `updateReferences` is false |
| 39 | std::vector<NodeInstance*> setName(std::string newName, bool updateReferences = true); |
| 40 | |
| 41 | /// Get the name of the type |
| 42 | /// \return the name |
| 43 | const std::string& name() const { return mName; } |
| 44 | |
| 45 | /// Get the types the struct contains |
| 46 | /// \return The types |
| 47 | const std::vector<NamedDataType>& types() const { return mTypes; } |
| 48 | |
| 49 | /// Add a new type to the struct |
| 50 | /// \param ty The type |
| 51 | /// \pre `ty.vaid()` |
| 52 | /// \param name The name of the type |
| 53 | /// \param addBefore The type to add the new type before. Use types().size() to add to the end |
| 54 | /// \pre `addBefore <= types().size()` |
| 55 | /// \param updateReferences Should the references to make and break nodes be updated? |
| 56 | void addType(DataType ty, std::string name, size_t addBefore, bool updateReferences = true); |
| 57 | |
| 58 | /// Change the type and name of a type |
| 59 | /// \param id The ID to change |
| 60 | /// \param newTy The new type |
| 61 | /// \param newName The new name |
| 62 | /// \param updateReferences Should the references to make and break nodes be updated? |
| 63 | void modifyType(size_t id, DataType newTy, std::string newName, bool updateReferences = true); |
| 64 | |
| 65 | /// Remove a type from a struct |
| 66 | /// \param id The ID to remove |
| 67 | /// \param updateReferences Should the references to make and break nodes be updated? |
| 68 | void removeType(size_t id, bool updateReferences = true); |
| 69 | |
| 70 | /// Get the DataType of the struct |
| 71 | /// \return The DataType |
| 72 | DataType dataType(); |
| 73 | |
| 74 | private: |
| 75 | void updateNodeReferences(); |
nothing calls this directly
no outgoing calls
no test coverage detected