Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
XAO_Field.hxx
Go to the documentation of this file.
1 // Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE
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, or (at your option) any later version.
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_FIELD_HXX__
22 #define __XAO_FIELD_HXX__
23 
24 #include <string>
25 #include <vector>
26 
27 #include "XAO.hxx"
28 #include "XAO_XaoUtils.hxx"
29 #include "XAO_Step.hxx"
30 
31 #ifdef WIN32
32 #pragma warning(disable:4290) // Warning Exception ...
33 #pragma warning(disable:4251) // Warning dll-interface ...
34 #endif
35 
36 
37 namespace XAO
38 {
39  typedef std::vector<Step*>::iterator stepIterator;
40 
46  {
47  protected:
55  Field(const XAO::Dimension& dimension,
56  const int& nbElements, const int& nbComponents, const std::string& name);
57 
58  public:
68  static Field* createField(const XAO::Type& type, const XAO::Dimension& dimension,
69  const int& nbElements, const int& nbComponents,
70  const std::string& name = std::string(""))
71  throw (XAO_Exception);
72 
76  virtual ~Field();
77 
82  virtual const XAO::Type getType() = 0;
83 
88  const std::string getName() const
89  {
90  return m_name;
91  }
92 
97  void setName(const std::string& name)
98  {
99  m_name = name;
100  }
101 
106  const XAO::Dimension getDimension() const
107  {
108  return m_dimension;
109  }
110 
115  const int countElements() const
116  {
117  return m_nbElements;
118  }
119 
124  const int countComponents() const
125  {
126  return m_nbComponents;
127  }
128 
133  const int countValues() const
134  {
135  return m_nbElements * m_nbComponents;
136  }
137 
142  const int countSteps() const { return m_steps.size(); }
143 
149  const std::string getComponentName(const int& index) throw (XAO_Exception);
150 
156  void setComponentName(const int& componentIndex, const std::string& name) throw (XAO_Exception);
157 
162  void setComponentsNames(const std::vector<std::string>& names) throw (XAO_Exception);
163 
169  virtual Step* addNewStep(const int& number) throw (XAO_Exception) = 0;
170 
176  bool removeStep(Step* step);
177 
183  bool hasStep(const int& step);
184 
189  stepIterator begin() { return m_steps.begin(); }
190 
195  stepIterator end() { return m_steps.end(); }
196 
197  protected:
198  void checkComponent(const int& component) throw (XAO_Exception);
199  void checkStepIndex(const int& step) throw (XAO_Exception);
200 
201  protected:
203  std::string m_name;
206 
210  std::vector<std::string> m_components;
213 
215  std::vector<Step*> m_steps;
216  };
217 }
218 
219 #endif