fixed possible SEGFAULT in ceateRequest; new stream operator for Field and PVField

This commit is contained in:
Marty Kraimer
2015-02-11 07:26:04 -05:00
parent a277a4fdd5
commit 6cb95c5cfc
10 changed files with 161 additions and 22 deletions

View File

@@ -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();

View File

@@ -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";
}
}

View File

@@ -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";
}
}

View File

@@ -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

View File

@@ -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 */