Version: 6.3.1
Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Attributes

CAM_DataModel Class Reference

Base class for all data models used in CAM-based applications. More...

#include <CAM_DataModel.h>

Inheritance diagram for CAM_DataModel:
Inheritance graph

Signals

void rootChanged (const CAM_DataModel *)
 Emitted when the root data object is changed.

Public Member Functions

 CAM_DataModel (CAM_Module *)
 Constructor.
virtual ~CAM_DataModel ()
 Destructor.
virtual void initialize ()
 Initialize data model.
CAM_DataObjectroot () const
 Get data model root object.
CAM_Modulemodule () const
 Get module.
virtual bool open (const QString &, CAM_Study *, QStringList)
 Load data model.
virtual bool save (QStringList &)
 Save data model.
virtual bool saveAs (const QString &, CAM_Study *, QStringList &)
 Save data to the new file.
virtual bool close ()
 Close data model.
virtual bool create (CAM_Study *)
 Create empty data model.

Protected Member Functions

virtual void setRoot (const CAM_DataObject *)
 Set data model root object.

Private Slots

void onDestroyed (SUIT_DataObject *)
 Called when data object is destroyed.

Private Attributes

CAM_DataObjectmyRoot
 root data object
CAM_ModulemyModule
 module

Detailed Description

Represents data model of the CAM module. Provides necessary interface (default implementation is empty).


Constructor & Destructor Documentation

CAM_DataModel::CAM_DataModel ( CAM_Module module)

Initialise data module by specified module.

CAM_DataModel::~CAM_DataModel ( ) [virtual]

Does nothing.


Member Function Documentation

void CAM_DataModel::initialize ( ) [virtual]

This method should be re-implemented in the successor classes and can be used for creation of root data object. Default implementation does nothing.

CAM_DataObject * CAM_DataModel::root ( ) const
Returns:
root object
See also:
setRoot()

References myRoot.

CAM_Module * CAM_DataModel::module ( ) const
Returns:
module owning this data model

References myModule.

bool CAM_DataModel::open ( const QString &  ,
CAM_Study ,
QStringList   
) [virtual]

This method should be re-implemented in the successor classes. Default implementation returns true.

Parameters:
namestudy name
studystudy
fileslist of file names from which data should be loaded
Returns:
true if data model is loaded successfully

Reimplemented in LightApp_DataModel, SALOME_PYQT_DataModelLight, and SalomeApp_DataModel.

bool CAM_DataModel::save ( QStringList &  ) [virtual]

This method should be re-implemented in the successor classes. Default implementation returns true.

Parameters:
fileslist of file names to which data should be saved
Returns:
true if data model is saved successfully

Reimplemented in LightApp_DataModel, and SALOME_PYQT_DataModelLight.

bool CAM_DataModel::saveAs ( const QString &  ,
CAM_Study ,
QStringList &   
) [virtual]

This method should be re-implemented in the successor classes. Default implementation returns true.

Parameters:
namestudy name
studystudy
filesresulting list of file names to which data is saved
Returns:
true if data model is saved successfully

Reimplemented in LightApp_DataModel, and SALOME_PYQT_DataModelLight.

bool CAM_DataModel::close ( ) [virtual]

This method should be re-implemented in the successor classes. Default implementation returns true.

Returns:
true if data model is closed successfully

Reimplemented in LightApp_DataModel, and SALOME_PYQT_DataModelLight.

bool CAM_DataModel::create ( CAM_Study ) [virtual]

This method should be re-implemented in the successor classes. Default implementation returns true.

Returns:
true if data model is created successfully

Reimplemented in SALOME_PYQT_DataModelLight, and SalomeApp_DataModel.

void CAM_DataModel::setRoot ( const CAM_DataObject newRoot) [protected, virtual]

This method should be used to specify custom root object instance.

Root object can be created in several ways, depending on application or module needs:

  • in initialize() method
  • while the data model is being loaded
  • when the data model is updated and becomes non-empty

If root object is changed, this method emits rootChanged() signal.

Parameters:
newRootnew root object

References SUIT_DataObject.connect(), SUIT_DataObject.disconnect(), myRoot, onDestroyed(), and rootChanged().

void CAM_DataModel::onDestroyed ( SUIT_DataObject obj) [private, slot]

Nullifies the root object if it is detroyed to avoid crashes.

Parameters:
objobject being destroyed

References myRoot.

void CAM_DataModel::rootChanged ( const CAM_DataModel root) [signal]
Parameters:
rootnew root data object

Field Documentation

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS