Cerata
A library to generate structural hardware designs
|
#include <graph.h>
Public Member Functions | |
Component (std::string name) | |
Construct an empty Component. | |
Graph & | Add (const std::shared_ptr< Object > &object) override |
Add an object to the component. | |
Graph & | Add (const std::vector< std::shared_ptr< Object >> &objects) override |
Add a list of objects to the component. | |
Graph & | Remove (Object *object) override |
Remove an object from the component. | |
Instance * | Instantiate (Component *comp, const std::string &name="") |
Add an Instance of another Component to this component. More... | |
Instance * | Instantiate (const std::shared_ptr< Component > &comp, const std::string &name="") |
Add an Instance of another Component to this component. More... | |
std::vector< Instance * > | children () const |
Returns all Instance graphs from this Component. | |
virtual std::vector< const Component * > | GetAllInstanceComponents () const |
Returns all unique Components that are referred to by child Instances of this graph. | |
bool | HasChild (const std::string &name) const |
Return true if child graph exists on instance. | |
bool | HasChild (const Instance &inst) const |
Return true if instance is a child of component. | |
NodeMap * | inst_to_comp_map () |
Return the component node to instance node mapping. | |
![]() | |
Graph (std::string name, ID id) | |
Construct a new graph. | |
ID | id () const |
Return the graph type ID. | |
bool | IsComponent () const |
Return true if this graph is a component, false otherwise. | |
bool | IsInstance () const |
Return true if this graph is an instance, false otherwise. | |
template<typename T > | |
std::vector< T * > | GetAll () const |
Get all objects of a specific type. | |
template<typename T > | |
T * | Get (const std::string &name) const |
Get one object of a specific type. | |
std::optional< Node * > | FindNode (const std::string &node_name) const |
Find a node with a specific name. | |
Node * | GetNode (const std::string &node_name) const |
Get a Node of a specific type with a specific name. | |
Node * | operator() (const std::string &node_name) const |
Obtain a node by name. | |
std::vector< Node * > | GetNodesOfTypes (std::initializer_list< Node::NodeID > ids) const |
Obtain all nodes which ids are in a list of Node::IDs. | |
size_t | CountNodes (Node::NodeID id) const |
Count nodes of a specific node type. | |
size_t | CountArrays (Node::NodeID id) const |
Count nodes of a specific array type. | |
std::vector< Node * > | GetNodes () const |
Get all nodes. | |
std::vector< Node * > | GetNodesOfType (Node::NodeID id) const |
Get all nodes of a specific type. | |
std::vector< NodeArray * > | GetArraysOfType (Node::NodeID id) const |
Get all arrays of a specific type. | |
std::vector< Node * > | GetImplicitNodes () const |
Return all graph nodes that do not explicitly belong to the graph. | |
PortArray * | prt_arr (const std::string &name) const |
Shorthand to Get<PortArray>(...) | |
SignalArray * | sig_arr (const std::string &name) const |
Shorthand to Get<SignalArray>(...) | |
Port * | prt (const std::string &name) const |
Shorthand to Get<Port>(...) | |
Signal * | sig (const std::string &name) const |
Shorthand to Get<Signal>(...) | |
Parameter * | par (const std::string &name) const |
Shorthand to Get<Parameter>(...) | |
Parameter * | par (const Parameter ¶m) const |
Get a parameter by supplying another parameter. Lookup is done according to the name of the supplied param. | |
Parameter * | par (const std::shared_ptr< Parameter > ¶m) const |
Get a parameter by supplying another parameter. Lookup is done according to the name of the supplied param. | |
std::unordered_map< std::string, std::string > | meta () const |
Return a copy of the metadata. | |
std::vector< Object * > | objects () const |
Get all objects. | |
bool | Has (const std::string &name) |
Return true if object with name already exists on graph. | |
Graph & | SetMeta (const std::string &key, std::string value) |
Set metadata. | |
std::string | ToString () const |
Return a human-readable representation. | |
std::string | ToStringAllOjects () const |
Return a comma separated list of object names. | |
![]() | |
Named (std::string name) | |
Named constructor. | |
std::string | name () const |
Return the name of the object. | |
void | SetName (std::string name) |
Change the name of the object. | |
virtual | ~Named ()=default |
Destructor. | |
Protected Member Functions | |
Component & | AddChild (std::unique_ptr< Instance > child) |
Add and take ownership of an Instance graph. More... | |
Protected Attributes | |
std::vector< std::unique_ptr< Instance > > | children_ |
Instances. | |
bool | was_instantiated = false |
Whether this component was instantiated. | |
NodeMap | inst_to_comp |
Mapping for instance nodes that have been connected. | |
![]() | |
ID | id_ |
Graph type id for convenience. | |
std::vector< std::shared_ptr< Object > > | objects_ |
Graph objects. | |
std::unordered_map< std::string, std::string > | meta_ |
KV storage for metadata of tools or specific backend implementations. | |
Additional Inherited Members | |
![]() | |
enum | ID { COMPONENT, INSTANCE } |
Graph type ID for convenient run-time type checking. More... | |
A Component graph.
A component graph may contain all node types.