mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
добавил очередь отправки файлов в сокеты
This commit is contained in:
42
include/queue/QueueFromChar.h
Normal file
42
include/queue/QueueFromChar.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#include "Global.h"
|
||||
#ifdef QUEUE_FROM_CHAR
|
||||
|
||||
#define MAX_COMMAND_LENGTH 16
|
||||
#define BUFFER 128
|
||||
|
||||
class QueueFromChar;
|
||||
|
||||
class QueueFromChar {
|
||||
public:
|
||||
QueueFromChar();
|
||||
~QueueFromChar();
|
||||
|
||||
void addCommand(const char* command);
|
||||
|
||||
void printCommands();
|
||||
|
||||
String getLastCommand();
|
||||
|
||||
private:
|
||||
struct CharBufferStruct {
|
||||
char command[MAX_COMMAND_LENGTH + 1];
|
||||
};
|
||||
CharBufferStruct* commandList;
|
||||
int commandCount = 0;
|
||||
};
|
||||
|
||||
// extern QueueFromChar* myBuf;
|
||||
|
||||
//========проверка очереди=====================
|
||||
// myBuf = new QueueFromChar;
|
||||
// myBuf->addCommand("zero");
|
||||
// myBuf->addCommand("one");
|
||||
// myBuf->addCommand("two");
|
||||
// myBuf->printCommands();
|
||||
// myBuf->getLastCommand();
|
||||
// myBuf->getLastCommand();
|
||||
// myBuf->getLastCommand();
|
||||
// myBuf->printCommands();
|
||||
|
||||
#endif
|
||||
26
include/queue/QueueFromInstance.h
Normal file
26
include/queue/QueueFromInstance.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include "Global.h"
|
||||
#ifdef QUEUE_FROM_INST
|
||||
#include "classes/QueueInst.h"
|
||||
#include <queue>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class QueueFromInstance;
|
||||
|
||||
class QueueFromInstance {
|
||||
public:
|
||||
QueueFromInstance();
|
||||
~QueueFromInstance();
|
||||
|
||||
void push(QueueInstance instance);
|
||||
void pop();
|
||||
QueueInstance front();
|
||||
|
||||
private:
|
||||
queue<QueueInstance> queue1;
|
||||
};
|
||||
|
||||
// extern QueueFromInstance* myQueue;
|
||||
#endif
|
||||
19
include/queue/QueueInst.h
Normal file
19
include/queue/QueueInst.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include "Global.h"
|
||||
#include <queue>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class QueueInstance;
|
||||
|
||||
class QueueInstance {
|
||||
public:
|
||||
QueueInstance(String text);
|
||||
~QueueInstance();
|
||||
|
||||
String get();
|
||||
|
||||
private:
|
||||
String _text;
|
||||
};
|
||||
Reference in New Issue
Block a user