Added drain

This commit is contained in:
2021-07-13 12:16:45 +02:00
6 changed files with 69 additions and 56 deletions
+37 -33
View File
@@ -3,9 +3,10 @@
#include <typeindex>
#include <unordered_map>
#include <complex>
enum class TypeMap {
enum class TypeList {
VOID,
CHAR,
INT8,
@@ -19,47 +20,50 @@ enum class TypeMap {
FLOAT,
DOUBLE,
COMPLEX_FLOAT,
COMPLEX_DOUBLE
COMPLEX_DOUBLE,
};
struct Type{
struct DataType{
const size_t size;
const int value;
};
const std::unordered_map<std::type_index, TypeMap> TypeTable = {
{ typeid(void), {sizeof(void), TypeMap::VOID} },
{ typeid(char), {sizeof(char), TypeMap::CHAR} },
{ typeid(int8_t), {sizeof(int8_t), TypeMap::INT8} },
{ typeid(uint8_t), {sizeof(uint8_t), TypeMap::UINT8} },
{ typeid(int16_t), {sizeof(int16_t), TypeMap::INT16} },
{ typeid(uint16_t), {sizeof(uint16_t), TypeMap::UINT16} },
{ typeid(int32_t), {sizeof(int32_t), TypeMap::INT32} },
{ typeid(uint32_t), {sizeof(uint32_t), TypeMap::UINT32} },
{ typeid(int64_t), {sizeof(int64_t), TypeMap::INT64} },
{ typeid(uint64_t), {sizeof(uint64_t), TypeMap::UINT64} },
{ typeid(float), {sizeof(float), TypeMap::float} },
{ typeid(double), {sizeof(double), TypeMap::DOUBLE} },
{ typeid(std::complex<float>), {sizeof(std::complex<float>), TypeMap::COMPLEX_FLOAT} },
{ typeid(std::complex<double>), {sizeof(std::complex<double>), TypeMap::COMPLEX_DOUBLE} }
const std::unordered_map<std::type_index, DataType> TypeTable = {
{ typeid(void), {sizeof(char), (int)TypeList::VOID} },
{ typeid(char), {sizeof(char), (int)TypeList::CHAR} },
{ typeid(int8_t), {sizeof(int8_t), (int)TypeList::INT8} },
{ typeid(uint8_t), {sizeof(uint8_t), (int)TypeList::UINT8} },
{ typeid(int16_t), {sizeof(int16_t), (int)TypeList::INT16} },
{ typeid(uint16_t), {sizeof(uint16_t), (int)TypeList::UINT16} },
{ typeid(int32_t), {sizeof(int32_t), (int)TypeList::INT32} },
{ typeid(uint32_t), {sizeof(uint32_t), (int)TypeList::UINT32} },
{ typeid(int64_t), {sizeof(int64_t), (int)TypeList::INT64} },
{ typeid(uint64_t), {sizeof(uint64_t), (int)TypeList::UINT64} },
{ typeid(float), {sizeof(float), (int)TypeList::FLOAT} },
{ typeid(double), {sizeof(double), (int)TypeList::DOUBLE} },
{ typeid(std::complex<float>), {sizeof(std::complex<float>), (int)TypeList::COMPLEX_FLOAT} },
{ typeid(std::complex<double>), {sizeof(std::complex<double>), (int)TypeList::COMPLEX_DOUBLE} },
};
const std::unordered_map<int , Type> TypeTable = {
{ TypeMap::VOID, {sizeof(void), TypeMap::VOID} },
{ TypeMap::CHAR, {sizeof(char), TypeMap::CHAR} },
{ TypeMap::INT8, {sizeof(int8_t), TypeMap::INT8} },
{ TypeMap::UINT8, {sizeof(uint8_t), TypeMap::UINT8} },
{ TypeMap::INT16, {sizeof(int16_t), TypeMap::INT16} },
{ TypeMap::UINT16, {sizeof(uint16_t), TypeMap::UINT16} },
{ TypeMap::INT32, {sizeof(int32_t), TypeMap::INT32} },
{ TypeMap::UINT32, {sizeof(uint32_t), TypeMap::UINT32} },
{ TypeMap::INT64, {sizeof(int64_t), TypeMap::INT64} },
{ TypeMap::UINT64, {sizeof(uint64_t), TypeMap::UINT64} },
{ TypeMap::FLOAT, {sizeof(float), TypeMap::float} },
{ TypeMap::DOUBLE, {sizeof(double), TypeMap::DOUBLE} },
{ TypeMap::COMPLEX_FLOAT, {sizeof(std::complex<float>), TypeMap::COMPLEX_FLOAT} },
{ TypeMap::COMPLEX_DOUBLE, {sizeof(std::complex<double>), TypeMap::COMPLEX_DOUBLE} }
const std::unordered_map<int , DataType> TypeMap = {
{ (int)TypeList::VOID, {sizeof(char), (int)TypeList::VOID} },
{ (int)TypeList::CHAR, {sizeof(char), (int)TypeList::CHAR} },
{ (int)TypeList::INT8, {sizeof(int8_t), (int)TypeList::INT8} },
{ (int)TypeList::UINT8, {sizeof(uint8_t), (int)TypeList::UINT8} },
{ (int)TypeList::INT16, {sizeof(int16_t), (int)TypeList::INT16} },
{ (int)TypeList::UINT16, {sizeof(uint16_t), (int)TypeList::UINT16} },
{ (int)TypeList::INT32, {sizeof(int32_t), (int)TypeList::INT32} },
{ (int)TypeList::UINT32, {sizeof(uint32_t), (int)TypeList::UINT32} },
{ (int)TypeList::INT64, {sizeof(int64_t), (int)TypeList::INT64} },
{ (int)TypeList::UINT64, {sizeof(uint64_t), (int)TypeList::UINT64} },
{ (int)TypeList::FLOAT, {sizeof(float), (int)TypeList::FLOAT} },
{ (int)TypeList::DOUBLE, {sizeof(double), (int)TypeList::DOUBLE} },
{ (int)TypeList::COMPLEX_FLOAT, {sizeof(std::complex<float>), (int)TypeList::COMPLEX_FLOAT} },
{ (int)TypeList::COMPLEX_DOUBLE, {sizeof(std::complex<double>), (int)TypeList::COMPLEX_DOUBLE} },
};
#endif // SF_DAQ_BUFFER_TYPEMAP_HPP
+1 -1
View File
@@ -38,7 +38,7 @@ struct ImageMetadata {
uint64_t user_1; // extra field for custom needs
uint64_t user_2; // extra field for custom needs
}
};
#pragma pack(pop)
struct ModuleFrameBuffer {