Salome HOME
2109bccac6839568ac38928af2b3ab7499c60d09
[modules/gui.git] / src / CAM / CAM_DataObject.cxx
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
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.
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/
18 //
19 #include "CAM_DataObject.h"
20
21 #include "CAM_Module.h"
22 #include "CAM_DataModel.h"
23
24 /*!Constructor. Sets parent object.*/
25 CAM_DataObject::CAM_DataObject( SUIT_DataObject* parent )
26 : SUIT_DataObject( parent )
27 {
28 }
29
30 /*!Destructor.Do nothing*/
31 CAM_DataObject::~CAM_DataObject()
32 {
33 }
34
35 /*!Get module.
36  *\retval const CAM_Module pointer - module
37  */
38 CAM_Module* CAM_DataObject::module() const
39
40   CAM_Module* mod = 0;
41
42   CAM_DataModel* data = dataModel();
43   if ( data )
44     mod = data->module();
45
46   return mod;
47 }
48
49 /*!Get data model.
50  *Return 0 - if no parent obbject.
51  *\retval const CAM_DataModel pointer - data model
52  */
53 CAM_DataModel* CAM_DataObject::dataModel() const
54 {
55   CAM_DataObject* parentObj = dynamic_cast<CAM_DataObject*>( parent() );
56
57   if ( !parentObj )
58     return 0;
59
60   return parentObj->dataModel();
61 }