bufr2synop 0.24.0
|
This file has the memory stufs for library bufrdeco. More...
#include "bufrdeco.h"
Go to the source code of this file.
This file has the memory stufs for library bufrdeco.
Definition in file bufrdeco_memory.c.
int bufrdeco_allocate_bitmap | ( | struct bufrdeco * | b | ) |
allocate bitmap
b | the active struct bufrdeco |
Definition at line 269 of file bufrdeco_memory.c.
References bufrdeco::bitmap, bufrdeco_bitmap_array::bmap, BUFR_MAX_BITMAPS, bufrdeco_assert, bufrdeco::error, and bufrdeco_bitmap_array::nba.
Referenced by bufrdeco_parse_f2_compressed(), and bufrdeco_parse_f2_descriptor().
int bufrdeco_clean_bitmaps | ( | struct bufrdeco * | b | ) |
Clean all allocated bitmaps, but still is in memory.
b | the active struct bufrdeco |
Definition at line 308 of file bufrdeco_memory.c.
References bufrdeco::bitmap, bufrdeco_bitmap_array::bmap, bufrdeco_assert, and bufrdeco_bitmap_array::nba.
Referenced by bufrdeco_decode_data_subset().
int bufrdeco_clean_compressed_data_references | ( | struct bufrdeco_compressed_data_references * | rf | ) |
Clean a struct bufrdeco_compressed_data_references.
rf | pointer to the target struct bufrdeco_compressed_data_references to clean |
Definition at line 233 of file bufrdeco_memory.c.
References bufrdeco_assert, bufrdeco_init_compressed_data_references(), bufrdeco_compressed_data_references::nd, and bufrdeco_compressed_data_references::refs.
int bufrdeco_clean_subset_sequence_data | ( | struct bufrdeco_subset_sequence_data * | ba | ) |
Cleans a struct bufrdeco_subset_sequence_data.
ba | Pointer to struct bufrdeco_subset_sequence_data to clean |
For eficience, if sequence in the struct bufrdeco_subset_sequence_data is allocated, just set the used elements to zero. If is still no allocated memory for sequence inits the struct
Definition at line 164 of file bufrdeco_memory.c.
References bufrdeco_assert, bufrdeco_init_subset_sequence_data(), bufrdeco_subset_sequence_data::nd, and bufrdeco_subset_sequence_data::sequence.
Referenced by bufrdeco_decode_data_subset().
int bufrdeco_free_bitmap_array | ( | struct bufrdeco_bitmap_array * | a | ) |
Free an allocated bitmap array.
a | pointer to target struct bufrdeco_bitmap_array to free |
Definition at line 331 of file bufrdeco_memory.c.
References bufrdeco_bitmap_array::bmap, bufrdeco_assert, and bufrdeco_bitmap_array::nba.
Referenced by bufrdeco_close(), and bufrdeco_reset().
int bufrdeco_free_compressed_data_references | ( | struct bufrdeco_compressed_data_references * | rf | ) |
Free the memory allocated for array of references in a struct bufrdeco_compressed_data_references.
rf | pointer to the target struct bufrdeco_compressed_data_references to free |
Definition at line 250 of file bufrdeco_memory.c.
References bufrdeco_assert, and bufrdeco_compressed_data_references::refs.
Referenced by bufrdeco_close(), and bufrdeco_reset().
int bufrdeco_free_expanded_tree | ( | struct bufrdeco_expanded_tree ** | t | ) |
Frees the allocated space for a struct bufrdeco_expanded_tree.
t | pointer to the target pointer to struct bufrdeco_expanded_tree |
Definition at line 89 of file bufrdeco_memory.c.
References bufrdeco_assert.
Referenced by bufrdeco_close(), and bufrdeco_reset().
int bufrdeco_free_subset_sequence_data | ( | struct bufrdeco_subset_sequence_data * | ba | ) |
Free the memory for sequence array in a struct bufrdeco_subset_sequence_data.
ba | pointer to the target struct to free |
Definition at line 183 of file bufrdeco_memory.c.
References bufrdeco_assert, and bufrdeco_subset_sequence_data::sequence.
Referenced by bufrdeco_close(), and bufrdeco_reset().
int bufrdeco_free_tables | ( | struct bufr_tables ** | t | ) |
Frees the allocated space for a struct bufr_tables.
t | pointer to the target pointer to struct bufr_tables |
Definition at line 51 of file bufrdeco_memory.c.
References bufrdeco_assert.
Referenced by bufrdeco_close().
int bufrdeco_init_compressed_data_references | ( | struct bufrdeco_compressed_data_references * | rf | ) |
Init a struct bufrdeco_compressed_data_references.
rf | pointer ti the target struct |
If already memory is allocated for array of references then just adjust the used index to zero. Otherwise it allocate the needed memory and init the struct
Definition at line 205 of file bufrdeco_memory.c.
References BUFR_NMAXSEQ, bufrdeco_assert, bufrdeco_compressed_data_references::dim, bufrdeco_compressed_data_references::nd, and bufrdeco_compressed_data_references::refs.
Referenced by bufrdeco_clean_compressed_data_references(), and bufrdeco_parse_compressed().
int bufrdeco_init_expanded_tree | ( | struct bufrdeco_expanded_tree ** | t | ) |
Init a struct bufrdeco_expanded_tree allocating space.
t | pointer to the target pointer to struct bufrdeco_expanded_tree |
Definition at line 70 of file bufrdeco_memory.c.
References bufrdeco_assert.
Referenced by bufrdeco_init(), and bufrdeco_reset().
int bufrdeco_init_subset_sequence_data | ( | struct bufrdeco_subset_sequence_data * | ba | ) |
Init a struct bufrdeco_subset_sequence_data.
ba | pointer to the target struct |
It is supossed that no memory is allocated for sequence. If we are not sure better use function bufrdeco_clean_subset_sequence_data
Definition at line 140 of file bufrdeco_memory.c.
References BUFR_NMAXSEQ, bufrdeco_assert, bufrdeco_subset_sequence_data::dim, and bufrdeco_subset_sequence_data::sequence.
Referenced by bufrdeco_clean_subset_sequence_data().
int bufrdeco_init_tables | ( | struct bufr_tables ** | t | ) |
Init a struct bufr_tables allocating space.
t | pointer to the target pointer to struct bufr_tables |
Definition at line 32 of file bufrdeco_memory.c.
References bufrdeco_assert.
Referenced by bufr_read_tables(), bufrdeco_init(), bufrdeco_store_tables(), and bufrdeco_substitute_tables().
int bufrdeco_substitute_tables | ( | struct bufr_tables ** | replaced, |
struct bufr_tables * | source, | ||
struct bufrdeco * | b | ||
) |
substitute an struct bufr_tables into a struct bufrdeco
replaced | Pointer where to set the replaced pointer |
source | Pointer to a struct bufr_tables |
b | pointer to the container basic struct bufrdeco |
Remember that the struct bufr_tables used in bufrdeco library is the one which pointer is in struct bufrdeco . To avoid problems the struct must be initialized before substituted in this fucntion. Both source and replaced structs are not modified.
This is useful if we do not want to read and parse tables again if the caller has a pool of already readed tables.
Definition at line 116 of file bufrdeco_memory.c.
References bufrdeco_assert, bufrdeco_init_tables(), and bufrdeco::tables.