SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
smtk::model::DefaultSession Class Reference

A session that does no transcription. More...

#include <DefaultSession.h>

Inheritance diagram for smtk::model::DefaultSession:
[legend]
Collaboration diagram for smtk::model::DefaultSession:
[legend]

Public Member Functions

 smtkTypeMacro (DefaultSession)
 
 smtkSuperclassMacro (Session)
 
 smtkSharedFromThisMacro (Session)
 
 smtkCreateMacro (DefaultSession)
 
void backsRemoteSession (const std::string &remoteSessionName, const smtk::common::UUID &sessionId)
 Call this method to indicate that the session acts as a backing store for a remote session. More...
 
virtual std::string remoteName () const
 Returns an empty string or, when backsRemoteSession has been called, the type-name of the remote session.
 
std::string defaultFileExtension (const Model &) const override
 Return an empty string. Subclasses should override this.
 
- Public Member Functions inherited from smtk::model::Session
 smtkTypeMacroBase (smtk::model::Session)
 
 smtkSuperclassMacro (smtk::model::Session)
 
 smtkCreateMacro (smtk::model::Session)
 
virtual std::string name () const
 Return the name of the session type (i.e., the name of the modeling kernel). More...
 
virtual std::string className () const
 
smtk::common::UUID sessionId () const
 Return the session ID for this instance of the session. More...
 
int transcribe (const EntityRef &entity, SessionInfoBits flags, bool onlyDangling=true, int depth=-1)
 Transcribe an entity from a foreign modeler into an SMTK storage Resource. More...
 
virtual SessionInfoBits allSupportedInformation () const
 Return a bit vector describing what types of information can be transcribed. More...
 
const DanglingEntities & danglingEntities () const
 Return the map from dangling entityrefs to bits describing their partial transcription state.
 
void declareDanglingEntity (const EntityRef &ent, SessionInfoBits present=0)
 Mark an entity, ent, as partially transcribed. More...
 
virtual int setup (const std::string &optName, const StringList &optVal)
 Set configuration options on the session. More...
 
ResourcePtr resource () const
 Return a reference to the resource that owns this Session.
 
smtk::io::Loggerlog ()
 Return the log (obtained from the model resource).
 
virtual ~Session ()
 Destructor.
 
virtual bool splitEntity (const EntityRef &from, const EntityRefs &to) const
 
virtual bool mergeEntities (const EntityRefs &from, EntityRef &to) const
 
virtual bool splitAttributes (const EntityRef &from, const EntityRefs &to) const
 Called when an entity is being split so that attribute assignments can be updated. More...
 
virtual bool mergeAttributes (const EntityRefs &from, EntityRef &to) const
 Called when an entity is being split so that attribute assignments can be updated. More...
 
virtual bool removeGeneratedProperties (const EntityRef &ent, SessionInfoBits propFlags)
 This is used by the resource when erasing a model entity. More...
 
virtual bool splitProperties (const EntityRef &from, const EntityRefs &to) const
 Called when an entity is being split or cut into one or more descendants. More...
 
virtual bool mergeProperties (const EntityRefs &from, EntityRef &to) const
 Called when one or more entities are being merged or joined into a descendant. More...
 

Protected Member Functions

 DefaultSession ()
 Default constructor. Initializes statically-registered operators.
 
SessionInfoBits transcribeInternal (const EntityRef &entity, SessionInfoBits flags, int depth=-1) override
 Indicate that, since we have no "backing store" model, the entire model is already present.
 
void setImportingOperations (bool isImporting)
 
- Protected Member Functions inherited from smtk::model::Session
 Session ()
 Default constructor. This assigns a random session ID to each Session instance.
 
void setSessionId (const smtk::common::UUID &sessId)
 Set the session ID. More...
 
void setResource (Resource *resource)
 Inform this instance of the session that it is owned by resource.
 
virtual EntityPtr addEntityRecord (const EntityRef &entRef)
 Subclasses implement this; it should add a record for entRef to the resource.
 
virtual ArrangementHelpercreateArrangementHelper ()
 Subclasses implement this; it should return a new ArrangementHelper subclass instance. More...
 
int findOrAddRelatedEntities (const EntityRef &entRef, SessionInfoBits flags, ArrangementHelper *helper)
 Recursively called by transcribeInternal until no new entities are encountered.
 
virtual int findOrAddCellAdjacencies (const CellEntity &entRef, SessionInfoBits request, ArrangementHelper *helper)
 Subclasses implement this; it should add boundary, bounding, embedded, and embeddor cells of the current cell.
 
