ISIS Logo
UTILITIES
EPICS Utilities
Functions | Variables
dbLoadRecordsFuncs.cpp File Reference

Enhanced EPICS dbLoadRecords functions. More...

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <math.h>
#include <exception>
#include <algorithm>
#include <stdexcept>
#include <iostream>
#include <map>
#include <list>
#include <string>
#include <time.h>
#include <sstream>
#include <fstream>
#include <unistd.h>
#include "epicsStdlib.h"
#include "epicsString.h"
#include "epicsStdio.h"
#include "dbDefs.h"
#include "epicsMutex.h"
#include "dbBase.h"
#include "dbStaticLib.h"
#include "dbFldTypes.h"
#include "dbCommon.h"
#include "dbAccessDefs.h"
#include <epicsTypes.h>
#include <epicsTime.h>
#include <epicsThread.h>
#include <epicsTimer.h>
#include <iocsh.h>
#include "envDefs.h"
#include "macLib.h"
#include "errlog.h"
#include <registryFunction.h>
#include <epicsExport.h>
#include "utilities.h"

Go to the source code of this file.

Functions

static void loadMacEnviron (MAC_HANDLE *pmh)
 load current environment into mac handle More...
 
static void subMacros (std::string &new_macros, const char *macros, const char *loopVar)
 look for e.g. $(I) and replace with so we can substitute later with macEnvExpand() More...
 
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...
 
static void dbLoadRecordsLoopInitCallFunc (const iocshArgBuf *args)
 
static void dbLoadRecordsListInitCallFunc (const iocshArgBuf *args)
 
static void dbLoadRecordsFuncsRegister (void)
 
 epicsExportRegistrar (dbLoadRecordsFuncsRegister)
 

Variables

static const iocshArg dbLoadRecordsLoopInitArg0 = { "dbFile", iocshArgString }
 DB filename. More...
 
static const iocshArg dbLoadRecordsLoopInitArg1 = { "macros", iocshArgString }
 macros to pass to dbFile More...
 
static const iocshArg dbLoadRecordsLoopInitArg2 = { "loopVar", iocshArgString }
 loop macro variable name More...
 
static const iocshArg dbLoadRecordsLoopInitArg3 = { "start", iocshArgInt }
 start loop value More...
 
static const iocshArg dbLoadRecordsLoopInitArg4 = { "stop", iocshArgInt }
 end loop value More...
 
static const iocshArg dbLoadRecordsLoopInitArg5 = { "step", iocshArgInt }
 loop step (default: 1) More...
 
static const iocshArg *const dbLoadRecordsLoopInitArgs []
 
static const iocshArg dbLoadRecordsListInitArg0 = { "dbFile", iocshArgString }
 DB filename. More...
 
static const iocshArg dbLoadRecordsListInitArg1 = { "macros", iocshArgString }
 macros to pass to dbFile More...
 
static const iocshArg dbLoadRecordsListInitArg2 = { "loopVar", iocshArgString }
 list macro variable name More...
 
static const iocshArg dbLoadRecordsListInitArg3 = { "list", iocshArgString }
 list of values to substitute More...
 
static const iocshArg dbLoadRecordsListInitArg4 = { "sep", iocshArgString }
 list value separator character More...
 
static const iocshArg *const dbLoadRecordsListInitArgs []
 
static const iocshFuncDef dbLoadRecordsLoopDef = {"dbLoadRecordsLoop", sizeof(dbLoadRecordsLoopInitArgs) / sizeof(iocshArg*), dbLoadRecordsLoopInitArgs}
 
static const iocshFuncDef dbLoadRecordsListDef = {"dbLoadRecordsList", sizeof(dbLoadRecordsListInitArgs) / sizeof(iocshArg*), dbLoadRecordsListInitArgs}
 

Detailed Description

Enhanced EPICS dbLoadRecords functions.

Author
Freddie Akeroyd, STFC ISIS Facility fredd.nosp@m.ie.a.nosp@m.keroy.nosp@m.d@st.nosp@m.fc.ac.nosp@m..uk

Definition in file dbLoadRecordsFuncs.cpp.

Function Documentation

static void dbLoadRecordsFuncsRegister ( void  )
static
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
Examples:
st.cmd.

Definition at line 167 of file dbLoadRecordsFuncs.cpp.

References loadMacEnviron(), and subMacros().

Referenced by dbLoadRecordsListInitCallFunc().

static void dbLoadRecordsListInitCallFunc ( const iocshArgBuf *  args)
static

