Salome HOME
correct small problem from the version in the MedFileV2_2 branch.
[modules/med.git] / src / MEDMEM / MEDMEM_Group.hxx
1 /*
2  File Group.hxx
3  $Header$
4 */
5
6 #ifndef GROUP_HXX
7 #define GROUP_HXX
8
9 #include <vector>
10 #include <list>
11 #include "MEDMEM_Family.hxx"
12
13
14 /*!
15
16   This class describe a group of elements on an entity./n
17   It inherits from SUPPORT./n
18   It is a blending of some FAMILY class./n/n
19
20 */
21
22 namespace MEDMEM {
23 class FAMILY;
24 class GROUP : virtual public SUPPORT
25 {
26 protected :
27   /*!
28     \if developper
29     Number of families in the group.
30     \endif
31   */
32   int             _numberOfFamilies ;
33   /*!
34     \if developper
35     Vector of families in the group.
36     Note that Families are numbered from 1 to N.
37     \endif
38   */
39   vector<FAMILY*> _family ;
40   
41 public:
42   /*! Constructor. */
43   GROUP();
44   /*! Constructor. */
45   GROUP(const string & name, const list<FAMILY*> & family) throw (MEDEXCEPTION) ;
46   /*! Copy Constructor. */
47   GROUP(const GROUP & m);
48   /*! Destructor. */
49   virtual ~GROUP();
50
51   /*! Copy operator. */
52   // PN ATTention il n y a pas de copie du vecteur Family ????
53   GROUP & operator=(const GROUP &group);
54
55   /*! Operator << */
56   friend ostream & operator<<(ostream &os, GROUP &my) ;
57
58   inline void setNumberOfFamilies(int numberOfFamilies);
59   inline void setFamilies(vector<FAMILY*> Family);
60   
61   inline int             getNumberOfFamilies() const ;
62   inline vector<FAMILY*> getFamilies() const ;
63   inline FAMILY *        getFamily(int i) const ;
64
65 };
66 };
67
68 // inline method :
69 using namespace MEDMEM;
70
71 /*! set the attribut _numberOfFamilies to numberOfFamilies */
72 //----------------------------------------------------------
73 inline void GROUP::setNumberOfFamilies(int numberOfFamilies) 
74 //----------------------------------------------------------
75 {
76   _numberOfFamilies = numberOfFamilies; 
77 };
78
79
80 /*! set the attribut _family to Family              */
81 //----------------------------------------------------
82 inline void GROUP::setFamilies(vector<FAMILY*> Family) 
83 //----------------------------------------------------
84
85   _family = Family; 
86 };
87
88 /*! returns number of families in the group */
89 //--------------------------------------------
90 inline int GROUP::getNumberOfFamilies() const        
91 //-------------------------------------------
92
93   return _numberOfFamilies; 
94 };
95
96 /*! returns the vector of families in the group */
97 //------------------------------------------------
98 inline vector<FAMILY*> GROUP::getFamilies() const 
99 //------------------------------------------------
100
101   return _family; 
102 };
103
104 /*! returns  a reference on family I of the group */
105 //--------------------------------------------------
106 FAMILY * GROUP::getFamily(int i) const   
107 //--------------------------------------------------
108
109   return _family[i-1]; 
110 };
111
112
113 #endif /* GROUP_HXX */