1 #ifndef TTG_BASE_TERMINAL_H
2 #define TTG_BASE_TERMINAL_H
27 std::string name =
"";
28 bool connected =
false;
30 std::string key_type_str;
31 std::string value_type_str;
33 std::vector<TerminalBase *> successors_;
34 std::vector<TerminalBase *> predecessors_;
40 template <
typename keyT,
typename valueT>
42 template <
typename keyT,
typename valueT>
48 void set(
TTBase *tt,
size_t index,
const std::string &name,
const std::string &key_type_str,
49 const std::string &value_type_str,
Type type) {
53 this->key_type_str = key_type_str;
54 this->value_type_str = value_type_str;
61 successors_.push_back(successor);
63 successor->connected =
true;
67 predecessors_.push_back(predecessor);
68 predecessor->connected =
true;
75 if (!tt)
throw "ttg::TerminalBase:get_tt() but tt is null";
81 if (!tt)
throw "ttg::TerminalBase:get_index() but tt is null";
87 if (!tt)
throw "ttg::TerminalBase:get_name() but tt is null";
93 if (!tt)
throw "ttg::TerminalBase:get_key_type_str() but tt is null";
99 if (!tt)
throw "ttg::TerminalBase:get_value_type_str() but tt is null";
100 return value_type_str;
130 template <
typename T,
typename =
void>
132 template <
typename T>
133 inline constexpr
bool is_terminal_v<T, std::is_base_of<TerminalBase, T>> =
true;
134 template <
typename T>
A base class for all template tasks.
static constexpr bool is_a_terminal
bool is_connected() const
Returns true if this terminal (input or output) is connected.
TTBase * get_tt() const
Return ptr to containing tt.
const std::string & get_value_type_str() const
Returns string representation of value type.
const std::vector< TerminalBase * > & get_predecessors() const
const std::string & get_key_type_str() const
Returns string representation of key type.
size_t get_index() const
Returns index of terminal.
virtual void connect(TerminalBase *in)=0
void connect_base(TerminalBase *successor)
Type get_type() const
Returns the terminal type.
void connect_pull_nopred(TerminalBase *p)
void set(TTBase *tt, size_t index, const std::string &name, const std::string &key_type_str, const std::string &value_type_str, Type type)
virtual ~TerminalBase()=default
const std::string & get_name() const
Returns name of terminal.
const std::vector< TerminalBase * > & get_connections() const
Get connections to successors.
void connect_pull(TerminalBase *predecessor)
Type
describes the terminal type
@ Write
can only be written to
@ Read
can only be used to read immutable data
@ Consume
can only be used to read consumable data
top-level TTG namespace contains runtime-neutral functionality