more work on examples; documentation is only changed up to exampleServer

This commit is contained in:
Marty Kraimer
2014-02-06 16:46:47 -05:00
parent 94bd84211b
commit 9a798bc05a
81 changed files with 2361 additions and 605 deletions

View File

@@ -9,17 +9,26 @@ include $(TOP)/configure/CONFIG
# Build an IOC support library
#
PROD_HOST += exampleServerMain
exampleServerMain_SRCS += exampleServerMain.cpp
exampleServerMain_LIBS += Com
exampleServerMain_LIBS += pvData
exampleServerMain_LIBS += pvAccess
exampleServerMain_LIBS += pvDatabase
exampleServerMain_LIBS += exampleServer
DBD += exampleServer.dbd
INC += exampleServer.h
LIBRARY_IOC += exampleServerSupport
exampleServerSupport_SRCS += exampleServer.cpp
exampleServerSupport_SRCS += exampleServerRegister.cpp
exampleServerSupport_LIBS += pvData
exampleServerSupport_LIBS += pvAccess
exampleServerSupport_LIBS += pvDatabase
exampleServerSupport_LIBS += $(EPICS_BASE_IOC_LIBS)
LIBRARY_IOC += exampleServer
exampleServer_SRCS += exampleServer.cpp
exampleServer_SRCS += exampleServerRegister.cpp
exampleServer_LIBS += pvData
exampleServer_LIBS += pvAccess
exampleServer_LIBS += pvDatabase
exampleServer_LIBS += $(EPICS_BASE_IOC_LIBS)
#===========================

View File

@@ -0,0 +1,67 @@
/*ExampleServerMain.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author mrk
*/
/* Author: Marty Kraimer */
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include <memory>
#include <iostream>
#include <pv/standardField.h>
#include <pv/standardPVField.h>
#include <pv/exampleServer.h>
#include <pv/traceRecord.h>
#include <pv/channelProviderLocal.h>
#include <pv/serverContext.h>
using namespace std;
using std::tr1::static_pointer_cast;
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::pvDatabase;
using namespace epics::exampleServer;
int main(int argc,char *argv[])
{
PVDatabasePtr master = PVDatabase::getMaster();
ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
PVRecordPtr pvRecord;
bool result(false);
String recordName;
recordName = "exampleServer";
pvRecord = ExampleServer::create(recordName);
result = master->addRecord(pvRecord);
cout << "result of addRecord " << recordName << " " << result << endl;
recordName = "traceRecordPGRPC";
pvRecord = TraceRecord::create(recordName);
result = master->addRecord(pvRecord);
if(!result) cout<< "record " << recordName << " not added" << endl;
pvRecord.reset();
ServerContext::shared_pointer pvaServer =
startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true);
cout << "exampleServer\n";
string str;
while(true) {
cout << "Type exit to stop: \n";
getline(cin,str);
if(str.compare("exit")==0) break;
}
pvaServer->shutdown();
epicsThreadSleep(1.0);
pvaServer->destroy();
channelProvider->destroy();
return 0;
}