Cerata
A library to generate structural hardware designs
cerata Namespace Reference

Contains every Cerata class, function, etc... More...

Namespaces

 dot
 Contains everything related to the DOT back-end.
 
 vhdl
 Contains everything related to the VHDL back-end.
 

Classes

struct  Bit
 A bit type. More...
 
struct  Boolean
 Boolean type. More...
 
struct  ClockDomain
 A clock domain. More...
 
class  Component
 A Component graph. More...
 
class  ComponentPool
 A pool of Components. More...
 
class  Edge
 A directed edge between two nodes. More...
 
class  Expression
 A node representing a binary tree of other nodes. More...
 
class  Field
 A Record field. More...
 
struct  FlatType
 A flattened type. More...
 
class  Graph
 A graph representing a hardware structure. More...
 
class  Instance
 An instance. More...
 
struct  Integer
 Integer type. More...
 
class  Literal
 A Literal Node. More...
 
class  Logger
 Logger class. More...
 
class  MappingMatrix
 A matrix used for TypeMapper. More...
 
struct  MappingPair
 A structure representing a mapping pair for a type mapping. More...
 
struct  MultiOutputNode
 A no-input, multiple-outputs node. More...
 
struct  Named
 Convenience structure for anything that is named. Names are case-sensitive. More...
 
struct  NamePart
 Convenience struct to generate names in parts. More...
 
class  Node
 A node. More...
 
class  NodeArray
 An array of nodes. More...
 
class  NodePool
 A pool of nodes. More...
 
struct  NormalNode
 A single-input, multiple-outputs node. More...
 
class  Object
 A Cerata Object on a graph. More...
 
class  OutputGenerator
 Abstract class to generate language specific output from Graphs. More...
 
struct  OutputSpec
 Structure to specify output properties per graph. More...
 
class  Parameter
 A Parameter node. More...
 
class  Pool
 A pool to share ownership of objects. More...
 
class  Port
 A port is a terminator node on a graph. More...
 
class  PortArray
 An array of port nodes. More...
 
class  Record
 A Record type containing zero or more fields. More...
 
class  Signal
 A Signal Node. More...
 
class  SignalArray
 An array of signal nodes. More...
 
class  Stream
 A Stream type. More...
 
struct  String
 String type. More...
 
class  Synchronous
 Class to mark nodes with information for synchronous designs, e.g. clock domain. More...
 
class  Term
 A terminator structure to enable terminator sanity checks. More...
 
class  Type
 A Type. More...
 
class  TypeMapper
 A structure to dynamically define type mappings between flattened types. More...
 
class  TypePool
 A pool of Types. More...
 
class  Vector
 Vector type. More...
 

Typedefs

using LogLevel = int
 Type used for the logging level.
 
typedef std::unordered_map< const Node *, Node * > NodeMap
 A mapping from one object to another object, used in e.g. type generic rebinding.
 
using Status = putong::Status< Error >
 

Enumerations

enum  Error { GenericError, YAMLError }
 Error types.
 

Functions

std::shared_ptr< PortArrayport_array (const std::string &name, const std::shared_ptr< Type > &type, const std::shared_ptr< Node > &size, Port::Dir dir=Port::Dir::IN, const std::shared_ptr< ClockDomain > &domain=default_domain())
 Get a smart pointer to a new ArrayPort.
 
std::shared_ptr< PortArrayport_array (const std::shared_ptr< Port > &base_node, const std::shared_ptr< Node > &size)
 Get a smart pointer to a new ArrayPort with a base type other than the default Port.
 
std::shared_ptr< SignalArraysignal_array (const std::string &name, const std::shared_ptr< Type > &type, const std::shared_ptr< Node > &size, const std::shared_ptr< ClockDomain > &domain=default_domain())
 Construct a new node array and return a shared pointer to it. More...
 
std::shared_ptr< ClockDomaindefault_domain ()
 Return a static default clock domain.
 
std::optional< std::shared_ptr< ClockDomain > > GetDomain (const Node &node)
 Return the clock domain of a node, if it is a synchronous node.
 
