 |
Cerata
A library to generate structural hardware designs
|
15 #include "cerata/dot/style.h"
20 #include "cerata/api.h"
41 ret.
edge.
param =
"style=dotted, arrowhead=none, arrowtail=none";
43 ret.
edge.
lit =
"style=dotted, arrowhead=none, arrowtail=none";
44 ret.
edge.
expr =
"style=dotted, arrowhead=none, arrowtail=none";
54 ret.
node.
base =
"style=filled, width=0, height=0, margin=0.025";
57 ret.
node.
signal =
"shape=ellipse, margin=-0.2";
76 std::stringstream str;
77 for (
const auto &p :
parts) {
80 if (p !=
parts.back()) {
89 parts.push_back(part);
161 ret.
black =
"#000000";
162 ret.
white =
"#ffffff";
163 ret.
gray =
"#A0A0A0";
164 ret.
dark =
"#808080";
166 ret.
light =
"#D0D0D0";
169 ret.
b = {
"#ff8181",
"#ffe081",
"#bfff81",
"#81ffd1",
"#81ceff",
"#9381ff",
"#f281ff"};
170 ret.
m = {
"#e85858",
"#e8c558",
"#9fe858",
"#58e8b3",
"#58b0e8",
"#6c58e8",
"#d958e8"};
171 ret.
d = {
"#c04040",
"#c0a140",
"#7fc040",
"#40c091",
"#408fc0",
"#5340c0",
"#b340c0"};
229 std::stringstream
str;
238 }
else if (n.IsParameter()) {
239 auto par =
dynamic_cast<const Parameter &
>(n);
241 auto val = par.value();
virtual bool IsNested() const =0
Return true if the Type is a nested, false otherwise.
struct cerata::dot::Style::NodeStyle::TypeStyle type
Styles for types.
bool signals
Show signals.
struct cerata::dot::Config::NodeConfig nodes
Node configuration.
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.
@ LITERAL
No-input AND multi-output node with storage type and storage value.
str stream_child
Stream child color.
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.
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.
bool Is(ID type_id) const
Return true if the Type ID is type_id, false otherwise.
static Config all()
Return a configuration that will generate every construct.
ID id() const
Return the Type ID.
StyleBuilder & operator<<(const std::string &part)
Append a part to the style.
@ PARAMETER
Single-input AND multi-output node with default value.
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.
NodeID node_id() const
Return the node type ID.
std::string name() const
Return the name of the object.
str record_border
Record border color.
std::vector< std::string > parts
@ EXPRESSION
No-input AND multi-output node that forms a binary tree with operations and nodes.
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.
@ SIGNAL
Single-input AND multi-output node.
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.
@ PORT
Single-input AND multi-output node with direction.
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.
Type * type() const
Return the node Type.
int num_colors
Number of colors of this Palette.