1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef CAM_DATAMODEL_H
20 #define CAM_DATAMODEL_H
25 #include <qstringlist.h>
30 class SUIT_DataObject;
34 Base class for all data models used in CAM-based applications.
35 Represents data model of CAM module. Provides necessary interface (default implementation is empty)
37 class CAM_EXPORT CAM_DataModel : public QObject
42 CAM_DataModel( CAM_Module* );
43 virtual ~CAM_DataModel();
45 virtual void initialize();
47 CAM_DataObject* root() const;
48 CAM_Module* module() const;
50 /** @name These methods should be redefined in successors.*/
52 virtual bool open( const QString&, CAM_Study*, QStringList ) { return true; }//!< return true
53 virtual bool save( QStringList& ) { return true; };
54 virtual bool saveAs( const QString&, CAM_Study*, QStringList& ) { return true; };
55 virtual bool close() { return true; };
56 virtual bool create( CAM_Study* ) { return true; }
60 /*! setRoot() should be used to specify custom root object instance.\n
61 * Such an object can be created in several ways, depending on application or module needs:\n
63 * \li while the model is being loaded
64 * \li when the model is updated and becomes non-empty
66 virtual void setRoot( const CAM_DataObject* );
69 void onDestroyed( SUIT_DataObject* );
72 void rootChanged( const CAM_DataModel* );
75 CAM_DataObject* myRoot;