-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommunication.h
54 lines (43 loc) · 1.5 KB
/
communication.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
49
50
51
52
53
54
#pragma once
#include <string>
#include "common.h"
class Communication
{
public:
Communication(const std::string& rConnectionName, const bool IsConnectionMaster)
: mConnectionName(rConnectionName), mIsConnectionMaster(IsConnectionMaster) { }
virtual ~Communication() { }
void Connect()
{
// TODO add timings (or other things) if required
ConnectDetail();
}
void Disconnect()
{
// TODO add timings (or other things) if required
DisconnectDetail();
}
void Send(const std::size_t SendSize, const std::size_t SendDataId)
{
// std::vector<double> abc(SendSize, 1.447); // save this otherwise allocation takes too long
// or do the loop in here
// SendDetail(abc);
}
void Receive(const std::size_t SendSize, const std::size_t SendDataId)
{
}
protected:
std::string GetConnectionName() const {return mConnectionName;}
bool GetIsConnectionMaster() const {return mIsConnectionMaster;}
bool GetPrintTiming() const {return mPrintTiming;}
private:
std::string mConnectionName;
bool mIsConnectionMaster = false;
bool mPrintTiming = false;
virtual void ConnectDetail() = 0;
virtual void DisconnectDetail() = 0;
virtual void SendDetail(const std::vector<int>& rData) = 0;
virtual void SendDetail(const std::vector<double>& rData) = 0;
virtual void ReceiveDetail(std::vector<int>& rData) = 0;
virtual void ReceiveDetail(std::vector<double>& rData) = 0;
};