-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatastore.h
48 lines (38 loc) · 1.04 KB
/
datastore.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef DATASTORE_H
#define DATASTORE_H
#include <string>
#include <set>
#include <vector>
#include "product.h"
#include "user.h"
/**
* DataStore Interface needed for parsing and instantiating products and users
*
* A derived version of the DataStore can provide other services as well but
* must support those below
*
* DO NOT EDIT
*/
class DataStore {
public:
virtual ~DataStore() { }
/**
* Adds a product to the data store
*/
virtual void addProduct(Product* p) = 0;
/**
* Adds a user to the data store
*/
virtual void addUser(User* u) = 0;
/**
* Performs a search of products whose keywords match the given "terms"
* type 0 = AND search (intersection of results for each term) while
* type 1 = OR search (union of results for each term)
*/
virtual std::vector<Product*> search(std::vector<std::string>& terms, int type) = 0;
/**
* Reproduce the database file from the current Products and User values
*/
virtual void dump(std::ostream& ofile) = 0;
};
#endif