move all examples to separate top level build areas.

Documentation needs updating.
This commit is contained in:
Marty Kraimer
2014-02-05 11:57:35 -05:00
parent 5d0718ab3a
commit 94bd84211b
116 changed files with 879 additions and 845 deletions

View File

@@ -0,0 +1,79 @@
/* exampleServer.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
* @date 2013.04.02
*/
#include <pv/standardPVField.h>
#include <pv/exampleServer.h>
namespace epics { namespace exampleServer {
using namespace epics::pvData;
using namespace epics::pvDatabase;
using std::tr1::static_pointer_cast;
ExampleServerPtr ExampleServer::create(
String const & recordName)
{
StandardPVFieldPtr standardPVField = getStandardPVField();
PVDataCreatePtr pvDataCreate = getPVDataCreate();
PVStructurePtr pvArgument = standardPVField->scalar(pvString,"");
PVStructurePtr pvResult = standardPVField->scalar(pvString,"timeStamp");
StringArray names;
names.reserve(2);
PVFieldPtrArray fields;
fields.reserve(2);
names.push_back("argument");
fields.push_back(pvArgument);
names.push_back("result");
fields.push_back(pvResult);
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(names,fields);
ExampleServerPtr pvRecord(
new ExampleServer(recordName,pvStructure));
if(!pvRecord->init()) pvRecord.reset();
return pvRecord;
}
ExampleServer::ExampleServer(
String const & recordName,
PVStructurePtr const & pvStructure)
: PVRecord(recordName,pvStructure)
{
}
ExampleServer::~ExampleServer()
{
}
void ExampleServer::destroy()
{
PVRecord::destroy();
}
bool ExampleServer::init()
{
initPVRecord();
PVFieldPtr pvField;
pvArgumentValue = getPVStructure()->getStringField("argument.value");
if(pvArgumentValue.get()==NULL) return false;
pvResultValue = getPVStructure()->getStringField("result.value");
if(pvResultValue.get()==NULL) return false;
pvTimeStamp.attach(getPVStructure()->getSubField("result.timeStamp"));
return true;
}
void ExampleServer::process()
{
pvResultValue->put(String("Hello ") + pvArgumentValue->get());
timeStamp.getCurrent();
pvTimeStamp.set(timeStamp);
}
}}