Version: 9.15.0
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. More...
 

Public Member Functions

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

Protected Member Functions

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

Private Slots

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

Private Attributes

CAM_DataObjectmyRoot
 root data object More...
 
CAM_ModulemyModule
 module More...
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ CAM_DataModel()

CAM_DataModel::CAM_DataModel ( CAM_Module module)

Constructor.

Initialise data module by specified module.

◆ ~CAM_DataModel()

CAM_DataModel::~CAM_DataModel ( )
virtual

Destructor.

Does nothing.

Member Function Documentation

◆ close()

bool CAM_DataModel::close ( )
virtual

Close data model.

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

Returns
true if data model is closed successfully

Reimplemented in SALOME_PYQT_DataModelLight, and LightApp_DataModel.

◆ create()

bool CAM_DataModel::create ( CAM_Study )
virtual

Create empty data model.

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

Returns
true if data model is created successfully

Reimplemented in SalomeApp_DataModel, and SALOME_PYQT_DataModelLight.

◆ initialize()

void CAM_DataModel::initialize ( )
virtual

Initialize data model.

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

◆ module()

CAM_Module * CAM_DataModel::module ( ) const

Get module.

Returns
module owning this data model

References myModule.

◆ onDestroyed

void CAM_DataModel::onDestroyed ( SUIT_DataObject obj)
privateslot

Called when data object is destroyed.

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

Parameters
objobject being destroyed

References myRoot.

◆ open()

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

Load data model.

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 SalomeApp_DataModel, SALOME_PYQT_DataModelLight, and LightApp_DataModel.

◆ root()

CAM_DataObject * CAM_DataModel::root ( ) const

Get data model root object.

Returns
root object
See also
setRoot()

References myRoot.

◆ rootChanged

void CAM_DataModel::rootChanged ( const CAM_DataModel root)
signal

Emitted when the root data object is changed.

Parameters
rootnew root data object

◆ save()

bool CAM_DataModel::save ( QStringList &  )
virtual

Save data model.

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 SALOME_PYQT_DataModelLight, and LightApp_DataModel.

◆ saveAs()

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

Save data to the new file.

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 SALOME_PYQT_DataModelLight.

◆ setRoot()

void CAM_DataModel::setRoot ( const CAM_DataObject newRoot)
protectedvirtual

Set data model root object.

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().

Member Data Documentation

◆ myModule

CAM_Module* CAM_DataModel::myModule
private

module

◆ myRoot

CAM_DataObject* CAM_DataModel::myRoot
private

root data object


The documentation for this class was generated from the following files: