Computer Assisted Medical Intervention Tool Kit  version 6.0
Loading...
Searching...
No Matches
CamiTKExtensionModel Class Reference

This class manages a CamiTK Extension model (stored as a VariantDataModel). More...

#include <CamiTKExtensionModel.h>

Public Member Functions

 CamiTKExtensionModel (const QString &filePath=QString())
 constructor
void clear ()
 reset the model from scratch (the model will then be empty)
VariantDataModelgetModel ()
 get access to the VariantDataModel
bool isModified ()
 was the data model modified since last read
bool load (const QString &filePath)
 read the given file and creates the corresponding configuration
bool save (const QString &filePath=QString())
 save the current config to the current filePath or given filePath and update camitkFile if needed Warning it does overwrite the previous content of filePath
void setModel (VariantDataModel &)
 modify the model
QString toJSON ()
 the camitk extension data model as a JSON string

Detailed Description

This class manages a CamiTK Extension model (stored as a VariantDataModel).

It can load/save the model to CamiTK extension file (JSON)

Role:

  • Reads the given CamiTK file (.json)
  • Provides the corresponding VariantDataModel (as a reference)
  • Saves the current state of the model to a given file
  • The managed model can be set using setModel(..)
Note
the static newExtension(..) method create a QVariantMap that can be used to add an new extension of the given type to a model.

The expected JSON file must follow the following format:

{
"camitk": {
"extensions": {
"actions": [ ... ],
"name":"..."
},
"timestamp": "2024-05-17T16:27:05",
"version": "camitk-6.0"
}
}

Instead the actions array (or as well as, at the same level), you may add a components, viewers, libraries and applications arrays.

Constructor & Destructor Documentation

◆ CamiTKExtensionModel()

CamiTKExtensionModel::CamiTKExtensionModel ( const QString & filePath = QString())

constructor

References load().

Member Function Documentation

◆ clear()

void CamiTKExtensionModel::clear ( )

reset the model from scratch (the model will then be empty)

Referenced by load().

◆ getModel()

◆ isModified()

bool CamiTKExtensionModel::isModified ( )

was the data model modified since last read

◆ load()

bool CamiTKExtensionModel::load ( const QString & filePath)

read the given file and creates the corresponding configuration

References clear().

Referenced by CamiTKExtensionModel(), and camitk::HotPlugActionExtension::newHotPlugActionExtension().

◆ save()

bool CamiTKExtensionModel::save ( const QString & filePath = QString())

save the current config to the current filePath or given filePath and update camitkFile if needed Warning it does overwrite the previous content of filePath

Returns
false if the file could not be reopened for writing

References toJSON().

◆ setModel()

void CamiTKExtensionModel::setModel ( VariantDataModel & newModel)

modify the model

◆ toJSON()

QString CamiTKExtensionModel::toJSON ( )

the camitk extension data model as a JSON string

Referenced by save().


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