Skip to content

Commit

Permalink
Merge d12a46e into 4c7d885
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrush authored Jun 25, 2019
2 parents 4c7d885 + d12a46e commit 8895766
Show file tree
Hide file tree
Showing 7 changed files with 1,145 additions and 20 deletions.
51 changes: 49 additions & 2 deletions src/libs/conduit/c/conduit_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,26 @@ CONDUIT_API conduit_index_t conduit_node_number_of_children(conduit_node *cnode)
//-----------------------------------------------------------------------------
CONDUIT_API conduit_index_t conduit_node_number_of_elements(conduit_node *cnode);

//-----------------------------------------------------------------------------
/// remove path
CONDUIT_API void conduit_node_remove_path(conduit_node *cnode,
const char *path);

//-----------------------------------------------------------------------------
/// remove child by index
CONDUIT_API void conduit_node_remove_child(conduit_node *cnode,
conduit_index_t idx);


//-----------------------------------------------------------------------------
// TODO: for Node::name() in c, the caller must free the result,
// before we expose this, we need to understand the implications of this in
// fortran
// NOTE: the fortran version could pass in the buffer to contain the path.
CONDUIT_API char *conduit_node_name(const conduit_node *cnode);

//-----------------------------------------------------------------------------
// TODO: for Node::path() in c, thecaller must free the result,
// TODO: for Node::path() in c, the caller must free the result,
// before we expose this, we need to understand the implications of this in
// fortran
// NOTE: the fortran version could pass in the buffer to contain the path.
Expand All @@ -116,6 +133,12 @@ CONDUIT_API int conduit_node_has_child(const conduit_node *cnode,
CONDUIT_API int conduit_node_has_path(const conduit_node *cnode,
const char *path);

//-----------------------------------------------------------------------------
/// rename a child (object interface)
CONDUIT_API void conduit_node_rename_child(conduit_node *cnode,
const char *current_name,
const char *new_name);

//-----------------------------------------------------------------------------
// -- node info --
//-----------------------------------------------------------------------------
Expand All @@ -130,10 +153,16 @@ CONDUIT_API conduit_node *conduit_node_parent(conduit_node *cnode);
//-----------------------------------------------------------------------------
CONDUIT_API conduit_index_t conduit_node_total_strided_bytes(const conduit_node *cnode);
CONDUIT_API conduit_index_t conduit_node_total_bytes_compact(const conduit_node *cnode);
CONDUIT_API conduit_index_t conduit_node_total_bytes_allocated(const conduit_node *cnode);

//-----------------------------------------------------------------------------
CONDUIT_API int conduit_node_is_compact(const conduit_node *cnode);


//-----------------------------------------------------------------------------
CONDUIT_API int conduit_node_compatible(const conduit_node *cnode,
const conduit_node *cother);

//-----------------------------------------------------------------------------
CONDUIT_API int conduit_node_is_contiguous(const conduit_node *cnode);
CONDUIT_API int conduit_node_contiguous_with_node(const conduit_node *cnode,
Expand All @@ -157,12 +186,30 @@ CONDUIT_API int conduit_node_compatible(const conduit_node *cnode,
const conduit_node *cother);

CONDUIT_API void conduit_node_info(const conduit_node *cnode,
conduit_node *cnres);
conduit_node *cnres);
//-----------------------------------------------------------------------------
CONDUIT_API void conduit_node_print(conduit_node *cnode);
CONDUIT_API void conduit_node_print_detailed(conduit_node *cnode);


//-----------------------------------------------------------------------------
// -- compaction methods ---
//-----------------------------------------------------------------------------
CONDUIT_API void conduit_node_compact_to(const conduit_node *cnode,
conduit_node *cnres);

//-----------------------------------------------------------------------------
// -- update methods ---
//-----------------------------------------------------------------------------
CONDUIT_API void conduit_node_update(conduit_node *cnode,
const conduit_node *cother);
CONDUIT_API void conduit_node_update_compatible(conduit_node *cnode,
const conduit_node *cother);
CONDUIT_API void conduit_node_update_external(conduit_node *cnode,
conduit_node *cother);



//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Conduit Node "Set" Methods
Expand Down
87 changes: 87 additions & 0 deletions src/libs/conduit/c/conduit_node_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,49 @@ conduit_node_number_of_elements(conduit_node *cnode)
return cpp_node(cnode)->dtype().number_of_elements();
}

//-----------------------------------------------------------------------------
char *
conduit_node_name(const conduit_node *cnode)
{
return _conduit_strdup(cpp_node(cnode)->name().c_str());
}

//-----------------------------------------------------------------------------
char *
conduit_node_path(const conduit_node *cnode)
{
return _conduit_strdup(cpp_node(cnode)->path().c_str());
}

//-----------------------------------------------------------------------------
/// remove path
void
conduit_node_remove_path(conduit_node *cnode,
const char *path)
{
cpp_node(cnode)->remove(path);
}

//-----------------------------------------------------------------------------
/// remove child by index
void
conduit_node_remove_child(conduit_node *cnode,
conduit_index_t idx)
{
cpp_node(cnode)->remove(idx);
}

//-----------------------------------------------------------------------------
/// rename a child (object interface)
void
conduit_node_rename_child(conduit_node *cnode,
const char *current_name,
const char *new_name)
{
cpp_node(cnode)->rename_child(current_name, new_name);
}


//-----------------------------------------------------------------------------
int
conduit_node_has_child(const conduit_node *cnode,
Expand Down Expand Up @@ -188,6 +224,14 @@ conduit_node_total_bytes_compact(const conduit_node *cnode)
return cpp_node(cnode)->total_bytes_compact();
}

//-----------------------------------------------------------------------------
conduit_index_t
conduit_node_total_bytes_allocated(const conduit_node *cnode)
{
return cpp_node(cnode)->total_bytes_allocated();
}


//-----------------------------------------------------------------------------
int
conduit_node_is_compact(const conduit_node *cnode)
Expand All @@ -202,6 +246,14 @@ conduit_node_is_contiguous(const conduit_node *cnode)
return (int)cpp_node(cnode)->is_contiguous();
}

//-----------------------------------------------------------------------------
int
conduit_node_compatible(const conduit_node *cnode,
const conduit_node *cother)
{
return (int)cpp_node(cnode)->compatible(cpp_node_ref(cother));
}

//-----------------------------------------------------------------------------
int
conduit_node_contiguous_with_node(const conduit_node *cnode,
Expand Down Expand Up @@ -266,6 +318,41 @@ conduit_node_print_detailed(conduit_node *cnode)
cpp_node(cnode)->print_detailed();
}

//-----------------------------------------------------------------------------
// -- compaction methods ---
//-----------------------------------------------------------------------------
void
conduit_node_compact_to(const conduit_node *cnode,
conduit_node *cnres)
{
cpp_node(cnode)->compact_to(cpp_node_ref(cnres));
}

//-----------------------------------------------------------------------------
// -- update methods ---
//-----------------------------------------------------------------------------
void
conduit_node_update(conduit_node *cnode,
const conduit_node *cother)
{
cpp_node(cnode)->update(cpp_node_ref(cother));
}

//-----------------------------------------------------------------------------
void
conduit_node_update_compatible(conduit_node *cnode,
const conduit_node *cother)
{
cpp_node(cnode)->update_compatible(cpp_node_ref(cother));
}

//-----------------------------------------------------------------------------
void
conduit_node_update_external(conduit_node *cnode,
conduit_node *cother)
{
cpp_node(cnode)->update_external(cpp_node_ref(cother));
}



Expand Down
Loading

0 comments on commit 8895766

Please sign in to comment.