Skip to content

Commit 9d8546b

Browse files
committed
BUG: Rework API for DataMap and DeepCopy in DataObject.
We need to be able to report errors back up the call tree if possible. Signed-off-by: Michael Jackson <[email protected]>
1 parent f0e0eb7 commit 9d8546b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/simplnx/DataStructure/AttributeMatrix.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ bool AttributeMatrix::canInsert(const DataObject* obj) const
9696

9797
const usize totalTuples = std::accumulate(m_TupleShape.cbegin(), m_TupleShape.cend(), static_cast<usize>(1), std::multiplies<>());
9898
const usize incomingTupleCount = std::accumulate(arrayTupleShape.cbegin(), arrayTupleShape.cend(), static_cast<usize>(1), std::multiplies<>());
99-
99+
if(totalTuples != incomingTupleCount)
100+
{
101+
std::cout << "AttributeMatrix: CanInsert() Failed with object " << obj->getName() << ". totalTuples=" << totalTuples << " incomingTupleCount=" << incomingTupleCount << "\n";
102+
}
100103
return (totalTuples == incomingTupleCount);
101104
}
102105

src/simplnx/DataStructure/DataMap.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ DataMap DataMap::deepCopy(const DataPath& parentCopyPath) const
3030
{
3131
const auto& dataObj = m_Map.at(key);
3232
const auto copy = dataObj->deepCopy(parentCopyPath.createChildPath(dataObj->getName()));
33+
if(copy == nullptr)
34+
{
35+
throw std::runtime_error(fmt::format("A deep copy request for parent '{}' failed on child object '{}' ", parentCopyPath.toString(), dataObj->getName()));
36+
}
3337
dataMap.m_Map[key] = copy;
3438
}
3539
return dataMap;

0 commit comments

Comments
 (0)