-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdb_instance.h
More file actions
58 lines (43 loc) · 1.29 KB
/
db_instance.h
File metadata and controls
58 lines (43 loc) · 1.29 KB
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
49
50
51
52
53
54
55
56
57
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: db_instance.h
* Author: reat
*
* Created on August 12, 2017, 3:38 PM
*/
#ifndef DB_INSTANCE_H
#define DB_INSTANCE_H
#include <memory>
#include "in_memory_storage.h"
#include "multi_index.h"
#include "simple_index.h"
#include "structures.h"
class DBInstance {
public:
static DBInstance* GetDbInstance();
void InitializeUsers();
void InitializeLocations();
void InitializeVisits();
InMemoryStorage<User>* GetUsers();
InMemoryStorage<Location>* GetLocations();
InMemoryStorage<Visit>* GetVisits();
MultiIndex<Visit>* GetUsersVisitsIndex();
MultiIndex<Visit>* GetLocationsVisitsIndex();
SimpleIndex<std::string>* GetEmailIndex();
private:
static std::unique_ptr<DBInstance> instance_;
InMemoryStorage<User> users_storage_;
InMemoryStorage<Location> locations_storage_;
InMemoryStorage<Visit> visits_storage_;
MultiIndex<Visit> users_visits_index_;
MultiIndex<Visit> locations_visits_index_;
SimpleIndex<std::string> email_index_;
DBInstance();
DBInstance(const DBInstance& orig) = delete;
DBInstance& operator=(const DBInstance) = delete;
};
#endif /* DB_INSTANCE_H */