SHAPER  9.12.0
Model_Session Class Reference

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 Model_Session:
Inheritance graph

Public Member Functions

virtual bool load (const char *theFileName)
 Loads the OCAF document from the file. More...
 
virtual bool save (const char *theFileName, std::list< std::string > &theResults)
 Saves the OCAF document to the file. More...
 
virtual void closeAll ()
 Closes all documents. More...
 
virtual void startOperation (const std::string &theId="", const bool theAttachedToNested=false)
 Starts a new operation (opens a transaction) More...
 
virtual void finishOperation ()
 Finishes the previously started operation (closes the transaction) More...
 
virtual void abortOperation ()
 Aborts the operation. More...
 
virtual bool isOperation ()
 Returns true if operation has been started, but not yet finished or aborted. More...
 
virtual bool isModified ()
 Returns true if document was modified (since creation/opening) More...
 
virtual bool canUndo ()
 Returns True if there are available Undos. More...
 
virtual void undo ()
 Undoes last operation. More...
 
virtual bool canRedo ()
 Returns True if there are available Redos. More...
 
virtual void redo ()
 Redoes last operation. More...
 
virtual std::list< std::string > undoList ()
 Returns stack of performed operations. More...
 
virtual std::list< std::string > redoList ()
 Returns stack of rolled back operations. More...
 
virtual void clearUndoRedo ()
 Clears undo and redo lists of all documents in the session. More...
 
virtual std::shared_ptr< ModelAPI_DocumentmoduleDocument ()
 Returns the root document of the application (that may contains sub-documents) More...
 
virtual std::shared_ptr< ModelAPI_Documentdocument (int theDocID)
 Returns the document by ID, loads if not loaded yet. Returns null if no such document. More...
 
virtual bool hasModuleDocument ()
 Return true if root document has been already created. More...
 
virtual std::shared_ptr< ModelAPI_DocumentactiveDocument ()
 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)
 Defines the current document that used for current work in the application. More...
 
virtual std::list< std::shared_ptr< ModelAPI_Document > > allOpenedDocuments ()
 Returns all the opened documents of the session (without postponed) More...
 
virtual bool isLoadByDemand (const std::wstring theDocID, const int theDocIndex)
 Returns true if document is not loaded yet. More...
 
virtual void registerPlugin (ModelAPI_Plugin *thePlugin)
 Registers the plugin that creates features. More...
 
virtual bool checkLicense (const std::string &thePluginName)
 Verifies the license for the plugin is valid. More...
 
virtual void processEvent (const std::shared_ptr< Events_Message > &theMessage)
 Processes the configuration file reading. More...
 
virtual std::shared_ptr< ModelAPI_Documentcopy (std::shared_ptr< ModelAPI_Document > theSource, const int theDestID)
 Copies the document to the new one. More...
 
virtual ModelAPI_ValidatorsFactoryvalidators ()
 Returns the validators factory: the only one instance per application. More...
 
virtual ModelAPI_FiltersFactoryfilters ()
 Returns the filters factory: the only one instance per application. More...
 
void setCheckTransactions (const bool theCheck)
 Sets the flag to check modifications outside the transaction or not. More...
 
 Model_Session ()
 Is called only once, on startup of the application. More...
 
virtual int transactionID ()
 Returns the global identifier of the current transaction (needed for the update algo) More...
 
virtual bool isAutoUpdateBlocked ()
 Returns true if auto-update in the application is blocked. More...
 
virtual void blockAutoUpdate (const bool theBlock)
 Set state of the auto-update of features result in the application. More...
 
virtual bool isLoading ()
 Returns true if a loading process is performed (so, no need to react on a new part creation) More...
 
virtual EVENTS_EXPORT bool groupMessages ()
 Listener that needs mostly grouped messages received returns true in this method. 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...
 

Protected Member Functions

void LoadPluginsInfo ()
 Loads (if not done yet) the information about the features and plugins. More...
 
FeaturePtr createFeature (std::string theFeatureID, Model_Document *theDocOwner)
 Creates the feature object using plugins functionality. More...
 
ModelAPI_PlugingetPlugin (const std::string &thePluginName)
 Get the plugin by name. If it is not loaded, load plugin. More...
 
void groupWhileFlush (const std::shared_ptr< Events_Message > &theMessage)
 Allows to group messages while they are flushed (for flush for groupMessages=true listeners) More...
 
EVENTS_EXPORT void flushGrouped (const Events_ID &theID)
 Sends myGroups on flush finish. 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...
 

Friends

class Model_Document
 
class Model_Objects
 

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

◆ Model_Session()

Model_Session::Model_Session ( )

Is called only once, on startup of the application.

Member Function Documentation

◆ load()

bool Model_Session::load ( const char *  theFileName)
virtual

Loads the OCAF document from the file.

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

Implements ModelAPI_Session.

◆ save()

bool Model_Session::save ( const char *  theFileName,
std::list< std::string > &  theResults 
)
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

Implements ModelAPI_Session.

◆ closeAll()

void Model_Session::closeAll ( )
virtual

Closes all documents.

Implements ModelAPI_Session.

◆ startOperation()

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

Starts a new operation (opens a transaction)

Parameters
theIdstring-identifier of the started transaction
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

Implements ModelAPI_Session.

◆ finishOperation()

void Model_Session::finishOperation ( )
virtual

Finishes the previously started operation (closes the transaction)

Implements ModelAPI_Session.