std::shared_ptr< EdgeConnect (Node *dst, Node *src)
 Connect two nodes, returns the corresponding edge. More...
 
std::shared_ptr< Edgeoperator<<= (Node *dst, const std::shared_ptr< Node > &src)
 Create an edge, connecting the src node to the dst node.
 
std::shared_ptr< Edgeoperator<<= (const std::shared_ptr< Node > &dst, const std::shared_ptr< Node > &src)
 Create an edge, connecting the src node to the dst node.
 
std::shared_ptr< Edgeoperator<<= (const std::shared_ptr< Node > &dst, Node *src)
 Create an edge, connecting the src node to the dst node.
 
std::vector< Edge * > GetAllEdges (const Graph &graph)
 Obtain all edges in a graph.
 
std::shared_ptr< EdgeConnect (Node *dst, const std::shared_ptr< Node > &src)
 Connect two nodes, returns the corresponding edge. More...
 
std::shared_ptr< EdgeConnect (const std::shared_ptr< Node > &dst, Node *src)
 Connect two nodes, returns the corresponding edge. More...
 
std::shared_ptr< EdgeConnect (const std::shared_ptr< Node > &dst, const std::shared_ptr< Node > &src)
 Connect two nodes, returns the corresponding edge. More...
 
SignalAttachSignalToNode (Component *comp, NormalNode *node, NodeMap *rebinding, std::string name="")
 Attach a Signal to a Node, redirecting all edges through the new Signal. More...
 
SignalArrayAttachSignalArrayToNodeArray (Component *comp, NodeArray *array, NodeMap *rebinding)
 Attach a SignalArray to a Node, redirecting all edges through the new SignalArray. More...
 
std::shared_ptr< EdgeConnect (Node *dst, std::string str)
 Connect a string literal to another node. More...
 
std::string ToString (Expression::Op operation)
 Human-readable expression operator.
 
bool operator< (const FlatType &a, const FlatType &b)
 Compares two FlatTypes first by name, then by nesting level. Useful for sorting.
 
void FlattenRecord (std::vector< FlatType > *list, const Record *record, const std::optional< FlatType > &parent, bool invert)
 Flatten a Record.
 
void Flatten (std::vector< FlatType > *list, Type *type, const std::optional< FlatType > &parent, const std::string &name, bool invert, bool sep=true)
 Flatten any Type.
 
std::vector< FlatTypeFlatten (Type *type)
 Flatten and return a list of FlatTypes.
 
std::string ToString (std::vector< FlatType > flat_type_list)
 Convert a list of FlatTypes to a human-readable string.
 
bool ContainsFlatType (const std::vector< FlatType > &flat_types_list, const Type *type)
 Return true if some Type is contained in a list of FlatTypes, false otherwise.
 
int64_t IndexOfFlatType (const std::vector< FlatType > &flat_types_list, const Type *type)
 Return the index of some Type in a list of FlatTypes.
 
void FlattenStream (std::vector< FlatType > *list, const Stream *stream, const std::optional< FlatType > &parent, bool invert)
 Flatten a Stream.
 
std::shared_ptr< Componentcomponent (std::string name, const std::vector< std::shared_ptr< Object >> &nodes, ComponentPool *component_pool=default_component_pool())
 Construct a Component with initial nodes.
 
std::shared_ptr< Componentcomponent (std::string name, ComponentPool *component_pool=default_component_pool())
 Construct an empty Component with only a name.
 
template<typename T >
RawValueOf (const Literal &node)
 Obtain the raw value of a literal node. More...
 
template<>
bool RawValueOf (const Literal &node)
 Template specialization for RawValueOf<bool> More...
 
template<typename T >
Literal::StorageType StorageTypeOf ()
 Obtain the Literal::StorageType enum value of a C++ type T.
 
template<>
Literal::StorageType StorageTypeOf< bool > ()
 Template specialization for StorageTypeOf<bool>
 
