SHAPER  9.12.0
ModelAPI_Session Class Referenceabstract

Object that knows (from the initial XML file) which plugin contains which feature, loads and stores reference to loaded plugins by the feature functionality request. More...

Inheritance diagram for ModelAPI_Session:
Inheritance graph

Public Member Functions

virtual bool load (const char *theFileName)=0
 Loads the OCAF document from the file. More...
 
virtual bool isLoading ()
 Returns true if a loading process is performed (so, no need to react on a new part creation) More...
 
virtual bool save (const char *theFileName, std::list< std::string > &theResults)=0
 Saves the OCAF document to the file. More...
 
virtual void closeAll ()=0
 Closes all documents. More...
 
virtual void startOperation (const std::string &theId="", const bool theAttachedToNested=false)=0
 Starts a new operation (opens a transaction) More...
 
virtual void finishOperation ()=0
 Finishes the previously started operation (closes the transaction) More...
 
virtual void abortOperation ()=0
 Aborts the operation. More...
 
virtual bool isOperation ()=0
 Returns true if operation has been started, but not yet finished or aborted. More...
 
virtual bool isModified ()=0
 Returns true if document was modified (since creation/opening) More...
 
virtual bool canUndo ()=0
 Returns True if there are available Undos. More...
 
virtual void undo ()=0
 Undoes last operation. More...
 
virtual bool canRedo ()=0
 Returns True if there are available Redos. More...
 
virtual void redo ()=0
 Redoes last operation. More...
 
virtual std::list< std::string > undoList ()=0
 Returns stack of performed operations (from last to first) More...
 
virtual std::list< std::string > redoList ()=0
 Returns stack of rolled back operations (from last rolled back to first) More...
 
virtual void clearUndoRedo ()=0
 Clears undo and redo lists of all documents in the session. More...
 
virtual void registerPlugin (ModelAPI_Plugin *thePlugin)=0
 Registers the plugin that creates features. More...
 
virtual bool checkLicense (const std::string &thePluginName)=0
 Verifies the license for the plugin is valid. More...
 
virtual std::shared_ptr< ModelAPI_DocumentmoduleDocument ()=0
 Returns the root document of the application (that may contains sub-documents) More...
 
virtual std::shared_ptr< ModelAPI_Documentdocument (int theDocID)=0
 Returns the document by ID. Returns null if no such document. More...
 
virtual bool hasModuleDocument ()=0
 Return true if root document has been already created. More...
 
virtual std::shared_ptr< ModelAPI_DocumentactiveDocument ()=0
 Returns the current document that used for current work in the application. More...
 
virtual void setActiveDocument (std::shared_ptr< ModelAPI_Document > theDoc, bool theSendSignal=true)=0
 Defines the current document that used for current work in the application. More...
 
virtual std::list< std::shared_ptr< ModelAPI_Document > > allOpenedDocuments ()=0
 Returns all the opened documents of the session (without postponed) More...
 
virtual bool isLoadByDemand (const std::wstring theDocID, const int theDocIndex)=0
 Returns true if document is not loaded yet. More...
 
virtual std::shared_ptr< ModelAPI_Documentcopy (std::shared_ptr< ModelAPI_Document > theSource, const int theDestID)=0
 Copies the document to the new one with the given id. More...
 
virtual ModelAPI_ValidatorsFactoryvalidators ()=0
 Returns the validators factory: the only one instance per application. More...
 
virtual ModelAPI_FiltersFactoryfilters ()=0
 Returns the filters factory: the only one instance per application. More...
 
virtual ~ModelAPI_Session ()
 To virtually destroy the fields of successors. More...
 
virtual int transactionID ()=0
 Returns the global identifier of the current transaction (needed for the update algo) More...
 
virtual bool isAutoUpdateBlocked ()=0
 Returns true if auto-update in the application is blocked. More...
 
virtual void blockAutoUpdate (const bool theBlock)=0
 Set state of the auto-update of features result in the application. More...
 

