30 #define epicsExportSharedSymbols 40 namespace epics {
namespace pvDatabase {
43 std::string
const & recordName)
48 addNestedStructure(
"argument")->
50 addNestedUnion(
"union") ->
53 addNestedStructure(
"result") ->
57 PVStructurePtr pvStructure = pvDataCreate->createPVStructure(topStructure);
60 if(!pvRecord->init()) pvRecord.reset();
65 std::string
const & recordName,
71 bool AddRecord::init()
75 pvRecordName = pvStructure->getSubField<
PVString>(
"argument.recordName");
76 if(!pvRecordName)
return false;
77 pvResult = pvStructure->getSubField<
PVString>(
"result.status");
78 if(!pvResult)
return false;
82 void AddRecord::process()
85 string name = pvRecordName->get();
86 PVRecordPtr pvRecord = PVDatabase::getMaster()->findRecord(name);
88 pvResult->put(name +
" already exists");
93 pvResult->put(name +
" argument.union is NULL");
98 pvResult->put(name +
" union has no value");
102 pvResult->put(name +
" union most be a structure");
107 PVRecordPtr pvRec = PVRecord::create(name,pvStructure);
108 bool result = PVDatabase::getMaster()->addRecord(pvRec);
110 pvResult->put(
"success");
112 pvResult->put(
"failure");
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
TODO only here because of the Lockable.
std::tr1::shared_ptr< const Structure > StructureConstPtr
std::tr1::shared_ptr< AddRecord > AddRecordPtr
Base interface for a PVRecord.
std::tr1::shared_ptr< PVDataCreate > PVDataCreatePtr
PVString is special case, since it implements SerializableArray.
std::tr1::shared_ptr< PVUnion > PVUnionPtr
This class implements introspection object for a structure.
PVUnion has a single subfield.
Add another record in the same database.
FORCE_INLINE const FieldCreatePtr & getFieldCreate()
std::tr1::shared_ptr< PVRecord > PVRecordPtr
std::tr1::shared_ptr< PVStructure > PVStructurePtr
std::tr1::shared_ptr< PVField > PVFieldPtr
std::tr1::shared_ptr< FieldCreate > FieldCreatePtr
FORCE_INLINE const PVDataCreatePtr & getPVDataCreate()