74 lines
2.3 KiB
C
74 lines
2.3 KiB
C
#ifndef DATA_UTILITIES_H
|
|
#define DATA_UTILITIES_H
|
|
|
|
// header files
|
|
#include "StandardConstants.h"
|
|
|
|
// data structures
|
|
typedef struct StateStruct
|
|
{
|
|
char name[ STD_STR_LEN ];
|
|
|
|
double averageTemp, lowestTemp, highestTemp;
|
|
|
|
bool inUse;
|
|
} StateDataType;
|
|
|
|
/*
|
|
Name: setDataNodeFromData
|
|
Process: sets given values into a given StateDataType struct,
|
|
using individual struct data
|
|
Function input/parameters: provided name (const char *),
|
|
average, lowest, and highest temperatures (double),
|
|
and node in use state
|
|
Function output/parameters: updated state data pointer (StateDataType *)
|
|
Function output/returned: none
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: privateCopyString
|
|
*/
|
|
void setDataNodeFromData( StateDataType *nodePtr, const char *name,
|
|
double avgTemp, double lowTemp, double highTemp, bool nodeState );
|
|
|
|
/*
|
|
Name: setDataNodeFromStruct
|
|
Process: sets given values into a given StateDataType struct,
|
|
using another data struct
|
|
Function input/parameters: provided state data source struct
|
|
(const StateDataType)
|
|
Function output/parameters: updated state data pointer (StateDataType *)
|
|
Function output/returned: none
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: setDataNodeFromData
|
|
*/
|
|
void setDataNodeFromStruct( StateDataType *nodePtr,
|
|
const StateDataType source );
|
|
|
|
/*
|
|
Name: stateDataToString
|
|
Process: creates string from StateDataType data
|
|
Function input/parameters: provided state data (const StateDataType)
|
|
Function output/parameters: output string (char *)
|
|
Function output/returned: none
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: sprintf, or other options
|
|
*/
|
|
void stateDataToString( char *outStr, const StateDataType state );
|
|
|
|
/*
|
|
Name: setEmptyDataNode
|
|
Process: sets given node values to string "---", zero values,
|
|
and Boolean in use variable to false
|
|
Function input/parameters: state data struct (StateDataType *)
|
|
Function output/parameters: updated state data struct (StateDataType *)
|
|
Function output/returned: none
|
|
Device input/---: none
|
|
Device output/---: none
|
|
Dependencies: privateCopyString
|
|
*/
|
|
void setEmptyDataNode( StateDataType *node );
|
|
|
|
|
|
#endif // DATA_UTILITIES_H
|