Skip to content

Commit

Permalink
Merge branch 'master' into release/4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sveseli committed Mar 22, 2022
2 parents 0c5ccec + 9c400fe commit 44a2f86
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
25 changes: 25 additions & 0 deletions src/pvaccess/PvObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ PvObject::PvObject(const pvd::PVStructurePtr& pvStructurePtr_)
{
}

PvObject::PvObject(const bp::dict& structureDict)
: numPyInitialized(initializeBoostNumPy()),
pvStructurePtr(pvd::getPVDataCreate()->createPVStructure(PyPvDataUtility::createStructureFromDict(structureDict, StructureId))),
dataType(PvType::Structure),
useNumPyArrays(UseNumPyArraysDefault)
{
}

PvObject::PvObject(const bp::dict& structureDict, const std::string& structureId)
: numPyInitialized(initializeBoostNumPy()),
pvStructurePtr(pvd::getPVDataCreate()->createPVStructure(PyPvDataUtility::createStructureFromDict(structureDict, structureId))),
dataType(PvType::Structure),
useNumPyArrays(UseNumPyArraysDefault)
{
}

PvObject::PvObject(const bp::dict& structureDict, const std::string& structureId, const boost::python::dict& structureFieldIdDict)
: numPyInitialized(initializeBoostNumPy()),
pvStructurePtr(pvd::getPVDataCreate()->createPVStructure(PyPvDataUtility::createStructureFromDict(structureDict, structureId, structureFieldIdDict))),
Expand All @@ -57,6 +73,15 @@ PvObject::PvObject(const bp::dict& structureDict, const std::string& structureId
{
}

PvObject::PvObject(const bp::dict& structureDict, const bp::dict& valueDict)
: numPyInitialized(initializeBoostNumPy()),
pvStructurePtr(pvd::getPVDataCreate()->createPVStructure(PyPvDataUtility::createStructureFromDict(structureDict, StructureId))),
dataType(PvType::Structure),
useNumPyArrays(UseNumPyArraysDefault)
{
PyPvDataUtility::pyDictToStructure(valueDict, pvStructurePtr);
}

PvObject::PvObject(const bp::dict& structureDict, const bp::dict& valueDict, const std::string& structureId)
: numPyInitialized(initializeBoostNumPy()),
pvStructurePtr(pvd::getPVDataCreate()->createPVStructure(PyPvDataUtility::createStructureFromDict(structureDict, structureId))),
Expand Down
7 changes: 5 additions & 2 deletions src/pvaccess/PvObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ class PvObject

// Constructors
PvObject(const epics::pvData::PVStructurePtr& pvStructurePtr);
PvObject(const boost::python::dict& structureDict, const std::string& structureId=StructureId, const boost::python::dict& structureFieldIdDict=boost::python::dict());
PvObject(const boost::python::dict& structureDict, const boost::python::dict& valueDict, const std::string& structureId=StructureId);
PvObject(const boost::python::dict& structureDict);
PvObject(const boost::python::dict& structureDict, const std::string& structureId);
PvObject(const boost::python::dict& structureDict, const std::string& structureId, const boost::python::dict& structureFieldIdDict);
PvObject(const boost::python::dict& structureDict, const boost::python::dict& valueDict);
PvObject(const boost::python::dict& structureDict, const boost::python::dict& valueDict, const std::string& structureId);
PvObject(const PvObject& pvObject);

// Destructor
Expand Down
2 changes: 1 addition & 1 deletion src/pvaccess/PyPvDataUtility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ bool updateFieldArrayFromPvObject(const bp::object& pyObject, const std::string&
}
default: {
std::string structureFieldId = PyUtility::extractKeyValueFromPyDict<std::string>(fieldName, structureFieldIdDict, std::string());
addStructureField(fieldName, pvObject, fields, names, structureFieldId);
addStructureField(fieldName, pvObject, fields, names);
}
}
return true;
Expand Down

0 comments on commit 44a2f86

Please sign in to comment.