Buran Motion Planning Framework
base_client.h
1 #pragma once
2 
3 #include <vector>
4 
5 #include <arpa/inet.h>
6 #include <cstdio>
7 #include "iostream"
8 #include "base_client.h"
9 #include <cstring>
10 #include <sys/socket.h>
11 #include <unistd.h>
12 #include <chrono>
13 #include <thread>
14 #include <json/value.h>
15 #include <json/writer.h>
16 #include <json/reader.h>
17 
18 
23 class BaseClient {
24 public:
25 
30  explicit BaseClient(const char *savePath) {
31  _savePath = savePath;
32  }
33 
37  virtual void mainLoop() = 0;
38 
45  virtual void init(int port, const char *addr, int delay);
46 
51  int getClientFd() const { return clientFD; }
52 
53 protected:
57  std::string _commandBuf;
61  int clientFD{};
65  const char *_savePath;
69  const char *_addr{};
73  int _delay{};
77  int _port{};
78 };
BaseClient::clientFD
int clientFD
Definition: base_client.h:61
BaseClient::BaseClient
BaseClient(const char *savePath)
Definition: base_client.h:30
BaseClient::_addr
const char * _addr
Definition: base_client.h:69
BaseClient::_savePath
const char * _savePath
Definition: base_client.h:65
BaseClient::init
virtual void init(int port, const char *addr, int delay)
Definition: base_client.cpp:14
BaseClient
Базовый класс для всех клиентов необходимо реализовать метод mainLoop()
Definition: base_client.h:23
BaseClient::mainLoop
virtual void mainLoop()=0
BaseClient::_commandBuf
std::string _commandBuf
Definition: base_client.h:57
BaseClient::_port
int _port
Definition: base_client.h:77
BaseClient::getClientFd
int getClientFd() const
Definition: base_client.h:51
BaseClient::_delay
int _delay
Definition: base_client.h:73