OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BackingStore.h
Go to the documentation of this file.
1 /*
2  * opencog/atomspace/BackingStore.h
3  *
4  * Implements an interface class for storage providers.
5  *
6  * Copyright (C) 2009, 2013 Linas Vepstas <linasvepstas@gmail.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Affero General Public License v3 as
10  * published by the Free Software Foundation and including the exceptions
11  * at http://opencog.org/wiki/Licenses
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with this program; if not, write to:
20  * Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #ifndef _OPENCOG_BACKING_STORE_H
25 #define _OPENCOG_BACKING_STORE_H
26 
27 #include <set>
28 
29 #include <opencog/atomspace/Atom.h>
30 #include <opencog/atomspace/Link.h>
31 #include <opencog/atomspace/Node.h>
32 
33 namespace opencog
34 {
47 {
48  public:
49  virtual ~BackingStore() {}
50 
55  virtual LinkPtr getLink(Type, const HandleSeq&) const = 0;
56 
61  virtual NodePtr getNode(Type, const char *) const = 0;
62 
67  virtual AtomPtr getAtom(Handle) const = 0;
68 
73  virtual HandleSeq getIncomingSet(Handle) const = 0;
74 
80  virtual void storeAtom(Handle) = 0;
81 
88  virtual void loadType(AtomTable&, Type) = 0;
89 
97  virtual void barrier() = 0;
98 
105  virtual bool ignoreType(Type t) const {
106  return (_ignored_types.end() != _ignored_types.find(t));
107  }
108 
114  virtual bool ignoreAtom(Handle) const;
115 
119  std::set<Type> _ignored_types;
120 };
121 
123 } //namespace opencog
124 
125 #endif // _OPENCOG_BACKING_STORE_H
virtual void loadType(AtomTable &, Type)=0
std::vector< Handle > HandleSeq
a list of handles
Definition: Handle.h:246
std::shared_ptr< Atom > AtomPtr
Definition: Handle.h:48
virtual LinkPtr getLink(Type, const HandleSeq &) const =0
std::shared_ptr< Link > LinkPtr
Definition: Atom.h:53
virtual bool ignoreType(Type t) const
Definition: BackingStore.h:105
virtual HandleSeq getIncomingSet(Handle) const =0
std::shared_ptr< Node > NodePtr
Definition: Node.h:112
virtual AtomPtr getAtom(Handle) const =0
virtual void barrier()=0
virtual bool ignoreAtom(Handle) const
Definition: BackingStore.cc:30
unsigned short Type
type of Atoms, represented as short integer (16 bits)
Definition: types.h:40
std::set< Type > _ignored_types
Definition: BackingStore.h:119
virtual NodePtr getNode(Type, const char *) const =0
virtual void storeAtom(Handle)=0