summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-09-08 19:27:55 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-09-08 19:27:55 +0100
commitfab945d0c0f403cbd4e459f8b9ab7d1880b34f83 (patch)
tree5a020b79ac0cbb5e100f03a83241e21df880b8d2
parentModelPartForOptionalBase::GetValue need not be a template (diff)
downloadslicer-fab945d0c0f403cbd4e459f8b9ab7d1880b34f83.tar.bz2
slicer-fab945d0c0f403cbd4e459f8b9ab7d1880b34f83.tar.xz
slicer-fab945d0c0f403cbd4e459f8b9ab7d1880b34f83.zip
Use built-in Ice read/write for optionals
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h16
1 files changed, 2 insertions, 14 deletions
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index 0342cb0..77d542d 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -134,12 +134,8 @@ namespace Slicer {
typeWrite(::Ice::OutputStream & s, const ::Ice::optional<T> & m)
{
if constexpr (!isLocal<T>::value) {
- using traits = Ice::StreamableTraits<T>;
- using SOH = Ice::StreamOptionalHelper<T, traits::helper, traits::fixedLength>;
s.startEncapsulation();
- if (m && s.writeOptional(0, SOH::optionalFormat)) {
- SOH::write(&s, *m);
- }
+ s.write(0, m);
s.endEncapsulation();
}
else {
@@ -164,16 +160,8 @@ namespace Slicer {
typeRead(::Ice::InputStream & s, ::Ice::optional<T> & m)
{
if constexpr (!isLocal<T>::value) {
- using traits = Ice::StreamableTraits<T>;
- using SOH = Ice::StreamOptionalHelper<T, traits::helper, traits::fixedLength>;
s.startEncapsulation();
- if (s.readOptional(0, SOH::optionalFormat)) {
- m = T();
- SOH::read(&s, *m);
- }
- else {
- m = IceUtil::None;
- }
+ s.read(0, m);
s.endEncapsulation();
}
else {