24 #include "Exceptions.h"
43 typedef std::string ElementID;
44 static const ElementID DefaultElementID;
53 explicit Element(
const ElementID&
id ): myid(
id) {};
63 virtual void setIn(
size_t num,
bool state ) = 0;
64 virtual bool getOut()
const = 0;
66 inline ElementID getId()
const
70 virtual std::string getType()
const
75 virtual std::shared_ptr<Element> find(
const ElementID&
id );
77 virtual void addChildOut( std::shared_ptr<Element> el,
size_t in_num );
78 virtual void delChildOut( std::shared_ptr<Element> el );
79 inline size_t outCount()
const
84 virtual void addInput(
size_t num,
bool state =
false );
85 virtual void delInput(
size_t num );
86 inline size_t inCount()
const
91 friend std::ostream& operator<<(std::ostream& os, Element& el )
93 return os <<
"[" << el.getType() <<
"]" << el.getId();
96 friend std::ostream& operator<<(std::ostream& os, std::shared_ptr<Element> el )
99 return os << (*(el.get()));
105 Element(): myid(DefaultElementID) {};
109 ChildInfo(std::shared_ptr<Element> e,
size_t n):
113 std::shared_ptr<Element> el;
117 typedef std::list<ChildInfo> OutputList;
119 virtual void setChildOut();
123 InputInfo(): num(0), state(
false), type(unknown) {}
124 InputInfo(
size_t n,
bool s): num(n), state(s), type(unknown) {}
130 typedef std::list<InputInfo> InputList;
145 TOR( ElementID
id,
size_t numbers = 0,
bool st =
false );
148 virtual void setIn(
size_t num,
bool state )
override;
149 virtual bool getOut()
const override
154 virtual std::string getType()
const override
160 TOR(): myout(
false) {}
172 TAND(ElementID
id,
size_t numbers = 0,
bool st =
false );
175 virtual void setIn(
size_t num,
bool state )
override;
176 virtual std::string getType()
const override
194 TNOT( ElementID
id,
bool out_default );
197 virtual bool getOut()
const override
204 virtual void setIn(
size_t num,
bool state )
override ;
205 virtual std::string getType()
const override
209 virtual void addInput(
size_t num,
bool state =
false )
override {}
210 virtual void delInput(
size_t num )
override {}
213 TNOT(): myout(
false) {}