Building Controls Virtual Test Bed
util/utilXml.h File Reference
#include <stdio.h>
#include <string.h>
#include <expat.h>
Include dependency graph for util/utilXml.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Stack
 

Macros

#define XML_FMT_INT_MOD   "l"
 
#define BUFFSIZE   8192
 

Typedefs

typedef struct Stack Stack
 

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...
 

Variables

char Buff [BUFFSIZE]
 Local buffer for reading in the xml file. More...
 
Stack expStk
 Variables for getxmlvalue function. More...
 
char * att
 Local global variable for function getxmlvalue. More...
 
char * vals
 Local global variable for function getxmlvalue. More...
 
int * numVals
 Local global variable for function getxmlvalue. More...
 
int PARSEVALUE
 flag for parsing xml values 1 if parse, 0 if not parse More...
 
int ERROR_STATUS
 flag for xml element handler error status settings More...
 
char * outputVarsName
 local global variables for function getepvariables More...
 
char * outputVarsType
 the string pointer to the parsed output variable types More...
 
int * numOutputVars
 the integer pointer to the number of output variables More...
 
char * inputVars
 the string pointer to the input variables More...
 
int * numInputVars
 the integer pointer to the number of input variables More...
 
int * inputVarsType
 the ineger array to store the types of each input variables More...
 
char ** inputKeys
 the string array to store the types of input variable types More...
 
int numInputKeys
 the number of input variable types More...
 
int source
 flag for function /c getepvariables 0=EnergyPlus, 1=Ptolemy More...
 
const int * strLen
 the length of string parsed to this function More...
 

Macro Definition Documentation

#define BUFFSIZE   8192

Definition at line 125 of file util/utilXml.h.

Referenced by getepvariables(), getepvariablesFMU(), and getxmlvalues().

#define XML_FMT_INT_MOD   "l"

Definition at line 121 of file util/utilXml.h.

Typedef Documentation

typedef struct Stack Stack

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.

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

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

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

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.

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.

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

Variable Documentation

char* att

Local global variable for function getxmlvalue.

Definition at line 141 of file util/utilXml.h.

Referenced by getxmlvalues(), and start().

char Buff[BUFFSIZE]

Local buffer for reading in the xml file.

Definition at line 127 of file util/utilXml.h.

Referenced by getepvariables(), getepvariablesFMU(), and getxmlvalues().

int ERROR_STATUS

flag for xml element handler error status settings

Definition at line 145 of file util/utilXml.h.

Referenced by EPstart(), getepvariables(), and getepvariablesFMU().

Stack expStk

Variables for getxmlvalue function.

Definition at line 139 of file util/utilXml.h.

Referenced by end(), getxmlvalues(), stackPopBCVTB(), stackPushBCVTB(), and start().

char** inputKeys

the string array to store the types of input variable types

Definition at line 156 of file util/utilXml.h.

Referenced by EPstart(), getepvariables(), and getepvariablesFMU().

char* inputVars

the string pointer to the input variables

Definition at line 153 of file util/utilXml.h.

Referenced by EPstart(), getepvariables(), and getepvariablesFMU().

int* inputVarsType

the ineger array to store the types of each input variables

Definition at line 155 of file util/utilXml.h.

Referenced by EPstart(), getepvariables(), and getepvariablesFMU().

int numInputKeys

the number of input variable types

Definition at line 157 of file util/utilXml.h.

Referenced by EPstart(), getepvariables(), and getepvariablesFMU().

int* numInputVars

the integer pointer to the number of input variables

Definition at line 154 of file util/utilXml.h.

Referenced by EPstart(), getepvariables(), and getepvariablesFMU().

int* numOutputVars

the integer pointer to the number of output variables

Definition at line 152 of file util/utilXml.h.

Referenced by EPstart(), getepvariables(), and getepvariablesFMU().

int* numVals

Local global variable for function getxmlvalue.

Definition at line 143 of file util/utilXml.h.

Referenced by getxmlvalues(), and start().

char* outputVarsName

local global variables for function getepvariables

the string pointer to the parsed output variable names

Definition at line 150 of file util/utilXml.h.

Referenced by EPstart(), getepvariables(), and getepvariablesFMU().

char* outputVarsType

the string pointer to the parsed output variable types

Definition at line 151 of file util/utilXml.h.

Referenced by EPstart(), getepvariables(), and getepvariablesFMU().

int PARSEVALUE

flag for parsing xml values 1 if parse, 0 if not parse

Definition at line 144 of file util/utilXml.h.

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

int source
char* vals

Local global variable for function getxmlvalue.

Definition at line 142 of file util/utilXml.h.

Referenced by getxmlvalues(), and start().