1 //                                               -*- C++ -*-
2 /**
3  *  @brief This class is a top-level class for the history mechanism of
4  *  simulation algorithms. It delegates to its children the effective
5  *  history strategy.
6  *
7  *  Copyright 2005-2021 Airbus-EDF-IMACS-ONERA-Phimeca
8  *
9  *  This library is free software: you can redistribute it and/or modify
10  *  it under the terms of the GNU Lesser General Public License as published by
11  *  the Free Software Foundation, either version 3 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public License
20  *  along with this library.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23 #ifndef OPENTURNS_HISTORYSTRATEGYIMPLEMENTATION_HXX
24 #define OPENTURNS_HISTORYSTRATEGYIMPLEMENTATION_HXX
25 
26 #include "openturns/PersistentObject.hxx"
27 #include "openturns/Point.hxx"
28 #include "openturns/Sample.hxx"
29 
30 BEGIN_NAMESPACE_OPENTURNS
31 
32 
33 /**
34  * @class HistoryStrategyImplementation
35  */
36 
37 class OT_API HistoryStrategyImplementation
38   : public PersistentObject
39 {
40 
41   CLASSNAME
42 
43 public:
44 
45 
46   /** Constructor with parameters */
47   HistoryStrategyImplementation();
48 
49   /** Virtual constructor */
50   HistoryStrategyImplementation * clone() const override;
51 
52   /** Store the point according to the strategy */
53   virtual void store(const Point & point);
54   virtual void store(const Sample & sample);
55 
56   /** Declare dimension of Point stored */
57   virtual void setDimension(const UnsignedInteger dimension);
58 
59   /** Clear the history storage */
60   virtual void clear();
61 
62   /** History sample accessor */
63   virtual Sample getSample() const;
64 
65   /** String converter */
66   String __repr__() const override;
67 
68   /** Method save() stores the object through the StorageManager */
69   void save(Advocate & adv) const override;
70 
71   /** Method load() reloads the object from the StorageManager */
72   void load(Advocate & adv) override;
73 
74 protected:
75   /** Data container */
76   Sample sample_;
77 
78   /** Initialization flag */
79   Bool isInitialized_;
80 } ; /* class HistoryStrategyImplementation */
81 
82 END_NAMESPACE_OPENTURNS
83 
84 #endif /* OPENTURNS_HISTORYSTRATEGYIMPLEMENTATION_HXX */
85