Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

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

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

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_Module * CAM_DataModel::module ( ) const
Returns
module owning this data model

References myModule.

void CAM_DataModel::onDestroyed ( SUIT_DataObject obj)
privateslot

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

Parameters
objobject being destroyed

References myRoot.

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

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

References myRoot.

void CAM_DataModel::rootChanged ( const CAM_DataModel root)
signal
Parameters
rootnew root data object
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.

void CAM_DataModel::setRoot ( const CAM_DataObject newRoot)
protectedvirtual

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

CAM_Module* CAM_DataModel::myModule
private
CAM_DataObject* CAM_DataModel::myRoot
private

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