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