summary refs log tree commit diff
path: root/rtc/src/mongoStub.hpp
blob: 2809142f72dc26a55cba182117ba1176404df052 (plain) (blame)
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
#ifndef MONGOSTUB_HPP
#define MONGOSTUB_HPP

#include <boost/utility.hpp>
#include <cstdint>
#include <iostream>
#include <vector>
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
#include <mongocxx/change_stream.hpp>
#include <bsoncxx/json.hpp>
#include <bsoncxx/document/element.hpp>


class mongoStub{
	public:
		mongoStub();

		struct mongoMessage{
			std::string eventName;
			std::vector<std::string> data;
		};

		std::vector<mongoMessage> getNewMessages(mongocxx::change_stream* colCs);

		mongocxx::collection getCol() const { return col; }

		
		
	private:
		mongocxx::instance instance;
		mongocxx::client client{mongocxx::uri{}};
		mongocxx::database db;
		mongocxx::collection col;
		mongocxx::change_stream* colCs = nullptr;

		void handleUdpRequest(std::string address, int port, std::string mode);
		void handleVoiceRequest();
};

#endif