-// Copyright (C) 2006-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2019 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
#include "YacsTrace.hxx"
#include <iostream>
+#include <iomanip>
#include <sstream>
using namespace YACS::ENGINE;
_value->incrRef();
}
-void AnyInputPort::put(Any *data)
+void AnyInputPort::releaseDataUnsafe()
{
- YACS::BASES::AutoLocker<YACS::BASES::Mutex> lock(&_mutex);
if(_value)
_value->decrRef();
+ _value = nullptr;
+}
+
+void AnyInputPort::releaseData()
+{
+ YACS::BASES::AutoLocker<YACS::BASES::Mutex> lock(&_mutex);
+ releaseDataUnsafe();
+}
+
+void AnyInputPort::put(Any *data)
+{
+ YACS::BASES::AutoLocker<YACS::BASES::Mutex> 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()
switch (_value->getType()->kind())
{
case Double:
- xmldump << "<value><double>" << _value->getDoubleValue() << "</double></value>" << endl;
+ xmldump << "<value><double>" << setprecision(16) << _value->getDoubleValue() << "</double></value>" << endl;
break;
case Int:
xmldump << "<value><int>" << _value->getIntValue() << "</int></value>" << endl;