X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fengine%2FAnyInputPort.cxx;h=f4df76fbed879b9ad68990429eda9ca00fe91519;hb=ebc32b24303c7f20537c707c77d23e7daa8a20db;hp=f204b5cb84b1459ca358e41a2f95abe48e95bba1;hpb=ffe2d7da964403fe2edd542d509a31e65b82e7b5;p=modules%2Fyacs.git diff --git a/src/engine/AnyInputPort.cxx b/src/engine/AnyInputPort.cxx index f204b5cb8..f4df76fbe 100644 --- a/src/engine/AnyInputPort.cxx +++ b/src/engine/AnyInputPort.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2006-2014 CEA/DEN, EDF R&D +// Copyright (C) 2006-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -26,6 +26,7 @@ #include "YacsTrace.hxx" #include +#include #include using namespace YACS::ENGINE; @@ -83,16 +84,29 @@ void AnyInputPort::exRestoreInit() _value->incrRef(); } -void AnyInputPort::put(Any *data) +void AnyInputPort::releaseDataUnsafe() { - YACS::BASES::AutoLocker lock(&_mutex); if(_value) _value->decrRef(); + _value = nullptr; +} + +void AnyInputPort::releaseData() +{ + YACS::BASES::AutoLocker lock(&_mutex); + releaseDataUnsafe(); +} + +void AnyInputPort::put(Any *data) +{ + YACS::BASES::AutoLocker lock(&_mutex); + releaseDataUnsafe(); _value=data; - if (_value) { - _value->incrRef(); - DEBTRACE("value ref count: " << _value->getRefCnt()); - } + if (_value) + { + _value->incrRef(); + DEBTRACE("value ref count: " << _value->getRefCnt()); + } } bool AnyInputPort::isEmpty() @@ -111,7 +125,7 @@ std::string AnyInputPort::getAsString() return getRuntime()->convertNeutralAsString(edGetType(),_value); } -void AnyInputPort::put(const void *data) throw(ConversionException) +void AnyInputPort::put(const void *data) { put((Any *)data); } @@ -132,7 +146,7 @@ std::string AnyInputPort::dump() switch (_value->getType()->kind()) { case Double: - xmldump << "" << _value->getDoubleValue() << "" << endl; + xmldump << "" << setprecision(16) << _value->getDoubleValue() << "" << endl; break; case Int: xmldump << "" << _value->getIntValue() << "" << endl;