template<>
Literal::StorageType StorageTypeOf< int64_t > ()
 Template specialization for StorageTypeOf<int>
 
template<>
Literal::StorageType StorageTypeOf< uint64_t > ()
 Template specialization for StorageTypeOf<int>
 
template<>
Literal::StorageType StorageTypeOf< std::string > ()
 Template specialization for StorageTypeOf<std::string>
 
Loggerlogger ()
 Return the global Cerata logger.
 
void ImplicitlyRebindNodes (Graph *dst, const std::vector< Node * > &nodes, NodeMap *rebinding)
 Make sure that the NodeMap contains all nodes to be rebound onto the destination graph.
 
std::string ToString (Node::NodeID id)
 Convert a Node ID to a human-readable string.
 
void GetObjectReferences (const Object &obj, std::vector< Object * > *out)
 Get any sub-objects that are used by an object, e.g. type generic nodes or array size nodes. More...
 
std::shared_ptr< Parameterparameter (const std::string &name, const std::shared_ptr< Type > &type, std::shared_ptr< Literal > default_value=nullptr)
 Create a new parameter. More...
 
std::shared_ptr< Parameterparameter (const std::string &name, int default_value)
 Create a new integer-type parameter.
 
std::shared_ptr< Parameterparameter (const std::string &name, bool default_value)
 Create a new boolean-type parameter.
 
std::shared_ptr< Parameterparameter (const std::string &name, std::string default_value)
 Create a new string-type parameter.
 
std::shared_ptr< Parameterparameter (const std::string &name)
 Create a new integer-type parameter with default value 0.
 
TypePooldefault_type_pool ()
 Return a global default TypePool.
 
ComponentPooldefault_component_pool ()
 Return a global default component pool.
 
NodePooldefault_node_pool ()
 Return a global default node pool that can store nodes without being owned by a graph.
 
Literalrintl (int64_t i)
 Obtain a raw pointer to an integer literal from the default node pool.
 
std::shared_ptr< Literalintl (int64_t i)
 Obtain a shared pointer to an integer literal from the default node pool.
 
Literalrstrl (std::string str)
 Obtain a raw pointer to a string literal from the default node pool.
 
std::shared_ptr< Literalstrl (std::string str)
 Obtain a shared pointer to a string literal from the default node pool.
 
std::shared_ptr< Literalbooll (bool value)
 Return a literal node representing a Boolean.
 
std::shared_ptr< Portport (const std::string &name, const std::shared_ptr< Type > &type, Term::Dir dir, const std::shared_ptr< ClockDomain > &domain=default_domain())
 Make a new port with some name, type and direction.
 
std::shared_ptr< Portport (const std::shared_ptr< Type > &type, Term::Dir dir, const std::shared_ptr< ClockDomain > &domain=default_domain())
 Make a new port. The name will be derived from the name of the type.
 
std::shared_ptr< Signalsignal (const std::string &name, const std::shared_ptr< Type > &type, const std::shared_ptr< ClockDomain > &domain=default_domain())
 Create a new Signal and return a smart pointer to it.
 
std::shared_ptr< Signalsignal (const std::shared_ptr< Type > &type, const std::shared_ptr< ClockDomain > &domain=default_domain())
 Create a new Signal and return a smart pointer to it. The Signal name is derived from the Type name.
 
std::shared_ptr< Streamstream (const std::string &name, const std::string &element_name, const std::shared_ptr< Type > &element_type, const std::vector< std::shared_ptr< Field >> &control={field(Stream::valid()), field(Stream::ready()) ->Reverse()})
 Construct a new Stream type and return a shared pointer to it. More...
 
std::shared_ptr< Streamstream (const std::string &element_name, const std::shared_ptr< Type > &element_type)
 Construct a new Stream type with valid/ready bit control fields, named after the elements. More...
 
std::shared_ptr< Streamstream (const std::shared_ptr< Type > &element_type)
 Construct a new Stream type with valid/ready bit control fields, named after the element type. More...
 
