Salome HOME
0022307: implement workaround for OCC bug 0024263
[modules/geom.git] / src / XAO / XAO_Step.hxx
1 // Copyright (C) 2013  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Frederic Pons (OpenCascade)
20
21 #ifndef __XAO_STEP_HXX__
22 #define __XAO_STEP_HXX__
23
24 #include "XAO_XaoUtils.hxx"
25
26 namespace XAO
27 {
28     /**
29      * @class Step
30      * Base class for steps.
31      */
32     class Step
33     {
34     protected:
35         /** Default constructor. */
36         Step() {}
37
38     public:
39         /**
40          * Destructor.
41          */
42         virtual ~Step() {}
43
44         /**
45          * Gets the type of the step.
46          * @return
47          */
48         virtual const XAO::Type getType() = 0;
49
50         /**
51          * Gets the step index.
52          * @return the index of the step.
53          */
54         const int getStep() { return m_step; }
55
56         /**
57          * Sets the number of the step.
58          * @param step the index to set.
59          */
60         void setStep(const int& step) { m_step = step; }
61
62         /**
63          * Gets the stamp of the index.
64          * @return the stamp of the index.
65          */
66         const int getStamp() { return m_stamp; }
67
68         /**
69          * Sets the stamp of the index.
70          * @param stamp the stamp to set.
71          */
72         void setStamp(const int& stamp) { m_stamp = stamp; }
73
74         /**
75          * Gets the number of components of the step.
76          * @return the number of components.
77          */
78         const int countComponents() { return m_nbComponents; }
79
80         /**
81          * Gets the number of elements for the step.
82          * @return the number of elements.
83          */
84         const int countElements() { return m_nbElements; }
85
86         /**
87          * Gets the number of values for the step.
88          * @return the number of values.
89          */
90         const int countValues() { return m_nbElements * m_nbComponents; }
91
92         /**
93          * Gets a value as a string.
94          * @param element the index of the element.
95          * @param component the index of the component.
96          * @return the value as a string.
97          */
98         virtual const std::string getStringValue(const int& element, const int& component) = 0;
99
100         /**
101          * Sets a value as a string
102          * @param element the index of the element.
103          * @param component the index of the component.
104          * @param value the string value.
105          * @throw XAO_Exception if the value is not valid.
106          */
107         virtual void setStringValue(const int& element, const int& component, const std::string& value) = 0;
108
109     protected:
110         /**
111          * Checks that given element index is in the range of element indexes.
112          * @param element the index to check.
113          */
114         void checkElementIndex(const int& element) throw (XAO_Exception);
115         /**
116          * Checks that given component index is in the range of component indexes.
117          * @param component the index to check.
118          */
119         void checkComponentIndex(const int& component)throw (XAO_Exception);
120
121         /**
122          * Checks that the given number of elements is correct.
123          * @param nbElements the number of elements to check.
124          */
125         void checkNbElements(const int& nbElements)throw (XAO_Exception);
126
127         /**
128          * Checks that the given number of components is correct.
129          * @param nbComponents the number of components to check.
130          */
131         void checkNbComponents(const int& nbComponents)throw (XAO_Exception);
132
133         /**
134          * checks that the given number of values is correct.
135          * @param nbValues the number of values to check.
136          */
137         void checkNbValues(const int& nbValues)throw (XAO_Exception);
138
139     protected:
140         /** the index of the step. */
141         int m_step;
142         /** The stamp of the step. */
143         int m_stamp;
144         /** The number of components. */
145         int m_nbComponents;
146         /** The number of elements. */
147         int m_nbElements;
148     };
149 }
150
151
152 #endif /* __XAO_STEP_HXX__ */