mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-08-25 06:31:43 +02:00
Move the polymorphism description
This commit is contained in:
parent
c6b628e583
commit
bc89fdebb0
@ -137,7 +137,7 @@ __trexio_path__ = None
|
||||
|
||||
#+begin_src c :tangle trexio_private.h
|
||||
#define MALLOC(T) (T*) malloc (sizeof(T))
|
||||
#define CALLOC(N,T) (T*) calloc ( (N)+1 , sizeof(T) )
|
||||
#define CALLOC(N,T) (T*) calloc ( (N)+1 , sizeof(T) )
|
||||
#+end_src
|
||||
|
||||
When a pointer is freed, it should be set to ~NULL~.
|
||||
@ -600,7 +600,7 @@ def string_of_error(return_code: int) -> str:
|
||||
Then the corresponding back-end ~has/read/write~ functions has to be implemented. For example, see the commented
|
||||
lines that correspond to the ~TREXIO_JSON~ back end (not implemented yet).
|
||||
|
||||
_Note_: It is important to increment the value of ~TREXIO_INVALID_BACK_END~ when a new back end is added. Otherwise, it will not be available.
|
||||
_Note_: It is important to increment the value of ~TREXIO_INVALID_BACK_END~ when a new back end is implemented. Otherwise, it will not be available.
|
||||
|
||||
*** C
|
||||
|
||||
@ -852,20 +852,6 @@ class File:
|
||||
pass
|
||||
#+end_src
|
||||
|
||||
** TODO (Remove) : Polymorphism of the file handle
|
||||
|
||||
Polymorphism of the ~trexio_t~ type is handled by ensuring that the
|
||||
corresponding types for all back ends can be safely casted to
|
||||
~trexio_t~. This is done by making the back-end structs start with
|
||||
~struct trexio_s~:
|
||||
|
||||
#+begin_src c
|
||||
struct trexio_back_end_s {
|
||||
trexio_t parent ;
|
||||
/* add below specific back-end data */
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** File opening
|
||||
|
||||
~trexio_open~ creates a new TREXIO file or opens the existing one.
|
||||
|
@ -60,6 +60,11 @@
|
||||
|
||||
* Template for HDF5 structures
|
||||
|
||||
Polymorphism of the ~trexio_t~ type is handled by ensuring that the
|
||||
corresponding types for all back ends can be safely casted to
|
||||
~trexio_t~. This is done by making the back-end structs start with
|
||||
~trexio_t parent~ attribute:
|
||||
|
||||
#+begin_src c :tangle struct_hdf5.h
|
||||
typedef struct trexio_hdf5_s {
|
||||
trexio_t parent ;
|
||||
|
Loading…
Reference in New Issue
Block a user