1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #include "MEDCouplingTimeLabel.hxx"
23 #include "InterpKernelException.hxx"
27 using namespace ParaMEDMEM;
29 std::size_t TimeLabel::GLOBAL_TIME=0;
31 TimeLabel::TimeLabel():_time(GLOBAL_TIME++)
35 TimeLabel::~TimeLabel()
39 TimeLabel& TimeLabel::operator=(const TimeLabel& other)
45 void TimeLabel::declareAsNew() const
50 void TimeLabel::updateTimeWith(const TimeLabel& other) const
57 * This method has to be called with a lot of care. It set agressively the time in this with the
60 void TimeLabel::forceTimeOfThis(const TimeLabel& other) const
65 TimeLabelConstOverseer::TimeLabelConstOverseer(const TimeLabel *tl):_tl(tl),_ref_time(std::numeric_limits<std::size_t>::max())
68 throw INTERP_KERNEL::Exception("TimeLabelConstOverseer constructor : input instance must be not NULL !");
70 _ref_time=tl->getTimeOfThis();
74 * This method checks that the tracked instance is not NULL and if not NULL that its internal state has not changed.
76 void TimeLabelConstOverseer::checkConst() const
79 throw INTERP_KERNEL::Exception("TimeLabelConstOverseer::checkConst : NULL tracked instance !");
81 if(_ref_time!=_tl->getTimeOfThis())
82 throw INTERP_KERNEL::Exception("TimeLabelConstOverseer::checkConst : the state of the controlled instance of TimeLable has changed !");
85 bool TimeLabelConstOverseer::resetState()
90 _ref_time=_tl->getTimeOfThis();
97 bool TimeLabelConstOverseer::keepTrackOfNewTL(const TimeLabel *tl)
105 _ref_time=_tl->getTimeOfThis();
109 _ref_time=std::numeric_limits<std::size_t>::max();