Cerata
A library to generate structural hardware designs
cerata::Instance Class Reference

An instance. More...

#include <graph.h>

+ Inheritance diagram for cerata::Instance:
+ Collaboration diagram for cerata::Instance:

Public Member Functions

GraphAdd (const std::shared_ptr< Object > &obj) override
 Add a node to the component, throwing an exception if the node is a signal.
 
Componentcomponent () const
 Return the component this is an instance of.
 
Graphparent () const
 Return the parent graph.
 
GraphSetParent (Graph *parent)
 Set the parent.
 
NodeMapcomp_to_inst_map ()
 Return the component node to instance node mapping.
 
- Public Member Functions inherited from cerata::Graph
 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.
 
virtual GraphAdd (const std::vector< std::shared_ptr< Object >> &objects)
 Add a list of objects to the component.
 
virtual GraphRemove (Object *obj)
 Remove an object from the component.
 
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.
 
NodeGetNode (const std::string &node_name) const
 Get a Node of a specific type with a specific name.
 
Nodeoperator() (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.
 
PortArrayprt_arr (const std::string &name) const
 Shorthand to Get<PortArray>(...)
 
SignalArraysig_arr (const std::string &name) const
 Shorthand to Get<SignalArray>(...)
 
Portprt (const std::string &name) const
 Shorthand to Get<Port>(...)
 
Signalsig (const std::string &name) const
 Shorthand to Get<Signal>(...)
 
Parameterpar (const std::string &name) const
 Shorthand to Get<Parameter>(...)
 
Parameterpar (const Parameter &param) const
 Get a parameter by supplying another parameter. Lookup is done according to the name of the supplied param.
 
Parameterpar (const std::shared_ptr< Parameter > &param) 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.
 
GraphSetMeta (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.
 
- Public Member Functions inherited from cerata::Named
 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

 Instance (Component *comp, std::string name, Component *parent)
 Construct an Instance of a Component, copying over all its ports and parameters.
 

Static Protected Member Functions

static std::unique_ptr< InstanceMake (Component *component, const std::string &name, Component *parent)
 Create an instance.
 

Protected Attributes

friend Component
 Only a Component should be able to make instances.
 
Componentcomponent_
 The component that this instance instantiates.
 
Graphparent_
 The parent of this instance.
 
NodeMap comp_to_inst
 Mapping from component port and parameter nodes to instantiated nodes.
 
- Protected Attributes inherited from cerata::Graph
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

- Public Types inherited from cerata::Graph
enum  ID { COMPONENT, INSTANCE }
 Graph type ID for convenient run-time type checking. More...
 

Detailed Description

An instance.

An instance graph may not contain any signals.

Definition at line 231 of file graph.h.


The documentation for this class was generated from the following files: