Building Controls Virtual Test Bed
util/utilXml.c File Reference
#include "utilXml.h"
Include dependency graph for util/utilXml.c:

Go to the source code of this file.

Functions

static void XMLCALL EPstart (void *data, const char *el, const char **attr)
 Call back functions that will be used by the expat xml parser. More...
 
static void XMLCALL EPend (void *data, const char *el)
 Call back functions that will be used by the expat xml parser. More...
 
void freeResource (char **strArr, int n)
 This method frees the local memory allocated. More...
 
int getepvariables (char *const fileName, char *const myOutputVarsName, char *const myOutputVarsType, int *const myNumOutputVars, char *const myInputKeys, int *const myNumInputKeys, char *const myInputVars, int *const myNumInputVars, int *const myInputVarsType, int *const myStrLen)
 This method will return the input and output variable for EnergyPlus in sequence. More...
 
int getepvariablesFMU (char *const fileName, char *const myOutputVarsName, char *const myOutputVarsType, int *const myNumOutputVars, char *const myInputKeys, int *const myNumInputKeys, char *const myInputVars, int *const myNumInputVars, int *const myInputVarsType, int *const myStrLen)
 This method will return the input and output variable for EnergyPlus in sequence. More...
 
int stackPopBCVTB ()
 Stack operation, this function will pop one element from stack and will free the resource unused. More...
 
int stackPushBCVTB (char *str)
 Stack operation, will push one element into the stack and will allocate memory for the new element, hence is deep copy. More...
 
]
Parameters
fileNamethe xml file name.
expthe xPath expression.
strstring to store the found values, semicolon separated.
nValsnumber of values found.
strLenthe string length allocated.
int getxmlvalues (char *const fileName, char *const exp, char *const myVals, int *const myNumVals, int const myStrLen)
 
static void XMLCALL start (void *data, const char *el, const char **attr)
 Call back functions that will be used by the expat xml parser. More...
 
static void XMLCALL end (void *data, const char *el)
 Call back functions that will be used by the expat xml parser. More...
 
int getnumberofxmlvalues (char *const fileName, char *const exp)
 
int getxmlvaluesf (char *const fileName, char *const exp, char *const atrName, int *const nVal, char *const str, int *const strLen)
 
int getxmlvalue (char *const fileName, char *const exp, char *const str, int *const nVals, int const strLen)
 
int check_variable_cfg_Validate (char *const fileName)
 This method checks the validity of the variables configuration xml file for a given dtd file that is specified in the variables configuration file. More...
 

Function Documentation

int check_variable_cfg_Validate ( char *const  fileName)

This method checks the validity of the variables configuration xml file for a given dtd file that is specified in the variables configuration file.

Return values: -1 Error in the file 0 File is validate

Definition at line 869 of file util/utilXml.c.

Referenced by getepvariables(), and getxmlvaluesf().

static void XMLCALL end ( void *  data,
const char *  el 
)
static

Call back functions that will be used by the expat xml parser.

This function is used for getxmlvalues

Definition at line 707 of file util/utilXml.c.

References Stack::cur, expStk, Stack::head, and strcmp().

Referenced by getxmlvalues().

static void XMLCALL EPend ( void *  data,
const char *  el 
)
static

Call back functions that will be used by the expat xml parser.

This function is designed for the function getepvariables to get input and output variables in the same order as they appear in the configuration file

Definition at line 204 of file util/utilXml.c.

References source.

Referenced by getepvariables(), and getepvariablesFMU().

static void XMLCALL EPstart ( void *  data,
const char *  el,
const char **  attr 
)
static

Call back functions that will be used by the expat xml parser.

This function is designed for the function getepvariables to get input and output variables in the same order as they appear in the configuration file

Definition at line 115 of file util/utilXml.c.

References ERROR_STATUS, fprintf(), i, inputKeys, inputVars, inputVarsType, numInputKeys, numInputVars, numOutputVars, outputVarsName, outputVarsType, source, strcmp(), and strLen.

Referenced by getepvariables(), and getepvariablesFMU().

void freeResource ( char **  strArr,
int  n 
)

This method frees the local memory allocated.

Parameters
strArr1D string array to be freed
nthe size of the 1D string array

Definition at line 216 of file util/utilXml.c.

References i.

Referenced by getepvariables(), and getepvariablesFMU().

int getepvariables ( char *const  fileName,
char *const  myOutputVarsName,
char *const  myOutputVarsType,
int *const  myNumOutputVars,
char *const  myInputKeys,
int *const  myNumInputKeys,
char *const  myInputVars,
int *const  myNumInputVars,
int *const  myInputVarsType,
int *const  myStrLen 
)

This method will return the input and output variable for EnergyPlus in sequence.

Parameters
fileNamethe variable configuration file name.
myOutputVarsNameArray to store the output variable names found.
myOutputvarsTypeArray to store the output variable types found.
myNumOutputVarsInteger holder to store number of output variables found.
myInputKeysArray to store the input variable keys.
myNumInputKeysInteger holder to store number of input variable keys.
myInputVarsArray to store the name of input variables found.
myNumInputVarsInteger holder to store number of input variables found.
myInputVarsTypeInteger array to store the corresponding input variable types in myInputVars.
myStrLenThe length of the string that is passed to this function.

Definition at line 241 of file util/utilXml.c.

int getepvariablesFMU ( char *const  fileName,
char *const  myOutputVarsName,
char *const  myOutputVarsType,
int *const  myNumOutputVars,
char *const  myInputKeys,
int *const  myNumInputKeys,
char *const  myInputVars,
int *const  myNumInputVars,
int *const  myInputVarsType,
int *const  myStrLen 
)

This method will return the input and output variable for EnergyPlus in sequence.

The difference with getepvariables is that it does not validate the configuration file

Parameters
fileNamethe variable configuration file name.
myOutputVarsNameArray to store the output variable names found.
myOutputvarsTypeArray to store the output variable types found.
myNumOutputVarsInteger holder to store number of output variables found.
myInputKeysArray to store the input variable keys.
myNumInputKeysInteger holder to store number of input variable keys.
myInputVarsArray to store the name of input variables found.
myNumInputVarsInteger holder to store number of input variables found.
myInputVarsTypeInteger array to store the corresponding input variable types in myInputVars.
myStrLenThe length of the string that is passed to this function.

Definition at line 375 of file util/utilXml.c.

References Buff, BUFFSIZE, EPend(), EPstart(), ERROR_STATUS, fprintf(), freeResource(), i, inputKeys, inputVars, inputVarsType, numInputKeys, numInputVars, numOutputVars, outputVarsName, outputVarsType, source, and strLen.

int getnumberofxmlvalues ( char *const  fileName,
char *const  exp 
)

Definition at line 729 of file util/utilXml.c.

int getxmlvalue ( char *const  fileName,
char *const  exp,
char *const  str,
int *const  nVals,
int const  strLen 
)

Definition at line 828 of file util/utilXml.c.

Referenced by getsockethost(), and getsocketportnumber().

int getxmlvalues ( char *const  fileName,
char *const  exp,
char *const  myVals,
int *const  myNumVals,
int const  myStrLen 
)

Definition at line 549 of file util/utilXml.c.

Referenced by getnumberofxmlvalues(), getxmlvalue(), and getxmlvaluesf().

int getxmlvaluesf ( char *const  fileName,
char *const  exp,
char *const  atrName,
int *const  nVal,
char *const  str,
int *const  strLen 
)

This part of the code is for compatibility with the BCVTB version 0.2 and earlier

Definition at line 775 of file util/utilXml.c.

int stackPopBCVTB ( )

Stack operation, this function will pop one element from stack and will free the resource unused.

Definition at line 496 of file util/utilXml.c.

References expStk, fprintf(), Stack::head, and Stack::top.

Referenced by getxmlvalues().

int stackPushBCVTB ( char *  str)

Stack operation, will push one element into the stack and will allocate memory for the new element, hence is deep copy.

Definition at line 513 of file util/utilXml.c.

References expStk, fprintf(), Stack::head, and Stack::top.

Referenced by getxmlvalues().

static void XMLCALL start ( void *  data,
const char *  el,
const char **  attr 
)
static

Call back functions that will be used by the expat xml parser.

This function is used for getxmlvalues

Definition at line 675 of file util/utilXml.c.

References att, Stack::cur, expStk, fprintf(), Stack::head, i, numVals, PARSEVALUE, strcmp(), strLen, Stack::top, and vals.

Referenced by BCVTB.Launcher::getBCVTBRoot(), getxmlvalues(), and BCVTB.Launcher::startProcess().