Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions src/backend/PatchRecordComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,24 +143,26 @@ void PatchRecordComponent::flush(

void PatchRecordComponent::read()
{
Parameter<Operation::READ_ATT> aRead;

aRead.name = "unitSI";
IOHandler()->enqueue(IOTask(this, aRead));
IOHandler()->flush(internal::defaultFlushParams);
if (auto val = Attribute(*aRead.resource).getOptional<double>();
val.has_value())
setUnitSI(val.value());
else
throw error::ReadError(
error::AffectedObject::Attribute,
error::Reason::UnexpectedContent,
{},
"Unexpected Attribute datatype for 'unitSI' (expected double, "
"found " +
datatypeToString(Attribute(*aRead.resource).dtype) + ")");

readAttributes(ReadMode::FullyReread); // this will set dirty() = false

if (containsAttribute("unitSI"))
{
if (auto val = getAttribute("unitSI").getOptional<double>();
val.has_value())
{
setUnitSI(val.value());
}
else
{
throw error::ReadError(
error::AffectedObject::Attribute,
error::Reason::UnexpectedContent,
{},
"Unexpected Attribute datatype for 'unitSI' (expected double, "
"found " +
datatypeToString(getAttribute("unitSI").dtype) + ")");
}
}
}

bool PatchRecordComponent::dirtyRecursive() const
Expand Down