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,
long value ) = 0;
64 virtual long getOut()
const = 0;
66 ElementID getId()
const;
68 virtual std::string getType()
const
73 virtual std::shared_ptr<Element> find(
const ElementID&
id );
75 virtual void addChildOut( std::shared_ptr<Element>& el,
size_t in_num );
76 virtual void delChildOut( std::shared_ptr<Element>& el );
77 size_t outCount()
const;
79 virtual void addInput(
size_t num,
long value = 0 );
80 virtual void delInput(
size_t num );
81 size_t inCount()
const;
83 friend std::ostream& operator<<(std::ostream& os,
const Element& el );
84 friend std::ostream& operator<<(std::ostream& os,
const std::shared_ptr<Element>& el );
87 Element(): myid(DefaultElementID) {};
91 ChildInfo(std::shared_ptr<Element> e,
size_t n):
95 std::shared_ptr<Element> el;
99 typedef std::list<ChildInfo> OutputList;
101 virtual void setChildOut();
105 InputInfo(): num(0), value(0), type(unknown) {}
106 InputInfo(
size_t n,
long v): num(n), value(v), type(unknown) {}
112 typedef std::list<InputInfo> InputList;
127 TOR( ElementID
id,
size_t numbers = 0,
bool outstate =
false );
130 virtual void setIn(
size_t num,
long value )
override;
131 virtual long getOut()
const override;
133 virtual std::string getType()
const override
139 TOR(): myout(
false) {}
151 TAND(ElementID
id,
size_t numbers = 0,
bool st =
false );
154 virtual void setIn(
size_t num,
long value )
override;
155 virtual std::string getType()
const override
173 TNOT( ElementID
id,
bool out_default );
176 virtual long getOut()
const override
178 return ( myout ? 1 : 0 );
182 virtual void setIn(
size_t num,
long value )
override ;
183 virtual std::string getType()
const override
187 virtual void addInput(
size_t num,
long value = 0 )
override {}
188 virtual void delInput(
size_t num )
override {}
191 TNOT(): myout(
false) {}
virtual void tick()
Definition: Element.h:61
Definition: Exceptions.h:46
Definition: Element.h:148
Definition: Element.h:170
virtual void setIn(size_t num, long value) override
Definition: TNOT.cc:39
Definition: Element.h:124
Definition: CommonEventLoop.h:15