25 #ifndef _OPENCOG_HANDLE_H
26 #define _OPENCOG_HANDLE_H
36 #include <unordered_set>
46 typedef unsigned long UUID;
49 typedef std::shared_ptr<Atom>
AtomPtr;
98 if (a != NULL and a != this->
_ptr.get())
112 if (ULONG_MAX ==
_uuid)
return NULL;
119 if (ULONG_MAX ==
_uuid)
return NULL;
124 explicit inline operator bool() const noexcept {
125 if (
_ptr.get())
return true;
130 if (
_ptr.get())
return false;
135 if (
_ptr.get())
return true;
170 if (h1 < h2)
return -1;
171 if (h1 > h2)
return 1;
196 {
return rhs == NULL; }
199 {
return rhs != NULL; }
214 {
return this->
test(a,b); }
225 return static_cast<std::size_t
>(h.
value());
232 return static_cast<std::size_t
>(h.
value());
256 size_t sl = hsl.size();
257 size_t sr = hsr.size();
258 if (sl != sr)
return sl < sr;
259 for (
size_t i=0; i<sl; i++) {
260 UUID ul = hsl[i].value();
261 UUID ur = hsr[i].value();
262 if (ul != ur)
return ul < ur;
271 std::string rhs = lhs;
273 snprintf(buff, 24,
"%lu)", h.
value());
281 snprintf(buff, 24,
"%lu)", h.
value());
294 #ifdef THIS_USED_TO_WORK_GREAT_BUT_IS_BROKEN_IN_GCC472
307 return static_cast<std::size_t
>(h.
value());
314 struct hash<opencog::Handle>
320 {
return static_cast<std::size_t
>(h.
value()); }
323 #endif // THIS_USED_TO_WORK_GREAT_BUT_IS_BROKEN_IN_GCC472
328 #endif // _OPENCOG_HANDLE_H
bool operator()(const AtomPtr &a, const AtomPtr &b) const
bool operator==(const Handle &h) const noexcept
static AtomPtr do_res(const Handle *)
bool operator()(const Handle &h) const
static std::vector< const AtomTable * > _resolver
bool operator()(const HandleSeq &hsl, const HandleSeq &hsr) const
bool operator!=(const Handle &h) const noexcept
std::vector< Handle > HandleSeq
a list of handles
static bool operator==(std::nullptr_t, const Handle &rhs) noexcept
std::shared_ptr< Atom > AtomPtr
bool operator()(const AtomPtr &a) const
Atom * operator->() const
virtual bool test(const Handle &) const =0
virtual bool test(const AtomPtr &) const =0
std::vector< HandleSeq > HandleSeqSeq
a list of lists of handles
Handle & operator=(const Handle &h)
static const Handle UNDEFINED
bool operator>=(const Handle &h) const noexcept
bool operator>(const Handle &h) const noexcept
unsigned long UUID
UUID == Universally Unique Identifier.
bool operator==(std::nullptr_t) const noexcept
bool operator<(const Handle &h) const noexcept
size_t operator()(const Handle &h) const
ostream & operator<<(ostream &out, const opencog::AtomSpace &as)
virtual bool test(const AtomPtr &, const AtomPtr &) const =0
static bool operator!=(std::nullptr_t, const Handle &rhs) noexcept
static void set_resolver(const AtomTable *)
static std::string operator+(const char *lhs, Handle h)
append string representation of the Hash to the string
std::unordered_set< Handle, handle_hash > UnorderedHandleSet
a hash that associates the handle to its unique identificator
static void clear_resolver(const AtomTable *)
bool operator<=(const Handle &h) const noexcept
bool operator!=(std::nullptr_t) const noexcept
std::size_t hash_value(Handle const &h)
Boost needs this function to be called by exactly this name.
bool operator()(const Handle &hl, const Handle &hr) const
opencog::Handle argument_type
std::size_t operator()(opencog::Handle h) const noexcept
static int compare(const Handle &h1, const Handle &h2)
static const AtomPtr NULL_POINTER