Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OBITools3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OBITools
OBITools3
Commits
9d91e907
Commit
9d91e907
authored
Aug 26, 2015
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When a column is created, its data is initialized to the NA value of the
obitype
parent
3f81dc01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletion
+56
-1
src/obidmscolumn.c
src/obidmscolumn.c
+38
-0
src/obitypes.h
src/obitypes.h
+18
-1
No files found.
src/obidmscolumn.c
View file @
9d91e907
...
...
@@ -600,6 +600,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
int
column_dir_file_descriptor
;
size_t
header_size
;
size_t
data_size
;
size_t
i
,
nb_elements
;
new_column
=
NULL
;
...
...
@@ -730,6 +731,43 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
strncpy
(
header
->
name
,
column_name
,
OBIDMS_MAX_COLNAME
);
// Fill the data with NA values
nb_elements
=
nb_lines
*
nb_elements_per_line
;
switch
(
type
)
{
case
OBI_VOID
:
// TODO;
break
;
case
OBI_INT
:
for
(
i
=
0
;
i
<
nb_elements
;
i
++
)
{
*
(((
obiint_t
*
)
(
new_column
->
data
))
+
i
)
=
OBIInt_NA
;
}
break
;
case
OBI_FLOAT
:
for
(
i
=
0
;
i
<
nb_elements
;
i
++
)
{
*
(((
obifloat_t
*
)
(
new_column
->
data
))
+
i
)
=
OBIFloat_NA
;
}
break
;
case
OBI_BOOL
:
for
(
i
=
0
;
i
<
nb_elements
;
i
++
)
{
*
(((
obibool_t
*
)
(
new_column
->
data
))
+
i
)
=
OBIBool_NA
;
}
break
;
case
OBI_CHAR
:
for
(
i
=
0
;
i
<
nb_elements
;
i
++
)
{
*
(((
obichar_t
*
)
(
new_column
->
data
))
+
i
)
=
OBIChar_NA
;
}
break
;
case
OBI_IDX
:
for
(
i
=
0
;
i
<
nb_elements
;
i
++
)
{
*
(((
obiidx_t
*
)
(
new_column
->
data
))
+
i
)
=
OBIIdx_NA
;
}
break
;
}
free
(
column_file_name
);
close
(
column_file_descriptor
);
...
...
src/obitypes.h
View file @
9d91e907
...
...
@@ -14,8 +14,9 @@
#define OBIInt_NA (INT32_MIN)
#define OBIFloat_NA (NAN)
#define OBIIdx_NA (SIZE_MAX)
#define OBIFloat_NA (float_NA())
#define OBIChar_NA (0) // TODO not sure about this one as it can be impossible to distinguish from uninitialized values
/**
...
...
@@ -47,6 +48,22 @@ typedef char obichar_t;
typedef
size_t
obiidx_t
;
typedef
union
{
double
value
;
unsigned
int
word
[
2
];
}
ieee_double
;
static
double
float_NA
(
void
)
// as defined in R
{
volatile
ieee_double
x
;
x
.
word
[
0
]
=
0x7ff00000
;
x
.
word
[
1
]
=
1954
;
return
x
.
value
;
}
/**
* @brief returns the memory size in bytes of an OBIType
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment