OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
productInfo.cpp File Reference
#include <productInfo.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <pugixml.hpp>
#include <genutils.h>
#include <sensorInfo.h>
Include dependency graph for productInfo.cpp:

Go to the source code of this file.

Macros

#define XML_STRING_SIZE   512
 

Functions

void clearProductInfo (productInfo_t *info)
 
void initProductInfo (productInfo_t *info)
 
productInfo_t * allocateProductInfo ()
 
void freeProductInfo (productInfo_t *info)
 
void copyProductInfoHeader (productInfo_t *dest, const productInfo_t *src)
 
void copyProductInfo (productInfo_t *dest, const productInfo_t *src)
 
void initXmlFile ()
 
void checkProductNode ()
 
void checkAlgorithmNode ()
 
void readParamDesignator (productInfo_t *info, xml_node node)
 
void readSingleRange (productInfo_t *productInfo, xml_node rangeNode)
 
void readRange (productInfo_t *productInfo, xml_node productNode, int paramVal)
 
void readProductHeader ()
 
void readProduct (int paramVal)
 
void readAlgorithmHeader ()
 
void readAlgorithm (int paramVal)
 
void findFirstAlgorithmHeader ()
 
int findNextAlgorithmHeader ()
 
int compareAlgorithmHeader (const char *productFullName, int sensorId, int *paramVal)
 
void getFirstProductInfo (productInfo_t *info)
 
int getNextProductInfo (productInfo_t *info)
 
int findProductInfo (const char *productName, int sensorId, productInfo_t *info)
 
char * getProductNameFull (productInfo_t *info)
 
void printProductInfo (const char *productFullName, const productInfo_t *info)
 

Macro Definition Documentation

◆ XML_STRING_SIZE

#define XML_STRING_SIZE   512

Definition at line 10 of file productInfo.cpp.

Function Documentation

◆ allocateProductInfo()

productInfo_t* allocateProductInfo ( )

allocate memory for the product into structure and init to defaults. structure should be freed using freeProductInfo()

Returns
pointer to newly allocated structure

Definition at line 118 of file productInfo.cpp.

◆ checkAlgorithmNode()

void checkAlgorithmNode ( )

check the algorithm node to make sure the name == "algorithm"

Definition at line 301 of file productInfo.cpp.

◆ checkProductNode()

void checkProductNode ( )

check the product node to make sure the name == "product"

Definition at line 287 of file productInfo.cpp.

◆ clearProductInfo()

void clearProductInfo ( productInfo_t *  info)

set the product structure to defaults freeing memory from the current values

Parameters
infodestination product structure

Definition at line 42 of file productInfo.cpp.

◆ compareAlgorithmHeader()

int compareAlgorithmHeader ( const char *  productFullName,
int  sensorId,
int *  paramVal 
)

compare algorithmInfo header to product string

Parameters
productFullNamefull name of the product to compare
sensorIdsensor ID to use for wavelength comparison
paramValpointer to an int where parameter value will be written
Returns
1 if matches, 0 if not

Definition at line 799 of file productInfo.cpp.

◆ copyProductInfo()

void copyProductInfo ( productInfo_t *  dest,
const productInfo_t *  src 
)

copy product info structure

Parameters
destdestination product structure
srcsource product structure

Definition at line 187 of file productInfo.cpp.

◆ copyProductInfoHeader()

void copyProductInfoHeader ( productInfo_t *  dest,
const productInfo_t *  src 
)

copy product info structure, just header data

Parameters
destdestination product structure
srcsource product structure

Definition at line 170 of file productInfo.cpp.

◆ findFirstAlgorithmHeader()

void findFirstAlgorithmHeader ( )

find first algorithm node header

Definition at line 743 of file productInfo.cpp.

◆ findNextAlgorithmHeader()

int findNextAlgorithmHeader ( )

find next algorithm node header

Returns
1 if algorithm found, 0 if reached end of file

Definition at line 768 of file productInfo.cpp.

◆ findProductInfo()

int findProductInfo ( const char *  productName,
int  sensorId,
productInfo_t *  info 
)

find product and fill in the product structure.

Parameters
productNameproduct to find
sensorIdsensor ID to use when looking up the product
infopre allocated product structure to fill (allocateProductInfo)
Returns
1 if product found, 0 if not found

Definition at line 905 of file productInfo.cpp.

◆ freeProductInfo()

void freeProductInfo ( productInfo_t *  info)

free all the internal memory and the productInfo structure memory.

Parameters
infopointer to the product structure

Definition at line 130 of file productInfo.cpp.

◆ getFirstProductInfo()

void getFirstProductInfo ( productInfo_t *  info)

find first product and fill in the product structure.

Parameters
infopre allocated product structure to fill in

Definition at line 873 of file productInfo.cpp.

◆ getNextProductInfo()

int getNextProductInfo ( productInfo_t *  info)

find next product and fill in the product structure.

Parameters
infopre allocated product structure to fill in
Returns
1 if product found, 0 if no more products

Definition at line 887 of file productInfo.cpp.

◆ getProductNameFull()

char* getProductNameFull ( productInfo_t *  info)
Parameters
infoproduct structure to read
Returns
full product name. Pointer to internal memory.

Definition at line 978 of file productInfo.cpp.

◆ initProductInfo()

void initProductInfo ( productInfo_t *  info)

set the product structure to defaults ignoring the current values

Parameters
infodestination product structure

Definition at line 107 of file productInfo.cpp.

◆ initXmlFile()

void initXmlFile ( )

load XML file into local XML structure.

Definition at line 250 of file productInfo.cpp.

◆ printProductInfo()

void printProductInfo ( const char *  productFullName,
const productInfo_t *  info 
)

print product structure.

Parameters
productFullNameproduct name
infostructure to print

Definition at line 996 of file productInfo.cpp.

◆ readAlgorithm()

void readAlgorithm ( int  paramVal)

read algorithm data from the XML algorithmNode into algorithmInfo

Definition at line 655 of file productInfo.cpp.

◆ readAlgorithmHeader()

void readAlgorithmHeader ( )

read algorithm header from the XML algorithmNode and productNode into algorithmInfo

Definition at line 595 of file productInfo.cpp.

◆ readParamDesignator()

void readParamDesignator ( productInfo_t *  info,
xml_node  node 
)

read the paramDesignator information out of the XML file

Definition at line 315 of file productInfo.cpp.

◆ readProduct()

void readProduct ( int  paramVal)

read product data from the XML productNode into productInfo

Definition at line 499 of file productInfo.cpp.

◆ readProductHeader()

void readProductHeader ( )

read product header from the XML productNode into productInfo

Definition at line 482 of file productInfo.cpp.

◆ readRange()

void readRange ( productInfo_t *  productInfo,
xml_node  productNode,
int  paramVal 
)

read the range structures given the paramVal

Parameters
productInfoproduct structure to write the range data
productNodeXML node to read the info from
paramValinteger to match to the range's min and max

Definition at line 442 of file productInfo.cpp.

◆ readSingleRange()

void readSingleRange ( productInfo_t *  productInfo,
xml_node  rangeNode 
)

read the range node and write the data into the productInfo structure

Parameters
productInfoproduct structure to write the range data
rangeNodeXML node to read the info from

Definition at line 419 of file productInfo.cpp.