void GetAllGraphs (Graph *top_graph, std::vector< Graph * > *graphs_out, bool include_components=false)
 Get all potential child graphs of a graph. More...
 
void GetAllObjects (Component *top_component, std::vector< Object * > *objects_out, bool include_instances=false)
 Get all objects from a component. More...
 
void GetAllTypes (Component *top_component, std::vector< Type * > *types_out, bool include_instances=false)
 Get all types used in a component, including nested types. More...
 
std::shared_ptr< Typevector (const std::string &name, const std::shared_ptr< Node > &width)
 Create a new vector type, and return a shared pointer to it.
 
std::shared_ptr< Typevector (const std::shared_ptr< Node > &width)
 Create a new vector type, and return a shared pointer to it.
 
std::shared_ptr< Typevector (unsigned int width)
 Create a new vector type with an integer literal as width.
 
std::shared_ptr< Typevector (std::string name, unsigned int width)
 Create a new vector type with an integer literal as width and a custom name.
 
std::shared_ptr< Typebit (const std::string &name="bit")
 Return a static bit type.
 
std::shared_ptr< Typeboolean ()
 Return a static boolean type.
 
std::shared_ptr< Typeinteger ()
 Return a static integer type.
 
std::shared_ptr< Typestring ()
 Return a static string type.
 
std::shared_ptr< Fieldfield (const std::string &name, const std::shared_ptr< Type > &type, bool reverse=false, bool sep=true)
 Create a new RecordField, and return a shared pointer to it.
 
std::shared_ptr< Fieldfield (const std::shared_ptr< Type > &type, bool reverse=false, bool sep=true)
 Create a new RecordField, and return a shared pointer to it. The name will be taken from the type.
 
std::shared_ptr< FieldNoSep (std::shared_ptr< Field > field)
 Convenience function to disable the separator for a record field.
 
std::shared_ptr< Recordrecord (const std::string &name, const std::vector< std::shared_ptr< Field >> &fields)
 Create a new Record type, and return a shared pointer to it. More...
 
std::shared_ptr< Recordrecord (const std::string &name)
 Create a new, empty Record type, and return a shared pointer to it. More...
 
std::shared_ptr< Recordrecord (const std::vector< std::shared_ptr< Field >> &fields)
 Create a new, anonymous Record type, and return a shared pointer to it. More...
 
std::shared_ptr< Recordrecord (const std::initializer_list< std::shared_ptr< Field >> &fields)
 Create a new, anonymous Record type, and return a shared pointer to it. More...
 
std::string ToUpper (std::string str)
 Convert string to upper-case.
 
std::string ToLower (std::string str)
 Convert string to lower-case.
 
std::string ToString (const std::unordered_map< std::string, std::string > &meta)
 Return a human-readable representation of an unordered map of string key-value pairs.
 
void CreateDir (const std::string &dir_name)
 Create a directory.
 
bool FileExists (const std::string &name)
 Check if file exists.
 
std::string version ()
 Return library version.
 
template<typename T >
bool Contains (const std::vector< std::shared_ptr< T >> &list, const std::shared_ptr< T > &item)
 Return true if vector contains item, false otherwise.
 
template<typename T >
bool Contains (const std::vector< std::weak_ptr< T >> &list, const std::weak_ptr< T > &item)
 Return true if vector contains item, false otherwise.
 
template<typename T >
bool Contains (const std::vector< T * > &list, T *item)
 Return true if vector contains item, false otherwise.
 
template<typename T >
void Append (std::vector< T > *list_a, const std::vector< T > &list_b)
 Append list b to list a.
 
template<typename T >
std::vector< T > Merge (std::initializer_list< std::vector< T >> lists)
 Merge a list of vectors into one vector.
 
template<typename T , typename U >
std::vector< T > Merge (std::initializer_list< std::unordered_map< T, U >> lists)
 Merge a list of unordered maps into one unordered map.
 
template<typename T >
bool Remove (std::vector< std::shared_ptr< T >> *list, const std::shared_ptr< T > &item)
 Remove an item from a vector, returning false if it was not in the vector, true otherwise. More...
 
