RAVE
odim_source.c File Reference

Defines an odim source. More...

#include "odim_source.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include <string.h>
#include <stdio.h>

Classes

struct  _OdimSource_t
 Represents the area. More...
 

Functions

char * OdimSource_getIdFromOdimSource (const char *source, const char *id)
 Extracts an ID from the ODIM source string.
 
char * OdimSource_getIdFromOdimSourceInclusive (const char *source, const char *id)
 Extracts an ID from the ODIM source string inclusive the identifier.
 
OdimSource_tOdimSource_create (const char *nod, const char *wmo, const char *wigos, const char *plc, const char *rad, const char *cccc, const char *org)
 Utility function to create a complete OdimSource_t in one line.
 
int OdimSource_setNod (OdimSource_t *self, const char *sid)
 Sets the NOD for this source.
 
const char * OdimSource_getNod (OdimSource_t *self)
 Returns the NOD for this source.
 
int OdimSource_setWmo (OdimSource_t *self, const char *sid)
 Sets the WMO for this source.
 
const char * OdimSource_getWmo (OdimSource_t *self)
 Returns the WMO for this source.
 
int OdimSource_setWigos (OdimSource_t *self, const char *sid)
 Sets the WIGOS for this source.
 
const char * OdimSource_getWigos (OdimSource_t *self)
 Returns the WIGOS for this source.
 
int OdimSource_setPlc (OdimSource_t *self, const char *sid)
 Sets the PLC for this source.
 
const char * OdimSource_getPlc (OdimSource_t *self)
 Returns the PLC for this source.
 
int OdimSource_setRad (OdimSource_t *self, const char *sid)
 Sets the RAD for this source.
 
const char * OdimSource_getRad (OdimSource_t *self)
 Returns the RAD for this source.
 
int OdimSource_setCccc (OdimSource_t *self, const char *sid)
 Sets the CCCC for this source.
 
const char * OdimSource_getCccc (OdimSource_t *self)
 Returns the CCCC for this source.
 
int OdimSource_setOrg (OdimSource_t *self, const char *sid)
 Sets the ORG for this source.
 
const char * OdimSource_getOrg (OdimSource_t *self)
 Returns the ORG for this source.
 
const char * OdimSource_getSource (OdimSource_t *self)
 Returns the source string for this source.
 

Variables

RaveCoreObjectType OdimSource_TYPE
 Type definition to use when creating a rave object.
 

Detailed Description

Defines an odim source.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2025-01-15

Function Documentation

◆ OdimSource_create()

OdimSource_t * OdimSource_create ( const char * nod,
const char * wmo,
const char * wigos,
const char * plc,
const char * rad,
const char * cccc,
const char * org )

Utility function to create a complete OdimSource_t in one line.

Parameters
[in]nod- The NOD (mandatory)
[in]wmo- The WMO (mandatory)
[in]wigos- The WIGOS (mandatory)
[in]plc- The PLC (mandatory)
[in]rad- The RAD (mandatory)
[in]cccc- The CCCC (mandatory)
[in]org- The ORG (mandatory)
Returns
a created odim source

◆ OdimSource_getCccc()

const char * OdimSource_getCccc ( OdimSource_t * self)

Returns the CCCC for this source.

Parameters
[in]self- self
Returns
the cccc id

◆ OdimSource_getIdFromOdimSource()

char * OdimSource_getIdFromOdimSource ( const char * source,
const char * id )

Extracts an ID from the ODIM source string.

For example if the source is "NOD:sekkr,WMO:01234". Then the call OdimSource_getIdFromOdimSource(source, "WMO:") will return 01234

◆ OdimSource_getIdFromOdimSourceInclusive()

char * OdimSource_getIdFromOdimSourceInclusive ( const char * source,
const char * id )

Extracts an ID from the ODIM source string inclusive the identifier.

For example if the source is "NOD:sekkr,WMO:01234". Then the call OdimSource_getIdFromOdimSource(source, "WMO:") will return WMO:01234

◆ OdimSource_getNod()

const char * OdimSource_getNod ( OdimSource_t * self)

Returns the NOD for this source.

Parameters
[in]self- self
Returns
the id

◆ OdimSource_getOrg()

const char * OdimSource_getOrg ( OdimSource_t * self)

Returns the ORG for this source.

Parameters
[in]self- self
Returns
the org id

◆ OdimSource_getPlc()

const char * OdimSource_getPlc ( OdimSource_t * self)

Returns the PLC for this source.

Parameters
[in]self- self
Returns
the plc id

◆ OdimSource_getRad()

const char * OdimSource_getRad ( OdimSource_t * self)

Returns the RAD for this source.

Parameters
[in]self- self
Returns
the rad id

◆ OdimSource_getSource()

const char * OdimSource_getSource ( OdimSource_t * self)

Returns the source string for this source.

Will be in the format. NOD:<nod>,WMO:<wmo>,... If WMO = 00000 then it will not be added. If RAD,WIGOS,PLC is missing, they will not be added to the source string.

Parameters
[in]self- self
Returns
the odim source string

◆ OdimSource_getWigos()

const char * OdimSource_getWigos ( OdimSource_t * self)

Returns the WIGOS for this source.

Parameters
[in]self- self
Returns
the wigos id

◆ OdimSource_getWmo()

const char * OdimSource_getWmo ( OdimSource_t * self)

Returns the WMO for this source.

Parameters
[in]self- self
Returns
the wmo id

◆ OdimSource_setCccc()

int OdimSource_setCccc ( OdimSource_t * self,
const char * cccc )

Sets the CCCC for this source.

Parameters
[in]self- self
[in]cccc- the id
Returns
1 on success otherwise 0

◆ OdimSource_setNod()

int OdimSource_setNod ( OdimSource_t * self,
const char * nod )

Sets the NOD for this source.

Parameters
[in]self- self
[in]nod- the nod
Returns
1 on success otherwise 0

◆ OdimSource_setOrg()

int OdimSource_setOrg ( OdimSource_t * self,
const char * org )

Sets the ORG for this source.

Parameters
[in]self- self
[in]org- the id
Returns
1 on success otherwise 0

◆ OdimSource_setPlc()

int OdimSource_setPlc ( OdimSource_t * self,
const char * plc )

Sets the PLC for this source.

Parameters
[in]self- self
[in]plc- the id
Returns
1 on success otherwise 0

◆ OdimSource_setRad()

int OdimSource_setRad ( OdimSource_t * self,
const char * rad )

Sets the RAD for this source.

Parameters
[in]self- self
[in]rad- the id
Returns
1 on success otherwise 0

◆ OdimSource_setWigos()

int OdimSource_setWigos ( OdimSource_t * self,
const char * wigos )

Sets the WIGOS for this source.

Parameters
[in]self- self
[in]wigos- the id
Returns
1 on success otherwise 0

◆ OdimSource_setWmo()

int OdimSource_setWmo ( OdimSource_t * self,
const char * wmoid )

Sets the WMO for this source.

Parameters
[in]self- self
[in]wmoid- the id
Returns
1 on success otherwise 0

Variable Documentation

◆ OdimSource_TYPE

RaveCoreObjectType OdimSource_TYPE
Initial value:
= {
"OdimSource",
sizeof(OdimSource_t),
OdimSource_constructor,
OdimSource_destructor,
OdimSource_copyconstructor
}
struct _OdimSource_t OdimSource_t
Defines a Geographical Area.
Definition odim_source.h:33

Type definition to use when creating a rave object.