◆ abortOperation()

void Model_Session::abortOperation ( )
virtual

Aborts the operation.

Implements ModelAPI_Session.

◆ isOperation()

bool Model_Session::isOperation ( )
virtual

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

Implements ModelAPI_Session.

◆ isModified()

bool Model_Session::isModified ( )
virtual

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

Implements ModelAPI_Session.

◆ canUndo()

bool Model_Session::canUndo ( )
virtual

Returns True if there are available Undos.

Implements ModelAPI_Session.

◆ undo()

void Model_Session::undo ( )
virtual

Undoes last operation.

Implements ModelAPI_Session.

◆ canRedo()

bool Model_Session::canRedo ( )
virtual

Returns True if there are available Redos.

Implements ModelAPI_Session.

◆ redo()

void Model_Session::redo ( )
virtual

Redoes last operation.

Implements ModelAPI_Session.

◆ undoList()

std::list< std::string > Model_Session::undoList ( )
virtual

Returns stack of performed operations.

Implements ModelAPI_Session.

◆ redoList()

std::list< std::string > Model_Session::redoList ( )
virtual

Returns stack of rolled back operations.

Implements ModelAPI_Session.

◆ clearUndoRedo()

void Model_Session::clearUndoRedo ( )
virtual

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

Implements ModelAPI_Session.

◆ moduleDocument()

std::shared_ptr< ModelAPI_Document > Model_Session::moduleDocument ( )
virtual

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

Implements ModelAPI_Session.

◆ document()

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

Returns the document by ID, loads if not loaded yet. Returns null if no such document.

Implements ModelAPI_Session.

◆ hasModuleDocument()

bool Model_Session::hasModuleDocument ( )
virtual

Return true if root document has been already created.

Implements ModelAPI_Session.

◆ activeDocument()

std::shared_ptr< ModelAPI_Document > Model_Session::activeDocument ( )
virtual

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

Implements ModelAPI_Session.

◆ setActiveDocument()

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

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

Implements ModelAPI_Session.

◆ allOpenedDocuments()

std::list< std::shared_ptr< ModelAPI_Document > > Model_Session::allOpenedDocuments ( )
virtual

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

Implements ModelAPI_Session.

◆ isLoadByDemand()

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

Returns true if document is not loaded yet.

Implements ModelAPI_Session.

◆ registerPlugin()

void Model_Session::registerPlugin ( ModelAPI_Plugin thePlugin)
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)

Implements ModelAPI_Session.

◆ checkLicense()

bool Model_Session::checkLicense ( const std::string &  thePluginName)
virtual

Verifies the license for the plugin is valid.

Implements ModelAPI_Session.

◆ processEvent()

void Model_Session::processEvent ( const std::shared_ptr< Events_Message > &  theMessage)
virtual

Processes the configuration file reading.

Implements Events_Listener.

◆ copy()

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

Copies the document to the new one.

Implements ModelAPI_Session.

◆ validators()

ModelAPI_ValidatorsFactory * Model_Session::validators ( )
virtual

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

Implements ModelAPI_Session.

◆ filters()

ModelAPI_FiltersFactory * Model_Session::filters ( )
virtual

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

Implements ModelAPI_Session.

◆ setCheckTransactions()

void Model_Session::setCheckTransactions ( const bool  theCheck)
inline

Sets the flag to check modifications outside the transaction or not.

◆ transactionID()

int Model_Session::transactionID ( )
virtual

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

Implements ModelAPI_Session.

◆ isAutoUpdateBlocked()

bool Model_Session::isAutoUpdateBlocked ( )
virtual

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

Implements ModelAPI_Session.

◆ blockAutoUpdate()

void Model_Session::blockAutoUpdate ( const bool  theBlock)
virtual

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

Implements ModelAPI_Session.

◆ LoadPluginsInfo()

void Model_Session::LoadPluginsInfo ( )
protected

Loads (if not done yet) the information about the features and plugins.

◆ createFeature()

FeaturePtr Model_Session::createFeature ( std::string  theFeatureID,
Model_Document theDocOwner 
)
protected

Creates the feature object using plugins functionality.

◆ getPlugin()

ModelAPI_Plugin * Model_Session::getPlugin ( const std::string &  thePluginName)
protected

Get the plugin by name. If it is not loaded, load plugin.

◆ get()

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

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

◆ isLoading()

virtual bool ModelAPI_Session::isLoading ( )
inlinevirtualinherited

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

◆ setSession()

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

Sets the session interface implementation (once per application launch)

◆ groupMessages()

virtual EVENTS_EXPORT bool Events_Listener::groupMessages ( )
inlinevirtualinherited

Listener that needs mostly grouped messages received returns true in this method.

In this case during the message is flushed, all the new messages are grouped, not sended immideately and then sent in the end of flush.

Reimplemented in SketchSolver_Manager, and SketchPlugin_OverConstraintsResolver.

◆ groupWhileFlush()

void Events_Listener::groupWhileFlush ( const std::shared_ptr< Events_Message > &  theMessage)
protectedinherited

Allows to group messages while they are flushed (for flush for groupMessages=true listeners)

◆ flushGrouped()

void Events_Listener::flushGrouped ( const Events_ID theID)
protectedinherited

Sends myGroups on flush finish.

Field Documentation

◆ myIsLoading

bool ModelAPI_Session::myIsLoading
protectedinherited

keeps the state of the loading of the document