Salome HOME
NRI : Merge from V1_2.
[modules/med.git] / src / MEDMEM / MEDMEM_Group.hxx
1 //  MED MEDMEM : MED files in memory
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : MEDMEM_Group.hxx
25 //  Module : MED
26
27 /*
28  File Group.hxx
29  $Header$
30 */
31
32 #ifndef GROUP_HXX
33 #define GROUP_HXX
34
35 #include <vector>
36 #include <list>
37 //#include "MEDMEM_Support.hxx"
38 #include "MEDMEM_Family.hxx"
39
40 class FAMILY;
41
42 /*!
43
44   This class describe a group of elements on an entity./n
45   It inherits from SUPPORT./n
46   It is a blending of some FAMILY class./n/n
47
48 */
49
50 class GROUP : public SUPPORT
51 {
52 protected :
53   /*!
54     \if developper
55     Number of families in the group.
56   */
57   int             _numberOfFamilies ;
58   /*!
59     \if developper
60     Vector of families in the group.
61     Note that Families are numbered from 1 to N.
62   */
63   vector<FAMILY*> _family ;
64   
65 public:
66   /*! Constructor. */
67   GROUP();
68   /*! Constructor. */
69   GROUP(const string & name, const list<FAMILY*> & family) throw (MEDEXCEPTION) ;
70   /*! Copy Constructor. */
71   GROUP(const GROUP & m);
72   /*! Destructor. */
73   ~GROUP();
74
75   /*! Copy operator. */
76   // PN ATTention il n y a pas de copie du vecteur Family ????
77   GROUP & operator=(const GROUP &group);
78
79   /*! Operator << */
80   friend ostream & operator<<(ostream &os, GROUP &my) ;
81
82   inline void setNumberOfFamilies(int numberOfFamilies);
83   inline void setFamilies(vector<FAMILY*> Family);
84   
85   inline int             getNumberOfFamilies() const ;
86   inline vector<FAMILY*> getFamilies() const ;
87   inline FAMILY *        getFamily(int i) const ;
88
89 };
90
91 // inline method :
92
93 /*! set the attribut _numberOfFamilies to numberOfFamilies */
94 //----------------------------------------------------------
95 inline void GROUP::setNumberOfFamilies(int numberOfFamilies) 
96 //----------------------------------------------------------
97 {
98   _numberOfFamilies = numberOfFamilies; 
99 };
100
101
102 /*! set the attribut _family to Family              */
103 //----------------------------------------------------
104 inline void GROUP::setFamilies(vector<FAMILY*> Family) 
105 //----------------------------------------------------
106
107   _family = Family; 
108 };
109
110 /*! returns number of families in the group */
111 //--------------------------------------------
112 inline int GROUP::getNumberOfFamilies() const        
113 //-------------------------------------------
114
115   return _numberOfFamilies; 
116 };
117
118 /*! returns the vector of families in the group */
119 //------------------------------------------------
120 inline vector<FAMILY*> GROUP::getFamilies() const 
121 //------------------------------------------------
122
123   return _family; 
124 };
125
126 /*! returns  a reference on family I of the group */
127 //--------------------------------------------------
128 FAMILY * GROUP::getFamily(int i) const   
129 //--------------------------------------------------
130
131   return _family[i-1]; 
132 };
133
134
135 #endif /* GROUP_HXX */