fixed possible SEGFAULT in ceateRequest; new stream operator for Field and PVField
This commit is contained in:
@@ -454,12 +454,14 @@ public:
|
||||
}
|
||||
}
|
||||
StructureConstPtr structure = fieldCreate->createStructure(names, fields);
|
||||
if(!structure) throw std::invalid_argument("bad request " + crequest);
|
||||
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(structure);
|
||||
for(size_t i=0; i<optionList.size(); ++i) {
|
||||
OptionPair pair = optionList[i];
|
||||
string name = pair.name;
|
||||
string value = pair.value;
|
||||
PVStringPtr pvField = pvStructure->getSubField<PVString>(name);
|
||||
if(!pvField) throw std::invalid_argument("bad request " + crequest);
|
||||
pvField->put(value);
|
||||
}
|
||||
optionList.clear();
|
||||
|
||||
@@ -1230,3 +1230,12 @@ FieldCreatePtr getFieldCreate() {
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
namespace std{
|
||||
std::ostream& operator<<(std::ostream& o, const epics::pvData::Field *ptr)
|
||||
{
|
||||
if(ptr) return o << *ptr;
|
||||
return o << "nullptr";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -741,3 +741,12 @@ PVDataCreatePtr getPVDataCreate() {
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
namespace std{
|
||||
std::ostream& operator<<(std::ostream& o, const epics::pvData::PVField *ptr)
|
||||
{
|
||||
if(ptr) return o << *ptr;
|
||||
return o << "nullptr";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1565,6 +1565,14 @@ private:
|
||||
epicsShareExtern PVDataCreatePtr getPVDataCreate();
|
||||
|
||||
}}
|
||||
|
||||
/**
|
||||
* stream support for pvField
|
||||
*/
|
||||
namespace std{
|
||||
std::ostream& operator<<(std::ostream& o, const epics::pvData::PVField *ptr);
|
||||
}
|
||||
|
||||
#endif /* PVDATA_H */
|
||||
|
||||
/** @page Overview Documentation
|
||||
|
||||
@@ -1220,4 +1220,12 @@ struct StructureArrayHashFunction {
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
/**
|
||||
* stream support for Field
|
||||
*/
|
||||
namespace std{
|
||||
std::ostream& operator<<(std::ostream& o, const epics::pvData::Field *ptr);
|
||||
}
|
||||
|
||||
#endif /* PVINTROSPECT_H */
|
||||
|
||||
Reference in New Issue
Block a user