ISIS Logo
UTILITIES
EPICS Utilities
Functions
utilities.h File Reference
#include <string>
#include <list>
#include <dirent.h>

Go to the source code of this file.

Functions

epicsShareFunc std::string
epicsShareAPI 
setIOCName (const char *iocName)
 
epicsShareFunc std::string
epicsShareAPI 
getIOCName ()
 
epicsShareFunc std::string
epicsShareAPI 
getIOCGroup ()
 
epicsShareFunc std::string
epicsShareAPI 
trimString (const std::string &str)
 
epicsShareFunc int epicsShareAPI compressString (const std::string &str, std::string &comp_str)
 compress a string usinf zlib and then convert compressed bytes into an ascii hex sequence suitable for transmission via an EPICS character waveform record More...
 
epicsShareFunc int epicsShareAPI uncompressString (const std::string &comp_str, std::string &str)
 uncompress a string created using compressString() More...
 
epicsShareFunc int getFileList (const std::string &dirBase, std::list< std::string > &files)
 returns -1 if unable to open directory, else number of items in directory More...
 
epicsShareFunc int filterList (std::list< std::string > &items, const std::string &regex)
 
epicsShareFunc std::string json_list_to_array (std::list< std::string > &items)
 
epicsShareFunc void dbLoadRecordsLoop (const char *dbFile, const char *macros, const char *loopVar, int start, int stop, int step)
 Load a db file multiple times substituting a specified macro according to a number range. More...
 
epicsShareFunc void dbLoadRecordsList (const char *dbFile, const char *macros, const char *loopVar, const char *list, const char *sep)
 Load a db file multiple times according to a list of items separated by known separator(s). More...
 
epicsShareFunc void iocshCmdLoop (const char *command, const char *macros, const char *loopVar, int start, int stop, int step)
 Execute command multiple times substituting a specified macro according to a number range. More...
 
epicsShareFunc void iocshCmdList (const char *command, const char *macros, const char *loopVar, const char *list, const char *sep)
 Execute a command multiple times according to a list of items separated by known separator(s). More...
 
epicsShareFunc int freeIPPort (const char *macro)
 
epicsShareFunc double getProcessUptime (const char *procExecutableName)
 returns -1.0 if process not running, else process uptime in seconds More...
 

Function Documentation

epicsShareFunc int epicsShareAPI compressString ( const std::string &  str,
std::string &  comp_str 
)

compress a string usinf zlib and then convert compressed bytes into an ascii hex sequence suitable for transmission via an EPICS character waveform record

Definition at line 19 of file compress.cpp.

Referenced by main().

epicsShareFunc void dbLoadRecordsList ( const char *  dbFile,
const char *  macros,
const char *  loopVar,
const char *  list,
const char *  sep 
)

Load a db file multiple times according to a list of items separated by known separator(s).

The dbFile and macros arguments are like the normal dbLoadRecords() however it is possible to embed a macro within these whose value takes a value from the list. You can either load the same dbFile multiple times with different macros, or even load different database files by using loopVar as part of the filename. If you want to use a pure numeric range see dbLoadRecordsLoop()

The name of the macro to be used for substitution is contained in loopVar and needs to be reference in an \ escaped way to make sure EPICS does not try to substitute it too soon. as well as the macros the dbFile is also passed the loopVar macro value

* dbLoadRecordsList("file\$(S).db", "P=1,Q=Hello\$(S)", "S", "A;B;C", ";")
*
Parameters
[in]dbFileDB filename.
[in]macrosmacros to pass to dbFile
[in]loopVarlist macro variable name
[in]listlist of values to substitute
[in]seplist value separator character

Definition at line 167 of file dbLoadRecordsFuncs.cpp.

References loadMacEnviron(), and subMacros().

Referenced by dbLoadRecordsListInitCallFunc().

epicsShareFunc void dbLoadRecordsLoop ( const char *  dbFile,
const char *  macros,
const char *  loopVar,
int  start,
int  stop,
int  step 
)

Load a db file multiple times substituting a specified macro according to a number range.

The dbFile and macros arguments are like the normal dbLoadRecords() however it is possible to embed a macro within these whose value follows the range start to stop. You can either load the same dbFile multiple times with different macros, or even load different database files by using loopVar as part of the filename. If you want to use a list of (non-numeric) substitutions rather than an integer range see dbLoadRecordsList()

The name of the macro to be used for substitution is contained in loopVar and needs to be reference in an \ escaped way to make sure EPICS does not try to substitute it too soon. as well as the macros the dbFile is also passed the loopVar macro value