template<typename T >
std::vector< T * > ToRawPointers (const std::vector< std::shared_ptr< T >> &list)
 Convert a list of shared pointers to raw pointers. More...
 
template<typename T >
std::vector< T * > ToRawPointers (const std::vector< std::unique_ptr< T >> &list)
 Convert a list of unique pointers to raw pointers. More...
 
template<typename T , typename U >
std::vector< T * > As (const std::vector< U * > &vec)
 Cast a vector of pointers to some other type. More...
 
template<typename T >
std::vector< T > Unique (const std::vector< T > &vec)
 Return a copy of a vector without any duplicates.
 
template<typename T >
void FilterDuplicates (std::vector< T > *vec)
 Filter duplicate entries from a vector.
 
template<typename T >
std::string ToString ()
 Return a human-readable string from a type. More...
 

Variables

constexpr LogLevel CERATA_LOG_DEBUG = -1
 Debug level.
 
constexpr LogLevel CERATA_LOG_INFO = 0
 Information level.
 
constexpr LogLevel CERATA_LOG_WARNING = 1
 Warning level.
 
constexpr LogLevel CERATA_LOG_ERROR = 2
 Error level.
 
constexpr LogLevel CERATA_LOG_FATAL = 3
 Fatal level; tool should exit.
 

Detailed Description

Contains every Cerata class, function, etc...

Function Documentation

◆ As()

template<typename T , typename U >
std::vector<T *> cerata::As ( const std::vector< U * > &  vec)

Cast a vector of pointers to some other type.

Template Parameters
TThe type of the objects being pointed to.
Parameters
vecThe vector of pointers.
Returns
A list of raw pointers.

Definition at line 155 of file utils.h.

◆ AttachSignalArrayToNodeArray()

SignalArray * cerata::AttachSignalArrayToNodeArray ( Component comp,
NodeArray array,
NodeMap rebinding 
)

Attach a SignalArray to a Node, redirecting all edges through the new SignalArray.

Parameters
compThe component to add and own the SignalArray.
arrayThe NodeArray to attach the SignalArray to.
rebindingA pointer to a NodeMap to which all rebound Nodes will be appended.
Returns
A pointer to the new SignalArray.

Definition at line 327 of file edge.cc.

◆ AttachSignalToNode()

Signal * cerata::AttachSignalToNode ( Component comp,
NormalNode node,
NodeMap rebinding,
std::string  name = "" 
)

Attach a Signal to a Node, redirecting all edges through the new Signal.

Parameters
compThe component to add and own the Signal.
nodeThe Node to attach the Signal to.
rebindingA pointer to a NodeMap to which all rebound Nodes will be appended.
nameA name for the new Signal.
Returns
A pointer to the new Signal.

Definition at line 254 of file edge.cc.

◆ Connect() [1/5]

std::shared_ptr< Edge > cerata::Connect ( const std::shared_ptr< Node > &  dst,
const std::shared_ptr< Node > &  src 
)

Connect two nodes, returns the corresponding edge.

Parameters
dstThe destination node.
srcThe source node.
Returns
The edge connecting the nodes.

Definition at line 227 of file edge.cc.

◆ Connect() [2/5]

std::shared_ptr< Edge > cerata::Connect ( const std::shared_ptr< Node > &  dst,
Node src 
)

Connect two nodes, returns the corresponding edge.

Parameters
dstThe destination node.
srcThe source node.
Returns
The edge connecting the nodes.

Definition at line 223 of file edge.cc.

◆ Connect() [3/5]

std::shared_ptr< Edge > cerata::Connect ( Node dst,
const std::shared_ptr< Node > &  src 
)

Connect two nodes, returns the corresponding edge.

Parameters
dstThe destination node.
srcThe source node.
Returns
The edge connecting the nodes.

Definition at line 219 of file edge.cc.

◆ Connect() [4/5]

