more work in examples; documentation is now up to date
This commit is contained in:
@@ -17,6 +17,7 @@ exampleDatabaseMain_LIBS += pvData
|
||||
exampleDatabaseMain_LIBS += pvAccess
|
||||
exampleDatabaseMain_LIBS += pvDatabase
|
||||
exampleDatabaseMain_LIBS += exampleDatabase
|
||||
exampleDatabaseMain_LIBS += powerSupply
|
||||
|
||||
DBD += exampleDatabase.dbd
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <pv/standardField.h>
|
||||
#include <pv/standardPVField.h>
|
||||
#include <pv/powerSupplyRecordTest.h>
|
||||
#include <pv/powerSupply.h>
|
||||
#include <pv/channelProviderLocal.h>
|
||||
#include <pv/recordList.h>
|
||||
#include <pv/traceRecord.h>
|
||||
@@ -39,28 +39,6 @@ static StandardFieldPtr standardField = getStandardField();
|
||||
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
|
||||
static StandardPVFieldPtr standardPVField = getStandardPVField();
|
||||
|
||||
static PVStructurePtr createPowerSupply()
|
||||
{
|
||||
size_t nfields = 5;
|
||||
StringArray names;
|
||||
names.reserve(nfields);
|
||||
FieldConstPtrArray powerSupply;
|
||||
powerSupply.reserve(nfields);
|
||||
names.push_back("alarm");
|
||||
powerSupply.push_back(standardField->alarm());
|
||||
names.push_back("timeStamp");
|
||||
powerSupply.push_back(standardField->timeStamp());
|
||||
String properties("alarm,display");
|
||||
names.push_back("voltage");
|
||||
powerSupply.push_back(standardField->scalar(pvDouble,properties));
|
||||
names.push_back("power");
|
||||
powerSupply.push_back(standardField->scalar(pvDouble,properties));
|
||||
names.push_back("current");
|
||||
powerSupply.push_back(standardField->scalar(pvDouble,properties));
|
||||
return pvDataCreate->createPVStructure(
|
||||
fieldCreate->createStructure(names,powerSupply));
|
||||
}
|
||||
|
||||
static void createStructureArrayRecord(
|
||||
PVDatabasePtr const &master,
|
||||
ScalarType scalarType,
|
||||
@@ -122,10 +100,10 @@ void ExampleDatabase::create()
|
||||
createStructureArrayRecord(master,pvDouble,"exampleStructureArray");
|
||||
recordName = "examplePowerSupply";
|
||||
PVStructurePtr pvStructure = createPowerSupply();
|
||||
PowerSupplyRecordTestPtr psr =
|
||||
PowerSupplyRecordTest::create(recordName,pvStructure);
|
||||
PowerSupplyPtr psr =
|
||||
PowerSupply::create(recordName,pvStructure);
|
||||
if(psr.get()==NULL) {
|
||||
cout << "PowerSupplyRecordTest::create failed" << endl;
|
||||
cout << "PowerSupply::create failed" << endl;
|
||||
return;
|
||||
}
|
||||
result = master->addRecord(psr);
|
||||
|
||||
@@ -42,9 +42,6 @@ int main(int argc,char *argv[])
|
||||
String buffer;
|
||||
pvNames->toString(&buffer);
|
||||
cout << "recordNames" << endl << buffer << endl;
|
||||
PVRecordPtr pvRecord = master->findRecord("laptoprecordListPGRPC");
|
||||
PVStructurePtr pvStructure = pvRecord->getPVRecordStructure()->getPVStructure();
|
||||
cout << "PVStructure" << endl << pvStructure->dumpValue(cout) << endl;
|
||||
string str;
|
||||
while(true) {
|
||||
cout << "Type exit to stop: \n";
|
||||
|
||||
Reference in New Issue
Block a user