RAVE
file_object.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2025 Swedish Meteorological and Hydrological Institute, SMHI,
3
4This file is part of RAVE.
5
6RAVE is free software: you can redistribute it and/or modify
7it under the terms of the GNU Lesser General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11RAVE is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU Lesser General Public License for more details.
15
16You should have received a copy of the GNU Lesser General Public License
17along with RAVE. If not, see <http://www.gnu.org/licenses/>.
18------------------------------------------------------------------------*/
26#ifndef FILEOBJECT_H
27#define FILEOBJECT_H
28#include "rave_object.h"
29#include "rave_value.h"
30#include "rave_types.h"
31#include "rave_list.h"
32#include "raveobject_list.h"
33#include "lazy_dataset.h"
34#include "rave_data2d.h"
35
36typedef enum FileObjectRestrictionMode {
37 FileObjectRestrictionMode_NONE=0,
38 FileObjectRestrictionMode_ODIM=1
39} FileObjectRestrictionMode;
40
45
50
56
63int FileObject_setName(FileObject_t* self, const char* name);
64
69const char* FileObject_getName(FileObject_t* self);
70
79
87
94void FileObject_setRestrictionMode(FileObject_t* self, FileObjectRestrictionMode mode);
95
100FileObjectRestrictionMode FileObject_getRestrictionMode(FileObject_t* self);
101
111FileObject_t* FileObject_get(FileObject_t* self, const char* name);
112
122FileObject_t* FileObject_create(FileObject_t* self, const char* name);
123
129
136
141int FileObject_exists(FileObject_t* self, const char* name);
142
149
156
164int FileObject_addAttribute(FileObject_t* self, const char* name, RaveValue_t* value);
165
171
178
186
194
202
210
218
226#endif
RaveCoreObjectType FileObject_TYPE
Type definition to use when creating a rave object.
Definition file_object.c:617
FileObject_t * FileObject_getByIndex(FileObject_t *self, int index)
Returns the sub group at specified index.
Definition file_object.c:483
FileObject_t * FileObject_get(FileObject_t *self, const char *name)
Gets the subgroup within self.
Definition file_object.c:477
void FileObject_setRestrictionMode(FileObject_t *self, FileObjectRestrictionMode mode)
Sets a restriction mode on the file object structure.
Definition file_object.c:464
int FileObject_setLazyDataset(FileObject_t *self, LazyDataset_t *lazyDataset)
Sets a lazy dataset in the file object.
Definition file_object.c:604
FileObject_t * FileObject_createRoot(void)
Creates the root group to get started.
Definition file_object.c:395
int FileObject_setData(FileObject_t *self, RaveData2D_t *data)
Definition file_object.c:502
char * FileObject_toString(FileObject_t *self)
Creates a string representation of the file object including subgroups and attributes.
Definition file_object.c:447
const char * FileObject_getName(FileObject_t *self)
Definition file_object.c:563
FileObjectRestrictionMode FileObject_getRestrictionMode(FileObject_t *self)
Definition file_object.c:470
int FileObject_isDatasetLoaded(FileObject_t *self)
Checks if the data 2d field has been set.
Definition file_object.c:520
struct _FileObject_t FileObject_t
Defines a general file object.
Definition file_object.h:44
RaveDataType FileObject_getDatasetType(FileObject_t *self)
If this object is a dataset then this will return the data type of the dataset.
Definition file_object.c:544
long FileObject_getDatasetX(FileObject_t *self)
If this object is a dataset then this will return the xsize of the dataset.
Definition file_object.c:528
long FileObject_getDatasetY(FileObject_t *self)
If this object is a dataset then this will return the ysize of the dataset.
Definition file_object.c:536
RaveValue_t * FileObject_attributes(FileObject_t *self)
Returns the attributes as a RaveValueHash.
Definition file_object.c:592
RaveData2D_t * FileObject_getData(FileObject_t *self)
Definition file_object.c:495
int FileObject_isDataset(FileObject_t *self)
Returns if this group is a dataset node.
Definition file_object.c:511
FileObject_t * FileObject_create(FileObject_t *self, const char *name)
Gets (or creates) the subgroup within self.
Definition file_object.c:489
int FileObject_areNamesSet(FileObject_t *self)
Verifies that all names are set in self and all child groups.
Definition file_object.c:426
int FileObject_setName(FileObject_t *self, const char *name)
Sets the name of this file object.
Definition file_object.c:552
int FileObject_addAttribute(FileObject_t *self, const char *name, RaveValue_t *value)
Adds an attribute to this group.
Definition file_object.c:598
int FileObject_exists(FileObject_t *self, const char *name)
Definition file_object.c:575
RaveObjectList_t * FileObject_groups(FileObject_t *self)
Returns the sub groups.
Definition file_object.c:586
size_t FileObject_numberOfGroups(FileObject_t *self)
Definition file_object.c:569
This is a wrapper around a lazy nodelist reader used for fetching data from a HL_NodeList.
struct _LazyDataset_t LazyDataset_t
Defines a LazyNodeListReader instance.
Definition lazy_dataset.h:39
Represents a 2-dimensional data array.
struct _RaveData2D_t RaveData2D_t
Defines a Rave 2-dimensional data array.
Definition rave_data2d.h:34
Implementation of a simple list.
Generic implementation of an object that is used within rave.
struct _raveobjecttype RaveCoreObjectType
The rave object type definition.
Type definitions for RAVE.
RaveDataType
Different data types that are supported during transformation.
Definition rave_types.h:130
A value object that can represent standard types like int, double, .
struct _RaveValue_t RaveValue_t
Defines a rave value.
Definition rave_value.h:47
Implementation of a rave object list that ensures that the objects contained within the list are rele...
struct _RaveObjectList_t RaveObjectList_t
Defines a list.
Definition raveobject_list.h:38
Represents the file object.
Definition file_object.c:35
RAVE_OBJECT_HEAD FileObjectRestrictionMode mode
Always on top.
Definition file_object.c:37