std::shared_ptr< Edge > cerata::Connect ( Node dst,
Node src 
)

Connect two nodes, returns the corresponding edge.

Parameters
dstThe destination node.
srcThe source node.
Returns
The edge connecting the nodes.

Definition at line 68 of file edge.cc.

◆ Connect() [5/5]

std::shared_ptr< Edge > cerata::Connect ( Node dst,
std::string  str 
)

Connect a string literal to another node.

Parameters
dstThe destination node.
strA string out of which a string literal node will be created..
Returns
The edge connecting the nodes.

Definition at line 412 of file edge.cc.

◆ GetAllGraphs()

void cerata::GetAllGraphs ( Graph top_graph,
std::vector< Graph * > *  graphs_out,
bool  include_components = false 
)

Get all potential child graphs of a graph.

Parameters
top_graphThe top-level graph to inspect.
graphs_outA list of graphs to append the output to.
include_componentsWhether to recurse down the components used by any instances in the graph.

Definition at line 27 of file transform.cc.

◆ GetAllObjects()

void cerata::GetAllObjects ( Component top_component,
std::vector< Object * > *  objects_out,
bool  include_instances = false 
)

Get all objects from a component.

Parameters
top_componentThe top-level component to inspect.
objects_outA list of objects to append the output to.
include_instancesWhether to recurse down the instances in the top-level graph.

Definition at line 48 of file transform.cc.

◆ GetAllTypes()

void cerata::GetAllTypes ( Component top_component,
std::vector< Type * > *  types_out,
bool  include_instances = false 
)

Get all types used in a component, including nested types.

Parameters
top_componentThe top-level component to inspect.
types_outA list of types to append the output to.
include_instancesWhether to recurse down the instances in the top-level graph.

Definition at line 61 of file transform.cc.

◆ GetObjectReferences()

void cerata::GetObjectReferences ( const Object obj,
std::vector< Object * > *  out 
)

Get any sub-objects that are used by an object, e.g. type generic nodes or array size nodes.

Parameters
objThe object from which to derive the required objects.
outThe output.

Definition at line 247 of file node.cc.

◆ parameter()

std::shared_ptr< Parameter > cerata::parameter ( const std::string &  name,
const std::shared_ptr< Type > &  type,
std::shared_ptr< Literal default_value = nullptr 
)

Create a new parameter.

If no default value is supplied, a default value is implicitly created based on the type.

Parameters
nameThe name of the parameter.
typeThe type of the parameter.
default_valueThe default value of the parameter.
Returns
A shared pointer to a new parameter.

Definition at line 45 of file parameter.cc.

◆ RawValueOf() [1/2]

template<typename T >
T cerata::RawValueOf ( const Literal node)

Obtain the raw value of a literal node.

Template Parameters
TThe compile-time return type.
Parameters
nodeThe node to obtain the value from.
Returns
The value of type T.

Definition at line 108 of file literal.h.

◆ RawValueOf() [2/2]

template<>
std::string cerata::RawValueOf ( const Literal node)
inline

Template specialization for RawValueOf<bool>

Template specialization for RawValueOf<std::string>

Template specialization for RawValueOf<int>

Definition at line 112 of file literal.h.

◆ record() [1/4]

std::shared_ptr< Record > cerata::record ( const std::initializer_list< std::shared_ptr< Field >> &  fields)

Create a new, anonymous Record type, and return a shared pointer to it.

Parameters
fieldsThe fields of the record type.
Returns
A shared pointer to the Record Type.

Definition at line 320 of file type.cc.

◆ record() [2/4]

std::shared_ptr< Record > cerata::record ( const std::string &  name)

Create a new, empty Record type, and return a shared pointer to it.

Parameters
nameThe name of the new Record type.
Returns
A shared pointer to the Record Type.

Definition at line 312 of file type.cc.

◆ record() [3/4]

std::shared_ptr< Record > cerata::record ( const std::string &  name,
const std::vector< std::shared_ptr< Field >> &  fields 
)

Create a new Record type, and return a shared pointer to it.

