functions to get data type as a character string

This commit is contained in:
celinemercier
2015-08-03 11:46:21 +02:00
parent 5f62cd8526
commit 1e01c9059c
4 changed files with 65 additions and 5 deletions

View File

@ -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;
}