This is Unofficial EPICS BASE Doxygen Site
removeRecordRegister.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 #include <epicsThread.h>
14 #include <iocsh.h>
15 #include <pv/event.h>
16 #include <pv/pvAccess.h>
17 #include <pv/serverContext.h>
18 #include <pv/pvData.h>
19 #include <pv/pvTimeStamp.h>
20 #include <pv/rpcService.h>
21 
22 // The following must be the last include for code pvDatabase uses
23 #include <epicsExport.h>
24 #define epicsExportSharedSymbols
25 #include "pv/pvStructureCopy.h"
26 #include "pv/pvDatabase.h"
27 #include "pv/removeRecord.h"
28 
29 using namespace epics::pvData;
30 using namespace epics::pvAccess;
31 using namespace epics::pvDatabase;
32 using namespace std;
33 
34 static const iocshArg testArg0 = { "recordName", iocshArgString };
35 static const iocshArg *testArgs[] = {
36  &testArg0};
37 
38 static const iocshFuncDef removeRecordFuncDef = {"removeRecordCreate", 1,testArgs};
39 
40 static void removeRecordCallFunc(const iocshArgBuf *args)
41 {
42  char *recordName = args[0].sval;
43  if(!recordName) {
44  throw std::runtime_error("removeRecordCreate invalid number of arguments");
45  }
46  RemoveRecordPtr record = RemoveRecord::create(recordName);
47  bool result = PVDatabase::getMaster()->addRecord(record);
48  if(!result) cout << "recordname" << " not added" << endl;
49 }
50 
51 static void removeRecordRegister(void)
52 {
53  static int firstTime = 1;
54  if (firstTime) {
55  firstTime = 0;
56  iocshRegister(&removeRecordFuncDef, removeRecordCallFunc);
57  }
58 }
59 
60 extern "C" {
61  epicsExportRegistrar(removeRecordRegister);
62 }
pvac::PutEvent result
Definition: clientSync.cpp:117
std::tr1::shared_ptr< RemoveRecord > RemoveRecordPtr
Definition: removeRecord.h:21
Definition: memory.hpp:41
char * sval
Definition: iocsh.h:42
epicsExportRegistrar(removeRecordRegister)
void iocshRegister(const char *name)
Definition: iocshelper.h:105
Holds all PVA related.
Definition: pvif.h:34
pvData
Definition: monitor.h:428
C++ and C descriptions for a thread.
Definition: iocsh.h:56
Exporting IOC objects.