Parameters
nameThe name of the new Record type.
fieldsThe fields of the record type.
Returns
A shared pointer to the Record Type.

Definition at line 308 of file type.cc.

◆ record() [4/4]

std::shared_ptr< Record > cerata::record ( const std::vector< std::shared_ptr< Field >> &  fields)

Create a new, anonymous Record type, and return a shared pointer to it.

Parameters
fieldsThe fields of the record type.
Returns
A shared pointer to the Record Type.

Definition at line 316 of file type.cc.

◆ Remove()

template<typename T >
bool cerata::Remove ( std::vector< std::shared_ptr< T >> *  list,
const std::shared_ptr< T > &  item 
)

Remove an item from a vector, returning false if it was not in the vector, true otherwise.

Template Parameters
TThe type of the item
Parameters
listThe vector
itemThe item to remove
Returns
True if item was in list and got removed, false otherwise.

Definition at line 108 of file utils.h.

◆ signal_array()

std::shared_ptr< SignalArray > cerata::signal_array ( const std::string &  name,
const std::shared_ptr< Type > &  type,
const std::shared_ptr< Node > &  size,
const std::shared_ptr< ClockDomain > &  domain = default_domain() 
)

Construct a new node array and return a shared pointer to it.

Parameters
nameThe name of the node array.
typeThe type of the nodes in the node array.
sizeThe size node of the node array.
domainThe clock domain of the nodes in the node array.
Returns
A shared pointer to the new node array.

Definition at line 198 of file array.cc.

◆ stream() [1/3]

std::shared_ptr< Stream > cerata::stream ( const std::shared_ptr< Type > &  element_type)

Construct a new Stream type with valid/ready bit control fields, named after the element type.

Parameters
element_typeThe type of the elements on the stream.
Returns
A shared pointer to the new Stream type.

Definition at line 68 of file stream.cc.

◆ stream() [2/3]

std::shared_ptr< Stream > cerata::stream ( const std::string &  element_name,
const std::shared_ptr< Type > &  element_type 
)

Construct a new Stream type with valid/ready bit control fields, named after the elements.

Parameters
element_nameThe name of the elements.
element_typeThe type of the elements on the stream.
Returns
A shared pointer to the new Stream type.

Definition at line 64 of file stream.cc.

◆ stream() [3/3]

std::shared_ptr< Stream > cerata::stream ( const std::string &  name,
const std::string &  element_name,
const std::shared_ptr< Type > &  element_type,
const std::vector< std::shared_ptr< Field >> &  control = {field(Stream::valid()), field(Stream::ready()) ->Reverse()} 
)

Construct a new Stream type and return a shared pointer to it.

The Stream type is just a sugar coated version of a Record.

Parameters
nameThe name of the Type.
element_nameThe name of the elements.
element_typeThe type of the elements on the stream.
controlFields that should travel on the stream as control information. This is a valid and ready signal by default.
Returns
A shared pointer to the new Stream type.

Definition at line 57 of file stream.cc.

◆ ToRawPointers() [1/2]

template<typename T >
std::vector<T *> cerata::ToRawPointers ( const std::vector< std::shared_ptr< T >> &  list)

Convert a list of shared pointers to raw pointers.

Template Parameters
TThe type of the objects being pointed to.
Parameters
listThe list of shared pointers.
Returns
A list of raw pointers.

Definition at line 125 of file utils.h.

◆ ToRawPointers() [2/2]

template<typename T >
std::vector<T *> cerata::ToRawPointers ( const std::vector< std::unique_ptr< T >> &  list)

Convert a list of unique pointers to raw pointers.

Template Parameters
TThe type of the objects being pointed to.
Parameters
listThe list of unique pointers.
Returns
A list of raw pointers.

Definition at line 140 of file utils.h.

◆ ToString()

template<typename T >
std::string cerata::ToString ( )

Return a human-readable string from a type.

Template Parameters
TThe type.
Returns
The human-readable string.

Definition at line 185 of file utils.h.