virtual int findOrAddCellUses (const CellEntity &entRef, SessionInfoBits request, ArrangementHelper *helper)
 Subclasses implement this; it should add use records of the current cell.
 
virtual int findOrAddOwningCell (const UseEntity &entRef, SessionInfoBits request, ArrangementHelper *helper)
 Subclasses implement this; it should add the current use's owning cell.
 
virtual int findOrAddShellAdjacencies (const UseEntity &entRef, SessionInfoBits request, ArrangementHelper *helper)
 Subclasses implement this; it should add shells bounded by or bounding the given use.
 
virtual int findOrAddUseAdjacencies (const ShellEntity &entRef, SessionInfoBits request, ArrangementHelper *helper)
 
virtual int findOrAddGroupOwner (const Group &entRef, SessionInfoBits request, ArrangementHelper *helper)
 
virtual int findOrAddFreeCells (const Model &entRef, SessionInfoBits request, ArrangementHelper *helper)
 
virtual int findOrAddRelatedModels (const Model &entRef, SessionInfoBits request, ArrangementHelper *helper)
 
virtual int findOrAddPrototype (const Instance &entRef, SessionInfoBits request, ArrangementHelper *helper)
 
virtual int findOrAddRelatedModels (const SessionRef &entRef, SessionInfoBits request, ArrangementHelper *helper)
 
virtual int findOrAddRelatedGroups (const EntityRef &entRef, SessionInfoBits request, ArrangementHelper *helper)
 
virtual int findOrAddRelatedInstances (const EntityRef &entRef, SessionInfoBits request, ArrangementHelper *helper)
 
virtual SessionInfoBits findOrAddArrangements (const EntityRef &entRef, EntityPtr entRec, SessionInfoBits flags, ArrangementHelper *helper)
 Subclasses implement this to finalize arrangement information for entRef using the helper.
 
virtual SessionInfoBits updateProperties (const EntityRef &entRef, EntityPtr entRec, SessionInfoBits flags, ArrangementHelper *helper)
 Subclasses implement this to update transcribed (not user-specified) properties of entRef.
 
virtual SessionInfoBits updateTessellation (const EntityRef &entRef, SessionInfoBits flags, ArrangementHelper *helper)
 Sublasses implement this to update the tessellation of the given entRef. More...
 
virtual SessionIOPtr createIODelegate (const std::string &format)
 Subclasses may override this method to export additional state. More...
 

Protected Attributes

std::string m_remoteSessionName
 
- Protected Attributes inherited from smtk::model::Session
DanglingEntities m_dangling
 
smtk::common::UUID m_sessionId
 
Resourcem_resource { nullptr }
 

Friends

class RemoteOperation
 

Additional Inherited Members

- Static Public Member Functions inherited from smtk::model::Session
static std::string staticClassName ()
 

Detailed Description

A session that does no transcription.

Sessions of this type do no transcription for one of two reasons:

  1. They hold "native" SMTK models, or
  2. They forward all requests to a remote session (which they "back" with local storage).

Instances of this session report their name() as "native". In the first case, they have an empty remoteName(). In the second, their remoteName() will be the type of the session they provide backing storage for.

SMTK does not provide a protocol or transport for forwarding requests. However, it does provide mechanisms for serialization and deserialization of storage, operators, and operator results. Since Session instances are the interface between modeling kernels such as OpenCascade, this makes them the place where requests must be forwarded if they are going to be.

By default this session will create instances of RemoteOperation when asked for an Operation. The RemoteOperation class calls virtual methods on DefaultSession in order to perform operations remotely (i.e., DefaultSession acts as a delegate for operators.) Subclasses which inherit DefaultSession in order to provide request forwarding must implement transcribeInternal, ableToOperateDelegate, and operateDelegate methods.

See the unitDefaultSession test for an example of how forwarding works.

See the Remus remote session for an implementation that can forward requests to Remus workers.

Member Function Documentation

◆ backsRemoteSession()

void smtk::model::DefaultSession::backsRemoteSession ( const std::string &  remoteSessionName,
const smtk::common::UUID sessId 
)

Call this method to indicate that the session acts as a backing store for a remote session.

Some applications built on SMTK need to present information about a model on a client that is remote to the geometric modeling kernel. This call indicates that the session should be used to locally mirror operations on the server.

All this does is set the session's name and session ID to match the remote session. Subclasses are responsible for overriding transcribeInternal() to fetch records from the remote session's model resource on demand.


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