Skip to content

Commit fe31d61

Browse files
committed
Moved to new type determination methodology.
1 parent 67acaac commit fe31d61

File tree

2 files changed

+4
-118
lines changed

2 files changed

+4
-118
lines changed

src/Flux/flxCoreParam.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,7 @@ class flxParameterOutArrayType : public flxParameterOutArray
597597
// return our data type
598598
flxDataType_t type()
599599
{
600-
T c;
601-
return flxDataTyper::type(c);
600+
return flxGetTypeOf<T>();
602601
};
603602

604603
//---------------------------------------------------------------------------------

src/Flux/flxCoreTypes.h

Lines changed: 3 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -200,21 +200,6 @@ class flxDescriptor
200200
bool _titleAlloc;
201201
};
202202

203-
// typedef enum
204-
// {
205-
// flxTypeNone = 0,
206-
// flxTypeBool,
207-
// flxTypeInt8,
208-
// flxTypeInt16,
209-
// flxTypeInt32,
210-
// flxTypeUInt8,
211-
// flxTypeUInt16,
212-
// flxTypeUInt32,
213-
// flxTypeFloat,
214-
// flxTypeDouble,
215-
// flxTypeString
216-
// } flxDataType_t;
217-
218203
// The number used for the datatype codes is based on the sizeof() value and other attributes determined at compile
219204
// time. This is something picked up from the NVS system of esp32 - solid hack.
220205
enum flxDataType_t : std::uint8_t
@@ -473,101 +458,6 @@ class flxDataVariable
473458
};
474459
};
475460

476-
class flxDataTyper
477-
{
478-
public:
479-
// some method overloading to determine types
480-
static flxDataType_t type(std::nullptr_t *t)
481-
{
482-
return flxTypeNone;
483-
};
484-
static flxDataType_t type(bool *t)
485-
{
486-
return flxTypeBool;
487-
};
488-
static flxDataType_t type(int8_t *t)
489-
{
490-
return flxTypeInt8;
491-
};
492-
static flxDataType_t type(int16_t *t)
493-
{
494-
return flxTypeInt16;
495-
};
496-
static flxDataType_t type(int32_t *t)
497-
{
498-
return flxTypeInt32;
499-
};
500-
static flxDataType_t type(uint8_t *t)
501-
{
502-
return flxTypeUInt8;
503-
};
504-
static flxDataType_t type(uint16_t *t)
505-
{
506-
return flxTypeUInt16;
507-
};
508-
static flxDataType_t type(uint32_t *t)
509-
{
510-
return flxTypeUInt32;
511-
};
512-
static flxDataType_t type(float *t)
513-
{
514-
return flxTypeFloat;
515-
};
516-
static flxDataType_t type(double *t)
517-
{
518-
return flxTypeDouble;
519-
};
520-
static flxDataType_t type(std::string *t)
521-
{
522-
return flxTypeString;
523-
};
524-
static flxDataType_t type(char *t)
525-
{
526-
return flxTypeString;
527-
};
528-
529-
// non pointer
530-
static flxDataType_t type(bool &t)
531-
{
532-
return type(&t);
533-
};
534-
static flxDataType_t type(int8_t &t)
535-
{
536-
return type(&t);
537-
};
538-
static flxDataType_t type(int16_t &t)
539-
{
540-
return type(&t);
541-
};
542-
static flxDataType_t type(int32_t &t)
543-
{
544-
return type(&t);
545-
};
546-
static flxDataType_t type(uint8_t &t)
547-
{
548-
return type(&t);
549-
};
550-
static flxDataType_t type(uint16_t &t)
551-
{
552-
return type(&t);
553-
};
554-
static flxDataType_t type(uint32_t &t)
555-
{
556-
return type(&t);
557-
};
558-
static flxDataType_t type(float &t)
559-
{
560-
return type(&t);
561-
};
562-
static flxDataType_t type(double &t)
563-
{
564-
return type(&t);
565-
};
566-
static flxDataType_t type(std::string &t)
567-
{
568-
return type(&t);
569-
};
570-
};
571461
const char *flxGetTypeName(flxDataType_t type);
572462

573463
//----------------------------------------------------------------------------------------
@@ -666,8 +556,7 @@ template <typename T> class flxDataArrayType : public flxDataArray
666556

667557
flxDataType_t type(void)
668558
{
669-
T c = {0};
670-
return flxDataTyper::type(c); // use the typer object - leverage overloading
559+
return flxGetTypeOf<T>();
671560
}
672561

673562
//--------------------------------------------------------------------
@@ -909,8 +798,7 @@ template <typename T> class _flxDataOut : public flxDataOut
909798
// Type of property
910799
flxDataType_t type(void)
911800
{
912-
T c;
913-
return flxDataTyper::type(c);
801+
return flxGetTypeOf<T>();
914802
};
915803

916804
virtual T get(void) const = 0;
@@ -1297,8 +1185,7 @@ template <typename T> class _flxDataIn : public flxDataIn
12971185

12981186
flxDataType_t type(void)
12991187
{
1300-
T c;
1301-
return flxDataTyper::type(c);
1188+
return flxGetTypeOf<T>();
13021189
};
13031190
virtual void set(T const &value) = 0;
13041191

0 commit comments

Comments
 (0)