Salome HOME
Updated copyright comment
[modules/kernel.git] / src / HDFPersist / HDFcontainerObject.cc
1 // Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SALOME HDFPersist : implementation of HDF persitent ( save/ restore )
24 //  File   : HDFcontainerObject.cc
25 //  Module : SALOME
26 //
27 #include "hdfi.h"
28 #include "HDFcontainerObject.hxx"
29 #include "HDFexception.hxx"
30
31 HDFcontainerObject::HDFcontainerObject(const char *name)
32   : HDFinternalObject(name)
33 {
34   _nsons = 0;
35   _firstson = NULL;
36   _lastson = NULL;
37 }
38
39 HDFcontainerObject::~HDFcontainerObject()
40 {
41   HDFinternalObject *sonToDelete = 0;
42   while(_firstson)
43     {
44       sonToDelete = _firstson;
45       _firstson = _firstson->GetNextBrother();
46       delete sonToDelete;
47     }
48 }
49
50 int HDFcontainerObject::nInternalObjects()
51 {
52   return 0;
53 }
54
55 void HDFcontainerObject::InternalObjectIndentify(int /*rank*/, char* /*object_name*/)
56 {
57 }
58
59 void HDFcontainerObject::AddSon(HDFinternalObject *son)
60 {
61   if (_nsons == 0)
62     {
63       _firstson = son;
64       _lastson = _firstson;
65     }
66   else
67     {
68       _lastson->SetNextBrother(son);
69       son->SetPreviousBrother(_lastson);
70       _lastson = son;
71     }
72   _nsons ++;
73 }
74
75 HDFinternalObject *HDFcontainerObject::GetFirstSon()
76 {
77   return _firstson;
78 }
79
80 HDFinternalObject *HDFcontainerObject::GetLastSon()
81 {
82   return _lastson;
83 }
84
85 int HDFcontainerObject::nSons()
86 {
87   return _nsons;
88 }