Static Public Member Functions

static std::shared_ptr< ModelAPI_Sessionget ()
 Returns the real implementation (the alone instance per application) of the plugin manager. More...
 

Static Protected Member Functions

static void setSession (std::shared_ptr< ModelAPI_Session > theManager)
 Sets the session interface implementation (once per application launch) More...
 

Protected Attributes

bool myIsLoading
 keeps the state of the loading of the document More...
 

Detailed Description

Object that knows (from the initial XML file) which plugin contains which feature, loads and stores reference to loaded plugins by the feature functionality request.

Constructor & Destructor Documentation

◆ ~ModelAPI_Session()

virtual ModelAPI_Session::~ModelAPI_Session ( )
inlinevirtual

To virtually destroy the fields of successors.

Member Function Documentation

◆ get()

std::shared_ptr< ModelAPI_Session > ModelAPI_Session::get ( )
static

Returns the real implementation (the alone instance per application) of the plugin manager.

◆ load()

virtual bool ModelAPI_Session::load ( const char *  theFileName)
pure virtual

Loads the OCAF document from the file.

Parameters
theFileNamefull name of the file to load
Returns
true if file was loaded successfully

Implemented in Model_Session.

◆ isLoading()

virtual bool ModelAPI_Session::isLoading ( )
inlinevirtual

Returns true if a loading process is performed (so, no need to react on a new part creation)

◆ save()

virtual bool ModelAPI_Session::save ( const char *  theFileName,
std::list< std::string > &  theResults 
)
pure virtual

Saves the OCAF document to the file.

Parameters
theFileNamefull name of the file to store
theResultsthe result full file names that were stored by "save"
Returns
true if file was stored successfully

Implemented in Model_Session.

◆ closeAll()

virtual void ModelAPI_Session::closeAll ( )
pure virtual

Closes all documents.

Implemented in Model_Session.

◆ startOperation()

virtual void ModelAPI_Session::startOperation ( const std::string &  theId = "",
const bool  theAttachedToNested = false 
)
pure virtual

Starts a new operation (opens a transaction)

Parameters
theIdof operation for history (optional)
theAttachedToNestedif it is true, it means that this transaction is attached to the nested where it is located and will be committed on the next commit with the nested

Implemented in Model_Session.

◆ finishOperation()

virtual void ModelAPI_Session::finishOperation ( )
pure virtual

Finishes the previously started operation (closes the transaction)

Implemented in Model_Session.

◆ abortOperation()

virtual void ModelAPI_Session::abortOperation ( )
pure virtual

Aborts the operation.

Implemented in Model_Session.

◆ isOperation()

virtual bool ModelAPI_Session::isOperation ( )
pure virtual

Returns true if operation has been started, but not yet finished or aborted.

Implemented in Model_Session.

◆ isModified()

virtual bool ModelAPI_Session::isModified ( )
pure virtual

Returns true if document was modified (since creation/opening)

Implemented in Model_Session.

◆ canUndo()

virtual bool ModelAPI_Session::canUndo ( )
pure virtual

Returns True if there are available Undos.

Implemented in Model_Session.

◆ undo()

virtual void ModelAPI_Session::undo ( )
pure virtual

Undoes last operation.

Implemented in Model_Session.

◆ canRedo()

virtual bool ModelAPI_Session::canRedo ( )
pure virtual

Returns True if there are available Redos.

Implemented in Model_Session.

◆ redo()

virtual void ModelAPI_Session::redo ( )
pure virtual

Redoes last operation.

Implemented in Model_Session.

◆ undoList()

virtual std::list<std::string> ModelAPI_Session::undoList ( )
pure virtual

Returns stack of performed operations (from last to first)

Implemented in Model_Session.

◆ redoList()

virtual std::list<std::string> ModelAPI_Session::redoList ( )
pure virtual

Returns stack of rolled back operations (from last rolled back to first)

