This is Unofficial EPICS BASE Doxygen Site
processRecordRegister.cpp
Go to the documentation of this file.
1 /*
2  * Copyright information and license terms for this software can be
3  * found in the file LICENSE that is included with the distribution
4  */
5 
12 /* Author: Marty Kraimer */
13 
14 #include <epicsThread.h>
15 #include <iocsh.h>
16 #include <pv/event.h>
17 #include <pv/pvAccess.h>
18 #include <pv/serverContext.h>
19 #include <pv/pvData.h>
20 #include <pv/pvTimeStamp.h>
21 #include <pv/rpcService.h>
22 
23 // The following must be the last include for code pvDatabase uses
24 #include <epicsExport.h>
25 #define epicsExportSharedSymbols
26 #include "pv/pvStructureCopy.h"
27 #include "pv/pvDatabase.h"
28 #include "pv/processRecord.h"
29 
30 
31 using namespace epics::pvData;
32 using namespace epics::pvAccess;
33 using namespace epics::pvDatabase;
34 using namespace std;
35 
36 static const iocshArg testArg0 = { "recordName", iocshArgString };
37 static const iocshArg testArg1 = { "delay", iocshArgDouble };
38 static const iocshArg *testArgs[] = {
39  &testArg0,&testArg1};
40 
41 static const iocshFuncDef processRecordFuncDef = {"processRecordCreate", 2,testArgs};
42 
43 static void processRecordCallFunc(const iocshArgBuf *args)
44 {
45  char *recordName = args[0].sval;
46  if(!recordName) {
47  throw std::runtime_error("processRecordCreate invalid number of arguments");
48  }
49  double delay = args[1].dval;
50  if(delay<0.0) delay = 1.0;
51  ProcessRecordPtr record = ProcessRecord::create(recordName,delay);
52  bool result = PVDatabase::getMaster()->addRecord(record);
53  if(!result) cout << "recordname" << " not added" << endl;
54 }
55 
56 static void processRecordRegister(void)
57 {
58  static int firstTime = 1;
59  if (firstTime) {
60  firstTime = 0;
61  iocshRegister(&processRecordFuncDef, processRecordCallFunc);
62  }
63 }
64 
65 extern "C" {
66  epicsExportRegistrar(processRecordRegister);
67 }
pvac::PutEvent result
Definition: clientSync.cpp:117
epicsExportRegistrar(processRecordRegister)
Definition: memory.hpp:41
char * sval
Definition: iocsh.h:42
void iocshRegister(const char *name)
Definition: iocshelper.h:105
Holds all PVA related.
Definition: pvif.h:34
pvData
Definition: monitor.h:428
double dval
Definition: iocsh.h:41
C++ and C descriptions for a thread.
std::tr1::shared_ptr< ProcessRecord > ProcessRecordPtr
Definition: processRecord.h:25
Definition: iocsh.h:56
Exporting IOC objects.