receive handler
This commit is contained in:
parent
1ec3b6c4f0
commit
8607e4b370
5 changed files with 51 additions and 37 deletions
40
src/Types.h
40
src/Types.h
|
|
@ -8,37 +8,39 @@
|
|||
#ifndef TYPES_H_
|
||||
#define TYPES_H_
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
template <typename T>
|
||||
std::vector<T> operator+(const std::vector<T> &A, const std::vector<T> &B)
|
||||
{
|
||||
std::vector<T> AB;
|
||||
AB.reserve( A.size() + B.size() ); // preallocate memory
|
||||
AB.insert( AB.end(), A.begin(), A.end() ); // add A;
|
||||
AB.insert( AB.end(), B.begin(), B.end() ); // add B;
|
||||
return AB;
|
||||
template<typename T>
|
||||
std::vector<T> operator+(const std::vector<T> &A, const std::vector<T> &B) {
|
||||
std::vector<T> AB;
|
||||
AB.reserve(A.size() + B.size()); // preallocate memory
|
||||
AB.insert(AB.end(), A.begin(), A.end()); // add A;
|
||||
AB.insert(AB.end(), B.begin(), B.end()); // add B;
|
||||
return AB;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::vector<T> &operator+=(std::vector<T> &A, const std::vector<T> &B)
|
||||
{
|
||||
A.reserve( A.size() + B.size() ); // preallocate memory without erase original data
|
||||
A.insert( A.end(), B.begin(), B.end() ); // add B;
|
||||
return A; // here A could be named AB
|
||||
template<typename T>
|
||||
std::vector<T> &operator+=(std::vector<T> &A, const std::vector<T> &B) {
|
||||
A.reserve(A.size() + B.size());
|
||||
A.insert(A.end(), B.begin(), B.end());
|
||||
return A;
|
||||
}
|
||||
|
||||
typedef std::vector<unsigned char> bytes;
|
||||
typedef unsigned char byte;
|
||||
|
||||
struct dataset{
|
||||
short type;
|
||||
short len;
|
||||
bytes value;
|
||||
struct dataset {
|
||||
short type;
|
||||
short len;
|
||||
bytes value;
|
||||
};
|
||||
|
||||
//typedef std::vector<dataset> datasets;
|
||||
typedef std::map<short,dataset> datasets;
|
||||
typedef std::map<short, dataset> datasets;
|
||||
|
||||
//std::function<int()>;
|
||||
//typedef int receiveCallback;
|
||||
|
||||
#endif /* TYPES_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue