OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DefineLink.h
Go to the documentation of this file.
1 /*
2  * opencog/atoms/DefineLink.h
3  *
4  * Copyright (C) 2015 Linas Vepstas
5  * All Rights Reserved
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License v3 as
9  * published by the Free Software Foundation and including the exceptions
10  * at http://opencog.org/wiki/Licenses
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program; if not, write to:
19  * Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #ifndef _OPENCOG_DEFINE_LINK_H
24 #define _OPENCOG_DEFINE_LINK_H
25 
26 #include <map>
27 
29 #include <opencog/atomspace/Link.h>
30 
31 namespace opencog
32 {
41 class DefineLink : public Link
67 {
68 protected:
69  // Reference to the definition body (typically a node)
71  // Definition body that this link is defining.
73 
74  void init(const HandleSeq&);
75 public:
76  DefineLink(const HandleSeq&,
79 
80  DefineLink(const Handle& varcdecls, const Handle& body,
83 
84  DefineLink(Link &l);
85  Handle get_alias(void) { return _alias; }
86  Handle get_definition(void) { return _definition; }
87 
97  static Handle get_definition(const Handle& alias);
98 };
99 
100 typedef std::shared_ptr<DefineLink> DefineLinkPtr;
101 static inline DefineLinkPtr DefineLinkCast(const Handle& h)
102  { AtomPtr a(h); return std::dynamic_pointer_cast<DefineLink>(a); }
104  { return std::dynamic_pointer_cast<DefineLink>(a); }
105 
106 // XXX temporary hack ...
107 #define createDefineLink std::make_shared<DefineLink>
108 
110 }
111 
112 #endif // _OPENCOG_DEFINE_LINK_H
static DefineLinkPtr DefineLinkCast(const Handle &h)
Definition: DefineLink.h:101
std::vector< Handle > HandleSeq
a list of handles
Definition: Handle.h:246
std::shared_ptr< Atom > AtomPtr
Definition: Handle.h:48
std::shared_ptr< DefineLink > DefineLinkPtr
Definition: DefineLink.h:100
std::shared_ptr< TruthValue > TruthValuePtr
Definition: TruthValue.h:85
std::shared_ptr< AttentionValue > AttentionValuePtr
static TruthValuePtr DEFAULT_TV()
Definition: TruthValue.cc:52
static AttentionValuePtr DEFAULT_AV()
to be used as default attention value