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 <unistd.h>
#include <pugixml.hpp>
#include <genutils.h>
#include <sensorInfo.h>
#include <string>
#include <map>
#include <fstream>
#include <rapidjson/document.h>
#include <rapidjson/istreamwrapper.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)
 
void readProductAliasFile (string fileName, map< string, ProductAlias > &aliasMap)
 
void initProductAliasMap (int sensorId)
 
bool findProductAlias (string productName, int sensorId, ProductAlias &productAlias)
 
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 17 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 133 of file productInfo.cpp.

◆ checkAlgorithmNode()

void checkAlgorithmNode ( )

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

Definition at line 316 of file productInfo.cpp.

◆ checkProductNode()

void checkProductNode ( )

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

Definition at line 302 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 57 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 810 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 202 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 185 of file productInfo.cpp.

◆ findFirstAlgorithmHeader()

void findFirstAlgorithmHeader ( )

find first algorithm node header

Definition at line 754 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 779 of file productInfo.cpp.

◆ findProductAlias()

bool findProductAlias ( string  productName,
int  sensorId,
ProductAlias &  productAlias 
)

Definition at line 962 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 983 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 145 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 884 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 898 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 1022 of file productInfo.cpp.

◆ initProductAliasMap()

void initProductAliasMap ( int  sensorId)

Definition at line 940 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 122 of file productInfo.cpp.

◆ initXmlFile()

void initXmlFile ( )

load XML file into local XML structure.

Definition at line 265 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 1040 of file productInfo.cpp.

◆ readAlgorithm()

void readAlgorithm ( int  paramVal)

read algorithm data from the XML algorithmNode into algorithmInfo

Definition at line 666 of file productInfo.cpp.

◆ readAlgorithmHeader()

void readAlgorithmHeader ( )

read algorithm header from the XML algorithmNode and productNode into algorithmInfo

Definition at line 606 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 330 of file productInfo.cpp.

◆ readProduct()

void readProduct ( int  paramVal)

read product data from the XML productNode into productInfo

Definition at line 514 of file productInfo.cpp.

◆ readProductAliasFile()

void readProductAliasFile ( string  fileName,
map< string, ProductAlias > &  aliasMap 
)

Definition at line 918 of file productInfo.cpp.

◆ readProductHeader()

void readProductHeader ( )

read product header from the XML productNode into productInfo

Definition at line 497 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 457 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 434 of file productInfo.cpp.