* dbLoadRecordsLoop("file\$(I).db", "P=1,Q=Hello\$(I)", "I", 1, 4)
*
Parameters
[in]dbFileDB filename.
[in]macrosmacros to pass to dbFile
[in]loopVarloop macro variable name
[in]startstart loop value
[in]stopend loop value
[in]steploop step (default: 1)

Definition at line 112 of file dbLoadRecordsFuncs.cpp.

References loadMacEnviron(), and subMacros().

Referenced by dbLoadRecordsLoopInitCallFunc().

epicsShareFunc int filterList ( std::list< std::string > &  items,
const std::string &  regex 
)

Definition at line 44 of file FileList.cpp.

epicsShareFunc int freeIPPort ( const char *  macro)

Definition at line 103 of file freeIPPort.cpp.

References getFreeIPPort().

Referenced by freeIPPortCallFunc().

epicsShareFunc int getFileList ( const std::string &  dirBase,
std::list< std::string > &  files 
)

returns -1 if unable to open directory, else number of items in directory

Definition at line 11 of file FileList.cpp.

References closedir(), dirent::d_name, opendir(), and readdir().

epicsShareFunc std::string epicsShareAPI getIOCGroup ( )

Definition at line 114 of file iocname.cpp.

References setIOCName().

Referenced by groupInitCallFunc().

epicsShareFunc std::string epicsShareAPI getIOCName ( )

Definition at line 103 of file iocname.cpp.

References setIOCName().

Referenced by getInitCallFunc().

epicsShareFunc double getProcessUptime ( const char *  procExecutableName)

returns -1.0 if process not running, else process uptime in seconds

Definition at line 25 of file getProcessUptime.cpp.

References diffFileTimes().

epicsShareFunc void iocshCmdList ( const char *  command,
const char *  macros,
const char *  loopVar,
const char *  list,
const char *  sep 
)

Execute a command multiple times according to a list of items separated by known separator(s).

The command argument is executed, as per the usual EPICS iocshCmd(), but with additional environment variables set according to the macros arguments; however at the end of execution these macros are reset back to their original values. It is possible to embed a changing macro loopVar within this list whose value follows items in list.

The name of the macro to be used for substitution is contained in loopVar and needs to be referenced in an \ escaped way to make sure EPICS does not try to substitute it too soon. As well as the macros the command is also passed the loopVar macro value

* iocshCmdList("< st\$(S).cmd", "P=1,Q=Hello\$(S)", "S", "A;B;C", ";")
*
Parameters
[in]commandcommand string
[in]macrosmacros to pass to command
[in]loopVarlist macro variable name
[in]listlist of values to substitute
[in]seplist value separator character

Definition at line 194 of file iocshCmdFuncs.cpp.

References ioc_getenv(), loadMacEnviron(), and subMacros().

Referenced by iocshCmdListInitCallFunc().

epicsShareFunc void iocshCmdLoop ( const char *  command,
const char *  macros,
const char *  loopVar,
int  start,
int  stop,
int  step 
)

Execute command multiple times substituting a specified macro according to a number range.

The command argument is executed, as per the usual EPICS iocshCmd(), but with additional environment variables set according to the macros arguments; however at the end of execution these macros are reset back to their original values. It is possible to embed a changing macro loopVar within this list whose value follows the range start to stop.

The name of the macro to be used for substitution is contained in loopVar and needs to be referenced in an \ escaped way to make sure EPICS does not try to substitute it too soon. As well as the macros the command is also passed the loopVar macro value

* iocshCmdLoop("< st\$(I).cmd", "P=1,Q=Hello\$(I)", "I", 1, 4)
*
Parameters
[in]commandcommand string
[in]macrosmacros to pass to command
[in]loopVarloop macro variable name
[in]startLoop start value.
[in]stopLoop end value.
[in]stepLoop step (default: 1)

Definition at line 123 of file iocshCmdFuncs.cpp.

References ioc_getenv(), loadMacEnviron(), and subMacros().

Referenced by iocshCmdLoopInitCallFunc().

epicsShareFunc std::string json_list_to_array ( std::list< std::string > &  items)

Definition at line 8 of file json.cpp.

Referenced by main().

epicsShareFunc std::string epicsShareAPI setIOCName ( const char *  iocName)

Definition at line 44 of file iocname.cpp.

Referenced by getIOCGroup(), getIOCName(), and setInitCallFunc().

epicsShareFunc std::string epicsShareAPI trimString ( const std::string &  str)

Definition at line 15 of file trimString.cpp.

epicsShareFunc int epicsShareAPI uncompressString ( const std::string &  comp_str,
std::string &  str 
)

uncompress a string created using compressString()

Definition at line 41 of file compress.cpp.

Referenced by main().

Copyright © 2013 Science and Technology Facilities Council | Generated by   doxygen 1.8.5