Salome HOME
updated copyright message
[modules/yacs.git] / src / engine / Test / ToyNode.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 638a514..cfb70be
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2023  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
@@ -67,7 +67,7 @@ InputToyPort::InputToyPort(const string& name, Node *node):InputPort(name, node,
 {
 }
 
-void InputToyPort::put(const void *data) throw(ConversionException)
+void InputToyPort::put(const void *data)
 {
   put((Any *)data);
 }
@@ -77,7 +77,7 @@ bool InputToyPort::edIsManuallyInitialized() const
   return _initData!=0;
 }
 
-void *InputToyPort::get() const throw(YACS::Exception)
+void *InputToyPort::get() const
 {
   return (void *)_data;
 }
@@ -95,10 +95,16 @@ InputPort *InputToyPort::clone(Node *newHelder) const
   return new InputToyPort(*this,newHelder);
 }
 
-void InputToyPort::put(Any *data)
+void InputToyPort::releaseData()
 {
   if(_data)
     _data->decrRef();
+  _data=nullptr;
+}
+
+void InputToyPort::put(Any *data)
+{
+  InputToyPort::releaseData();
   _data=data;
   _data->incrRef();
 }
@@ -136,7 +142,7 @@ OutputToyPort::OutputToyPort(const OutputToyPort& other, Node *newHelder):Output
     _data=other._data->clone();
 }
 
-void OutputToyPort::put(const void *data) throw(ConversionException)
+void OutputToyPort::put(const void *data)
 {
   put((Any *)data);
   OutputPort::put(data);
@@ -215,7 +221,7 @@ int ToyNode::getNumberOfOutputPorts() const
   return ElementaryNode::getNumberOfInputPorts()+1;
 }
 
-OutputPort *ToyNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
+OutputPort *ToyNode::getOutputPort(const std::string& name) const
 {
   if(name==NAME_FOR_NB)
     return (OutputPort *)&_nbOfInputsPort;
@@ -331,7 +337,7 @@ std::list<InputPort *> SeqToyNode::getSetOfInputPort() const
   return ret;
 }
 
-InputPort *SeqToyNode::getInputPort(const std::string& name) const throw(YACS::Exception)
+InputPort *SeqToyNode::getInputPort(const std::string& name) const
 {
   if(name==NAME_NBOFELTS_INSEQ_INPRT)
     return (InputPort *)&_inIntValue;
@@ -351,7 +357,7 @@ std::list<OutputPort *> SeqToyNode::getSetOfOutputPort() const
   return ret;
 }
 
-OutputPort *SeqToyNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
+OutputPort *SeqToyNode::getOutputPort(const std::string& name) const
 {
   if(name==NAME_SEQ_OUTPRT)
     return (OutputPort *)&_seqOut;
@@ -414,7 +420,7 @@ std::list<InputPort *> Seq2ToyNode::getSetOfInputPort() const
   return ret;
 }
 
-InputPort *Seq2ToyNode::getInputPort(const std::string& name) const throw(YACS::Exception)
+InputPort *Seq2ToyNode::getInputPort(const std::string& name) const 
 {
   if(name==NAME_SEQ_INPRT1)
     return (InputPort *)&_inValue1;
@@ -436,7 +442,7 @@ std::list<OutputPort *> Seq2ToyNode::getSetOfOutputPort() const
   return ret;
 }
 
-OutputPort *Seq2ToyNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
+OutputPort *Seq2ToyNode::getOutputPort(const std::string& name) const 
 {
   if(name==NAME_SEQ_OUTPRT)
     return (OutputPort *)&_seqOut;
@@ -514,7 +520,7 @@ std::list<InputPort *> Seq3ToyNode::getSetOfInputPort() const
   return ret;
 }
 
-InputPort *Seq3ToyNode::getInputPort(const std::string& name) const throw(YACS::Exception)
+InputPort *Seq3ToyNode::getInputPort(const std::string& name) const 
 {
   if(name==NAME_SEQ_INPRT1)
     return (InputPort *)&_inValue1;
@@ -536,7 +542,7 @@ std::list<OutputPort *> Seq3ToyNode::getSetOfOutputPort() const
   return ret;
 }
 
-OutputPort *Seq3ToyNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
+OutputPort *Seq3ToyNode::getOutputPort(const std::string& name) const 
 {
   if(name==NAME_SEQ_OUTPRT)
     return (OutputPort *)&_seqOut;
@@ -566,7 +572,7 @@ InputLimitPort::InputLimitPort(const string& name, Node *node)
 {
 }
 
-void InputLimitPort::put(const void *data) throw(ConversionException)
+void InputLimitPort::put(const void *data)
 {
   put((Any *)data);
 }
@@ -581,7 +587,7 @@ bool InputLimitPort::edIsManuallyInitialized() const
   return _initData!=0;
 }
 
-void *InputLimitPort::get() const throw(YACS::Exception)
+void *InputLimitPort::get() const
 {
   if(!_data)
     {
@@ -599,10 +605,16 @@ void InputLimitPort::edRemoveManInit()
   InputPort::edRemoveManInit();
 }
 
-void InputLimitPort::put(Any *data)
+void InputLimitPort::releaseData()
 {
   if(_data)
     _data->decrRef();
+  _data=nullptr;
+}
+
+void InputLimitPort::put(Any *data)
+{
+  InputLimitPort::releaseData();
   _data=data;
   _data->incrRef();
 }
@@ -641,7 +653,7 @@ OutputLimitPort::OutputLimitPort(const string& name, Node *node, TypeCode *type)
 {
 }
 
-void OutputLimitPort::put(const void *data) throw(ConversionException)
+void OutputLimitPort::put(const void *data)
 {
   put((Any *)data);
   OutputPort::put(data);
@@ -705,7 +717,7 @@ std::list<OutputPort *> LimitNode::getSetOfOutputPort() const
   return ret;
 }
 
-InputPort *LimitNode::getInputPort(const std::string& name) const throw(YACS::Exception)
+InputPort *LimitNode::getInputPort(const std::string& name) const
 {
   if(name==NAME_FOR_SWPORT)
     return (InputPort *)&_entry;
@@ -713,7 +725,7 @@ InputPort *LimitNode::getInputPort(const std::string& name) const throw(YACS::Ex
     return ElementaryNode::getInputPort(name);
 }
 
-OutputPort *LimitNode::getOutputPort(const std::string& name) const throw(YACS::Exception)
+OutputPort *LimitNode::getOutputPort(const std::string& name) const
 {
   if(name==NAME_FOR_SWPORT)
     return (OutputPort *)&_switchPort;