Implemented in Model_Session.

◆ clearUndoRedo()

virtual void ModelAPI_Session::clearUndoRedo ( )
pure virtual

Clears undo and redo lists of all documents in the session.

Implemented in Model_Session.

◆ registerPlugin()

virtual void ModelAPI_Session::registerPlugin ( ModelAPI_Plugin thePlugin)
pure virtual

Registers the plugin that creates features.

It is obligatory for each plugin to call this function on loading to be found by the plugin manager on call of the feature)

Implemented in Model_Session.

◆ checkLicense()

virtual bool ModelAPI_Session::checkLicense ( const std::string &  thePluginName)
pure virtual

Verifies the license for the plugin is valid.

Implemented in Model_Session.

◆ moduleDocument()

virtual std::shared_ptr<ModelAPI_Document> ModelAPI_Session::moduleDocument ( )
pure virtual

Returns the root document of the application (that may contains sub-documents)

Implemented in Model_Session.

◆ document()

virtual std::shared_ptr<ModelAPI_Document> ModelAPI_Session::document ( int  theDocID)
pure virtual

Returns the document by ID. Returns null if no such document.

Implemented in Model_Session.

◆ hasModuleDocument()

virtual bool ModelAPI_Session::hasModuleDocument ( )
pure virtual

Return true if root document has been already created.

Implemented in Model_Session.

◆ activeDocument()

virtual std::shared_ptr<ModelAPI_Document> ModelAPI_Session::activeDocument ( )
pure virtual

Returns the current document that used for current work in the application.

Implemented in Model_Session.

◆ setActiveDocument()

virtual void ModelAPI_Session::setActiveDocument ( std::shared_ptr< ModelAPI_Document theDoc,
bool  theSendSignal = true 
)
pure virtual

Defines the current document that used for current work in the application.

Implemented in Model_Session.

◆ allOpenedDocuments()

virtual std::list<std::shared_ptr<ModelAPI_Document> > ModelAPI_Session::allOpenedDocuments ( )
pure virtual

Returns all the opened documents of the session (without postponed)

Implemented in Model_Session.

◆ isLoadByDemand()

virtual bool ModelAPI_Session::isLoadByDemand ( const std::wstring  theDocID,
const int  theDocIndex 
)
pure virtual

Returns true if document is not loaded yet.

Implemented in Model_Session.

◆ copy()

virtual std::shared_ptr<ModelAPI_Document> ModelAPI_Session::copy ( std::shared_ptr< ModelAPI_Document theSource,
const int  theDestID 
)
pure virtual

Copies the document to the new one with the given id.

Implemented in Model_Session.

◆ validators()

virtual ModelAPI_ValidatorsFactory* ModelAPI_Session::validators ( )
pure virtual

Returns the validators factory: the only one instance per application.

Implemented in Model_Session.

◆ filters()

virtual ModelAPI_FiltersFactory* ModelAPI_Session::filters ( )
pure virtual

Returns the filters factory: the only one instance per application.

Implemented in Model_Session.

◆ transactionID()

virtual int ModelAPI_Session::transactionID ( )
pure virtual

Returns the global identifier of the current transaction (needed for the update algo)

Implemented in Model_Session.

◆ isAutoUpdateBlocked()

virtual bool ModelAPI_Session::isAutoUpdateBlocked ( )
pure virtual

Returns true if auto-update in the application is blocked.

Implemented in Model_Session.

◆ blockAutoUpdate()

virtual void ModelAPI_Session::blockAutoUpdate ( const bool  theBlock)
pure virtual

Set state of the auto-update of features result in the application.

Implemented in Model_Session.

◆ setSession()

void ModelAPI_Session::setSession ( std::shared_ptr< ModelAPI_Session theManager)
staticprotected

Sets the session interface implementation (once per application launch)

Field Documentation

◆ myIsLoading

bool ModelAPI_Session::myIsLoading
protected

keeps the state of the loading of the document