OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
Global Utility Methods

Global utility methods. More...

Collaboration diagram for Global Utility Methods:

Functions

double UCF (int quantity)
 Computes a conversion factor from SWMM's internal units to user's units.
 
int getInt (char *s, int *y)
 Converts a string to an int value.
 
int getFloat (char *s, float *y)
 Converts a string to a float value.
 
int getDouble (char *s, double *y)
 Converts a string to a double precision floating point number.
 
char * getTempFileName (char *fname)
 Creates a temporary file name with path prepended to it.
 
int findmatch (char *s, char *keyword[])
 Finds match between string and array of keyword strings.
 
int match (char *str, char *substr)
 Sees if a sub-string of characters appears in a string (not case sensitive). (not case sensitive).
 
int strcomp (const char *s1, const char *s2)
 Compares two strings (case insensitive).
 
size_t sstrncpy (char *dest, const char *src, size_t n)
 Copies a string to a new memory location in a safe way.
 
size_t sstrcat (char *dest, const char *src, size_t destsize)
 Safe string concatenation.
 
void writecon (const char *s)
 Writes string to console.
 
void getElapsedTime (DateTime aDate, int *days, int *hrs, int *mins)
 Finds elapsed simulation time for a given calendar date.
 
DateTime getDateTime (double elapsedMsec)
 Finds calendar date/time value for elapsed milliseconds of simulation time.
 
char * addAbsolutePath (char *fname)
 Adds an absolute path name to a file name.
 

Detailed Description

Global utility methods.

Function Documentation

◆ addAbsolutePath()

char * addAbsolutePath ( char *  fname)

Adds an absolute path name to a file name.

Parameters
[in]fnamefile name string
Returns
Returns fname with a full path prepended to it
Note
fname must have been dimensioned to accept MAXFNAME characters.
Here is the caller graph for this function:

◆ findmatch()

int findmatch ( char *  s,
char *  keyword[] 
)

Finds match between string and array of keyword strings.

Parameters
[in]sa character string
[in]keywordarray of keyword strings
Returns
Returns index of matching keyword, or -1 if no match found.

Finds match between string and array of keyword strings.

Parameters
[in]sa character string
[in]keywordarray of keyword strings
Returns
Returns index of matching keyword, or -1 if no match found.

Finds match between string and array of keyword strings.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDateTime()

DateTime getDateTime ( double  elapsedMsec)

Finds calendar date/time value for elapsed milliseconds of simulation time.

Parameters
[in]elapsedMsecelapsed time in milliseconds
Returns
Returns a DateTime
Here is the caller graph for this function:

◆ getDouble()

int getDouble ( char *  s,
double *  y 
)

Converts a string to a double precision floating point number.

Parameters
[in]sa character string
[out]yconverted value of s
Returns
Error code. Returns 1 if conversion successful, 0 if not.

Converts a string to a double precision floating point number.

Parameters
[in]sa character string
[out]yconverted value of s
Returns
Error code. Returns 1 if conversion successful, 0 if not.

Converts a string to a double precision floating point number.

Here is the caller graph for this function:

◆ getElapsedTime()

void getElapsedTime ( DateTime  aDate,
int *  days,
int *  hrs,
int *  mins 
)

Finds elapsed simulation time for a given calendar date.

Parameters
[in]aDatea calendar date + time
[out]daysnumber of days since simulation start
[out]hrsnumber of hours since start of current day
[out]minsnumber of minutes since start of current hour
Returns
Returns elapsed simulation time in decimal days
Here is the caller graph for this function:

◆ getFloat()

int getFloat ( char *  s,
float *  y 
)

Converts a string to a float value.

Parameters
[in]sa character string
[out]yconverted value of s
Returns
Error code. Returns 1 if conversion successful, 0 if not.

Converts a string to a float value.

Parameters
[in]sa character string
[out]yconverted value of s
Returns
Error code. Returns 1 if conversion successful, 0 if not.

Converts a string to a float value.

◆ getInt()

int getInt ( char *  s,
int *  y 
)

Converts a string to an int value.

Parameters
[in]sa character string
[out]yconverted value of s
Returns
Error code. Returns 1 if conversion successful, 0 if not.

Converts a string to an int value.

Parameters
[in]sa character string
[out]yconverted value of s
Returns
Error code. Returns 1 if conversion successful, 0 if not.

Converts a string to an int value.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTempFileName()

char * getTempFileName ( char *  fname)

Creates a temporary file name with path prepended to it.

Parameters
[in]fnamefile name string (with max size of MAXFNAME)
Returns
Returns pointer to the temporary file name
Here is the caller graph for this function:

◆ match()

int match ( char *  str,
char *  substr 
)

Sees if a sub-string of characters appears in a string (not case sensitive). (not case sensitive).

Parameters
[in]strcharacter string being searched
[in]substrsub-string being searched for
Returns
Returns 1 if sub-string found, 0 if not.

Sees if a sub-string of characters appears in a string (not case sensitive). (not case sensitive).

Parameters
[in]strcharacter string being searched
[in]substrsub-string being searched for
Returns
Returns 1 if sub-string found, 0 if not.

Sees if a sub-string of characters appears in a string (not case sensitive). (not case sensitive).

Here is the caller graph for this function:

◆ sstrcat()

size_t sstrcat ( char *  dest,
const char *  src,
size_t  destsize 
)

Safe string concatenation.

Parameters
[in,out]deststring to be appended
[in]srcstring to append to dest
[in]destsizeallocated size of dest (including null terminator)
Returns
Returns the size of the concatenated string.
Here is the caller graph for this function:

◆ sstrncpy()

size_t sstrncpy ( char *  dest,
const char *  src,
size_t  n 
)

Copies a string to a new memory location in a safe way.

Parameters
[in]sa character string
[in]srcpointer to source string
[in]nnumber of characters to copy from source string
Returns
Returns the size of the copied string.
Todo:
use portable C version and deprecate
Here is the caller graph for this function:

◆ strcomp()

int strcomp ( const char *  s1,
const char *  s2 
)

Compares two strings (case insensitive).

Parameters
[in]s1first string
[in]s2second string
Returns
Returns 1 if strings are equal (ignoring case), 0 if not.
Here is the caller graph for this function:

◆ UCF()

double UCF ( int  quantity)

Computes a conversion factor from SWMM's internal units to user's units.

Parameters
[in]integercode of quantity being converted
Returns
Returns units conversion factor

◆ writecon()

void writecon ( const char *  s)

Writes string to console.

Parameters
[in]sa character string