functions to get data type as a character string
This commit is contained in:
@ -5,7 +5,15 @@
|
||||
* Author: coissac
|
||||
*/
|
||||
|
||||
#include <obitypes.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "obitypes.h"
|
||||
#include "obidebug.h"
|
||||
#include "obierrno.h"
|
||||
|
||||
|
||||
#define DEBUG_LEVEL 0
|
||||
|
||||
|
||||
size_t obi_sizeof(OBIType_t type)
|
||||
@ -53,3 +61,35 @@ size_t obi_array_sizeof(OBIType_t type, size_t nb_elements, size_t nb_elements_p
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
char* name_data_type(int data_type)
|
||||
{
|
||||
char* name = NULL;
|
||||
|
||||
switch (data_type)
|
||||
{
|
||||
case OBI_VOID: name = strdup("OBI_VOID");
|
||||
break;
|
||||
|
||||
case OBI_INT: name = strdup("OBI_INT");
|
||||
break;
|
||||
|
||||
case OBI_FLOAT: name = strdup("OBI_FLOAT");
|
||||
break;
|
||||
|
||||
case OBI_CHAR: name = strdup("OBI_CHAR");
|
||||
break;
|
||||
|
||||
case OBI_IDX: name = strdup("OBI_IDX");
|
||||
break;
|
||||
}
|
||||
|
||||
if (name == NULL)
|
||||
obidebug(1, "Problem with the data type");
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user