This is Unofficial EPICS BASE Doxygen Site
traceRecordRegister.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/traceRecord.h"
29 
30 using namespace epics::pvData;
31 using namespace epics::pvAccess;
32 using namespace epics::pvDatabase;
33 using namespace std;
34 
35 static const iocshArg testArg0 = { "recordName", iocshArgString };
36 static const iocshArg *testArgs[] = {
37  &testArg0};
38 
39 static const iocshFuncDef traceRecordFuncDef = {"traceRecordCreate", 1,testArgs};
40 
41 static void traceRecordCallFunc(const iocshArgBuf *args)
42 {
43  char *recordName = args[0].sval;
44  if(!recordName) {
45  throw std::runtime_error("traceRecordCreate invalid number of arguments");
46  }
47  TraceRecordPtr record = TraceRecord::create(recordName);
48  bool result = PVDatabase::getMaster()->addRecord(record);
49  if(!result) cout << "recordname" << " not added" << endl;
50 }
51 
52 static void traceRecordRegister(void)
53 {
54  static int firstTime = 1;
55  if (firstTime) {
56  firstTime = 0;
57  iocshRegister(&traceRecordFuncDef, traceRecordCallFunc);
58  }
59 }
60 
61 extern "C" {
62  epicsExportRegistrar(traceRecordRegister);
63 }
pvac::PutEvent result
Definition: clientSync.cpp:117
Definition: memory.hpp:41
char * sval
Definition: iocsh.h:42
epicsExportRegistrar(traceRecordRegister)
void iocshRegister(const char *name)
Definition: iocshelper.h:105
Holds all PVA related.
Definition: pvif.h:34
pvData
Definition: monitor.h:428
std::tr1::shared_ptr< TraceRecord > TraceRecordPtr
Definition: traceRecord.h:22
C++ and C descriptions for a thread.
Definition: iocsh.h:56
Exporting IOC objects.