Definition at line 236 of file dbLoadRecordsFuncs.cpp.

References dbLoadRecordsList().

Referenced by dbLoadRecordsFuncsRegister().

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)
Examples:
st.cmd.

Definition at line 112 of file dbLoadRecordsFuncs.cpp.

References loadMacEnviron(), and subMacros().

Referenced by dbLoadRecordsLoopInitCallFunc().

static void dbLoadRecordsLoopInitCallFunc ( const iocshArgBuf *  args)
static

Definition at line 231 of file dbLoadRecordsFuncs.cpp.

References dbLoadRecordsLoop().

Referenced by dbLoadRecordsFuncsRegister().

epicsExportRegistrar ( dbLoadRecordsFuncsRegister  )
static void loadMacEnviron ( MAC_HANDLE *  pmh)
static

load current environment into mac handle

Definition at line 53 of file dbLoadRecordsFuncs.cpp.

Referenced by dbLoadRecordsList(), and dbLoadRecordsLoop().

static void subMacros ( std::string &  new_macros,
const char *  macros,
const char *  loopVar 
)
static

look for e.g. $(I) and replace with so we can substitute later with macEnvExpand()

Definition at line 69 of file dbLoadRecordsFuncs.cpp.

Referenced by dbLoadRecordsList(), and dbLoadRecordsLoop().

Variable Documentation

const iocshFuncDef dbLoadRecordsListDef = {"dbLoadRecordsList", sizeof(dbLoadRecordsListInitArgs) / sizeof(iocshArg*), dbLoadRecordsListInitArgs}
static

Definition at line 229 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsListInitArg0 = { "dbFile", iocshArgString }
static

DB filename.

Definition at line 219 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsListInitArg1 = { "macros", iocshArgString }
static

macros to pass to dbFile

Definition at line 220 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsListInitArg2 = { "loopVar", iocshArgString }
static

list macro variable name

Definition at line 221 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsListInitArg3 = { "list", iocshArgString }
static

list of values to substitute

Definition at line 222 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsListInitArg4 = { "sep", iocshArgString }
static

list value separator character

Definition at line 223 of file dbLoadRecordsFuncs.cpp.

const iocshArg* const dbLoadRecordsListInitArgs[]
static
Initial value:
static const iocshArg dbLoadRecordsListInitArg1
macros to pass to dbFile
static const iocshArg dbLoadRecordsListInitArg2
list macro variable name
static const iocshArg dbLoadRecordsListInitArg4
list value separator character
static const iocshArg dbLoadRecordsListInitArg3
list of values to substitute
static const iocshArg dbLoadRecordsListInitArg0
DB filename.

Definition at line 224 of file dbLoadRecordsFuncs.cpp.

const iocshFuncDef dbLoadRecordsLoopDef = {"dbLoadRecordsLoop", sizeof(dbLoadRecordsLoopInitArgs) / sizeof(iocshArg*), dbLoadRecordsLoopInitArgs}
static

Definition at line 227 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsLoopInitArg0 = { "dbFile", iocshArgString }
static

DB filename.

Definition at line 210 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsLoopInitArg1 = { "macros", iocshArgString }
static

macros to pass to dbFile

Definition at line 211 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsLoopInitArg2 = { "loopVar", iocshArgString }
static

loop macro variable name

Definition at line 212 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsLoopInitArg3 = { "start", iocshArgInt }
static

start loop value

Definition at line 213 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsLoopInitArg4 = { "stop", iocshArgInt }
static

end loop value

Definition at line 214 of file dbLoadRecordsFuncs.cpp.

const iocshArg dbLoadRecordsLoopInitArg5 = { "step", iocshArgInt }
static

loop step (default: 1)

Definition at line 215 of file dbLoadRecordsFuncs.cpp.

const iocshArg* const dbLoadRecordsLoopInitArgs[]
static
Initial value:
static const iocshArg dbLoadRecordsLoopInitArg3
start loop value
static const iocshArg dbLoadRecordsLoopInitArg0
DB filename.
static const iocshArg dbLoadRecordsLoopInitArg2
loop macro variable name
static const iocshArg dbLoadRecordsLoopInitArg1
macros to pass to dbFile
static const iocshArg dbLoadRecordsLoopInitArg5
loop step (default: 1)
static const iocshArg dbLoadRecordsLoopInitArg4
end loop value

Definition at line 216 of file dbLoadRecordsFuncs.cpp.

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