 |
Cerata
A library to generate structural hardware designs
|
22 #include "cerata/graph.h"
23 #include "cerata/node.h"
28 inline std::string
tab(uint n) {
29 return std::string(2 * n,
' ');
33 inline std::string
tab(
int n) {
34 return tab(
static_cast<uint
>(n));
39 std::replace(in.begin(), in.end(),
':',
'_');
40 std::replace(in.begin(), in.end(),
'-',
'_');
41 std::replace(in.begin(), in.end(),
'"',
'_');
46 inline std::string
awq(
const std::string &attribute,
const std::string &style) {
48 return attribute +
"=\"" + style +
"\"";
65 std::vector<std::string>
b;
66 std::vector<std::string>
m;
67 std::vector<std::string>
d;
190 const std::string &name,
195 const std::string &name,
struct cerata::dot::Style::NodeStyle::TypeStyle type
Styles for types.
bool signals
Show signals.
struct cerata::dot::Config::NodeConfig nodes
Node configuration.
std::string tab(uint n)
Return indent string.
struct cerata::dot::Style::SubGraph subgraph
Style for sub graphs.
bool stream
Expand streams.
static Config normal()
Return a configuration that will generate default constructs.
str nested
Style for nested nodes.
str record
Record node color.
str param
Style for parameter edges.
str stream_child
Stream child color.
Node group configuration.
static Style normal()
Default style.
bool expressions
Show expressions.
std::string darker
Darker gray color.
str parameter
Style for parameters.
str base
Base style for groups.
str port_to_port
Style for port-to-port.
bool record
Expand records.
str expr
Style for expressions.
std::string light
Light gray color.
struct cerata::dot::Style::EdgeStyle::Colors color
Colors for specific edges.
std::string white
White color.
str stream
Stream node color.
std::string dark
Very dark gray color.
Styles for specific node types.
std::string str
Short-hand for std::string.
str color
Color for groups.
str literal
Style for literals.
std::string GetStyle(const Node &n)
Get the style for a node.
Convenience structure to build up dot styles.
std::string awq(const std::string &attribute, const std::string &style)
Assign with quotes.
bool parameters
Show parameters.
static Config all()
Return a configuration that will generate every construct.
StyleBuilder & operator<<(const std::string &part)
Append a part to the style.
str port_to_sig
Style for port-to-signal.
DOT output configuration. Determines what Cerata constructs will be used for generation.
static Config streams()
Return a configuration that will generate onnly stream constructs.
str integer
Style for integers.
struct cerata::dot::Style::NodeGroup nodegroup
Style for group of nodes.
str record_border
Record border color.
std::vector< std::string > parts
str stream
Style for stream edges.
Contains everything related to the DOT back-end.
struct cerata::dot::Config::NodeConfig::TypeConfig types
Type configuration.
std::string GetLabel(const Node &n)
Get the label for a node.
bool operator()(const Node &node)
Return whether a node should be generated on the DOT graph.
bool record
Show record types.
struct cerata::dot::Style::NodeStyle node
Style for nodes.
struct cerata::dot::Config::NodeConfig::ExpandConfig expand
Configures what types of nodes to expand.
std::string gray
Gray color.
std::string lighter
Lighter gray color.
str record
Style for records.
str stream
Style for streams.
struct cerata::dot::Style::EdgeStyle edge
Style for edges.
bool expression
Expand expressions.
str base
Subgraph base style.
str sig_to_port
Style for signal-to-port.
bool stream
Show stream types.
std::vector< std::string > d
Dark.
std::string ToString()
Generate the style string.
bool vector
Show vector types.
Config config
Configuration of what types of constructs to show or hide for this style.
std::vector< std::string > b
Bright.
static std::string GenDotRecordCell(const Type &t, const std::string &name, int level=0)
Generate a DOT record cell from a type.
bool literals
Show literals.
str lit
Style for literal edges.
std::string black
Black color.
std::string sanitize(std::string in)
Sanitize a string for usage in DOT.
str boolean
Style for booleans.
str stream_border
Stream border color.
str vector
Style for vectors.
str expression
Style for expressions.
str signal
Style for signals.
static Palette normal()
Default palette.
std::string GenHTMLTableCell(const Type &t, const std::string &name, int level=0)
Generate a HTML table cell from a type.
str record_child
Record child color.
str string
Style for strings.
std::vector< std::string > m
Medium.
str stream
Colors for stream edges.
struct cerata::dot::Style::NodeStyle::Colors color
Colors for specific nodes.
int num_colors
Number of colors of this Palette.