summary refs log tree commit diff stats
path: root/lib/group.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-01-16 18:02:50 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-01-16 18:02:50 -0500
commit6746da6edd7d9d50efe374eabbb79a3cac882d81 (patch)
treeff20917e08b08d36b9541c1371106596e7bec442 /lib/group.h
parent4af7e55733098ca42f75a4ffaca1b0f6bab4dd36 (diff)
downloadverbly-6746da6edd7d9d50efe374eabbb79a3cac882d81.tar.gz
verbly-6746da6edd7d9d50efe374eabbb79a3cac882d81.tar.bz2
verbly-6746da6edd7d9d50efe374eabbb79a3cac882d81.zip
Started structural rewrite
The new object structure was designed to build on the existing WordNet
structure, while also adding in all of the data that we get from other sources.
More information about this can be found on the project wiki.

The generator has already been completely rewritten to generate a
datafile that uses the new structure. In addition, a number of indexes
are created, which does double the size of the datafile, but also allows
for much faster lookups. Finally, the new generator is written modularly
and is a lot more readable than the old one.

The verbly interface to the new object structure has mostly been
completed, but has not been tested fully. There is a completely new
search API which utilizes a lot of operator overloading; documentation
on how to use it should go up at some point.

Token processing and verb frames are currently unimplemented. Source for
these have been left in the repository for now.
Diffstat (limited to 'lib/group.h')
-rw-r--r--lib/group.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/lib/group.h b/lib/group.h new file mode 100644 index 0000000..dd53503 --- /dev/null +++ b/lib/group.h
@@ -0,0 +1,87 @@
1#ifndef GROUP_H_BD6933C0
2#define GROUP_H_BD6933C0
3
4#include <stdexcept>
5#include <list>
6#include <vector>
7#include "field.h"
8#include "filter.h"
9
10struct sqlite3_stmt;
11
12namespace verbly {
13
14 class database;
15 class frame;
16
17 class group {
18 public:
19
20 // Default constructor
21
22 group() = default;
23
24 // Construct from database
25
26 group(const database& db, sqlite3_stmt* row);
27
28 // Accessors
29
30 operator bool() const
31 {
32 return valid_;
33 }
34
35 int getId() const
36 {
37 if (!valid_)
38 {
39 throw std::domain_error("Bad access to uninitialized group");
40 }
41
42 return id_;
43 }
44
45 const std::vector<frame>& getFrames() const;
46
47 // Type info
48
49 static const object objectType;
50
51 static const std::list<std::string> select;
52
53 // Query fields
54
55 static const field id;
56
57 operator filter() const
58 {
59 if (!valid_)
60 {
61 throw std::domain_error("Bad access to uninitialized group");
62 }
63
64 return (id == id_);
65 }
66
67 // Relationships to other objects
68
69 static const field frame;
70
71 static const field word;
72
73 private:
74 bool valid_ = false;
75
76 int id_;
77
78 const database* db_;
79
80 mutable bool initializedFrames_ = false;
81 mutable std::vector<class frame> frames_;
82
83 };
84
85};
86
87#endif /* end of include guard: GROUP_H_BD6933C0 */