24 #ifndef _OPENCOG_LINK_H
25 #define _OPENCOG_LINK_H
29 #include <opencog/util/oc_assert.h>
39 typedef unsigned short Arity;
59 { OC_ASSERT(
false,
"Link: bad use of copy ctor"); }
174 throw RuntimeException(TRACE_INFO,
"invalid outgoing set index %d", pos);
186 if ((data->*cb)(out_h))
return true;
196 std::string
toString(std::string indent =
"");
226 bool isSource(
size_t) const throw (IndexErrorException, InvalidParamException);
246 bool isTarget(
size_t) const throw (IndexErrorException, InvalidParamException);
253 virtual
bool operator==(const
Atom&) const;
260 virtual
bool operator!=(const
Atom&) const;
266 {
return std::dynamic_pointer_cast<
Link>(
a); }
269 #define createLink std::make_shared<Link>
274 #endif // _OPENCOG_LINK_H
const HandleSeq & getOutgoingSet() const
AttentionValuePtr getAttentionValue()
std::string toShortString(std::string indent="")
std::vector< Handle > HandleSeq
a list of handles
std::shared_ptr< Atom > AtomPtr
std::shared_ptr< TruthValue > TruthValuePtr
std::shared_ptr< AttentionValue > AttentionValuePtr
std::shared_ptr< Link > LinkPtr
Link(Type t, const HandleSeq &oset, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
Handle getOutgoingAtom(Arity pos) const
Link(Type t, const Handle &ha, const Handle &hb, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
bool isTarget(Handle) const
void init(const HandleSeq &)
Link(Type t, const Handle &ha, const Handle &hb, const Handle &hc, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
std::string toString(std::string indent="")
bool isSource(Handle) const
Link(Type t, const Handle &h, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
static TruthValuePtr DEFAULT_TV()
static LinkPtr LinkCast(const Handle &h)
static AttentionValuePtr DEFAULT_AV()
to be used as default attention value
TruthValuePtr getTruthValue()
unsigned short Type
type of Atoms, represented as short integer (16 bits)
bool foreach_outgoing(bool(T::*cb)(const Handle &), T *data)
unsigned short Arity
arity of Links, represented as short integer (16 bits)
Link(Type t, const Handle &ha, const Handle &hb, const Handle &hc, const Handle &hd, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())