|
VR-Engage
2.3
|
Holds the parsed configuration for the Ownership Transfer feature, provides typed policy accessors, allocates request IDs, and coordinates divest-before-exit and voluntary-disconnect behavior. All policy fields are default-initialised so a default-constructed instance is always safe to query before the Lua file is loaded.
Override parseConfiguration() in a subclass to customise how settings are read from the Lua table, or use the setters directly to populate the configuration programmatically. Call DtOwnershipTransferManager::registerCreator<CustomType>() before DtPlayerStationApp::initialize() to substitute a custom derived type.
#include <ownershipTransferManager.h>
Public Member Functions | |
| DtOwnershipTransferManager ()=default | |
| DtOwnershipTransferManager (const DtOwnershipTransferManager &)=delete | |
| DtOwnershipTransferManager & | operator= (const DtOwnershipTransferManager &)=delete |
| virtual | ~DtOwnershipTransferManager () override |
| virtual void | initialize (DtPlayerStationApp *app) |
| virtual void | requestExit () |
Accessors | |
| bool | enabled () const |
| double | acquireTimeoutSeconds () const |
| double | idleReleaseTimeoutSeconds () const |
| bool | isOwnershipTransferAvailable () const |
| bool | roleTriggersOwnershipTransfer (const DtEntityIdentifier &entityId, const std::string &roleName, const std::string &displayLayout, bool spectatorMode) const |
Mutators | |
| void | setEnabled (bool enabled) |
| void | setAcquireTimeoutSeconds (double seconds) |
| void | setIdleReleaseTimeoutSeconds (double seconds) |
Request ID allocation | |
| uint64_t | nextRequestId () |
Parsing | |
| virtual void | parseConfiguration (DtInitTable table) |
Public Member Functions inherited from makVre::DtVreUniqueBase< DtOwnershipTransferManager > | |
| DtVreUniqueBase () | |
| virtual | ~DtVreUniqueBase () |
| std::string | type () const override |
Public Member Functions inherited from makVre::DtVreUniqueObject | |
| DtVreUniqueObject () | |
| virtual | ~DtVreUniqueObject () |
Public Member Functions inherited from makVre::DtVreBase | |
| DtVreBase () | |
| virtual | ~DtVreBase ()=default |
| virtual void | setName (const std::string &name) |
| virtual std::string | name () const |
Protected Member Functions | |
| virtual void | handleMainWindowCloseRequested () |
| virtual bool | beginDivest () |
| virtual void | completeDivest () |
| virtual void | completeExit () |
| virtual void | cancelDivest (const std::string &reason) |
| virtual DtVreMessageResult | handleDivestResponse (DtVreMessage *message) |
| virtual DtVreMessageResult | handleStopConnectionRequest (DtVreMessage *message) |
Protected Attributes | |
| DtPlayerStationApp * | myApp = nullptr |
| bool | myEnabled = true |
| double | myAcquireTimeoutSeconds = 10.0 |
| double | myIdleReleaseTimeoutSeconds = 10.0 |
| uint64_t | myNextRequestId = 1 |
| DtOwnershipTransferExitEventFilter * | myExitEventFilter = nullptr |
| DtVreMessageHandlerGroup | myMessageHandlers |
| bool | myDivestInProgress = false |
| bool | myExitCloseApproved = false |
| bool | myExitSkipCloseDialog = false |
| std::set< unsigned long long > | myDivestRequestIds |
| bool | myDisconnectPending = false |
| StopConnectionDriverMessage::StopConnectionDriverData | myDisconnectDriverData |
Protected Attributes inherited from makVre::DtVreBase | |
| std::string | myName |
Friends | |
| class | DtOwnershipTransferExitEventFilter |
Additional Inherited Members | |
Public Types inherited from makVre::DtVreUniqueBase< DtOwnershipTransferManager > | |
| using | Super |
| using | Ptr |
| using | Uptr |
Static Public Member Functions inherited from makVre::DtVreUniqueBase< DtOwnershipTransferManager > | |
| static std::string | Type () |
| static Uptr | create () |
| static void | registerCreator () |
Static Protected Member Functions inherited from makVre::DtVreUniqueBase< DtOwnershipTransferManager > | |
| static std::shared_ptr< DtBaseCreator< DtOwnershipTransferManager > > & | creator () |
|
default |
Referenced by DtOwnershipTransferManager(), and operator=().
|
delete |
References DtOwnershipTransferManager().
|
overridevirtual |
|
delete |
References DtOwnershipTransferManager().
|
virtual |
Stores the back-pointer to the owning application.
Called by DtPlayerStationApp after construction. Must be invoked before isOwnershipTransferAvailable() or roleTriggersOwnershipTransfer() are called, since those methods access app state.
Installs a main-window filter that defers application exit until divest completes.
| app | Pointer to the owning DtPlayerStationApp instance. |
|
virtual |
Initiates application exit after divesting all entities owned by this station.
If ownership transfer is unavailable or no entity is owned, immediately requests application close. Otherwise displays a persistent divest notification and submits release requests. The close proceeds after all releases succeed, or after a release fails; the connector's ownership transfer timeout bounds the no-response case.
| bool makVre::DtOwnershipTransferManager::enabled | ( | ) | const |
Returns true when the Ownership Transfer feature is active.
Referenced by setEnabled().
| double makVre::DtOwnershipTransferManager::acquireTimeoutSeconds | ( | ) | const |
Returns the maximum seconds to wait for an acquire response.
| double makVre::DtOwnershipTransferManager::idleReleaseTimeoutSeconds | ( | ) | const |
Returns the number of seconds an owned entity may sit idle in the choose-role panel before ownership is automatically released. A value of 0.0 disables the idle-release timer entirely.
| bool makVre::DtOwnershipTransferManager::isOwnershipTransferAvailable | ( | ) | const |
Returns true when the system-level conditions for ownership transfer are met.
Checks that the feature is enabled, the ownship backend is running, and the station is in an externally VR-Forces-hosted joined session by reading the relevant attributes from the application attribute store. Returns false for unhosted and self-hosted sessions.
| bool makVre::DtOwnershipTransferManager::roleTriggersOwnershipTransfer | ( | const DtEntityIdentifier & | entityId, |
| const std::string & | roleName, | ||
| const std::string & | displayLayout, | ||
| bool | spectatorMode ) const |
Returns true when a role engagement should trigger ownership transfer.
Resolves the entity type from the attribute store's entity resolver, then evaluates all policy conditions: the feature must be enabled, the station must not be in spectator mode, and the role's Lua configuration must set takeOwnership to true (via the player creation palette).
| entityId | The entity being engaged. |
| roleName | The name of the role being engaged. |
| displayLayout | The display layout name for the station. |
| spectatorMode | True when the station is in spectator mode. |
| void makVre::DtOwnershipTransferManager::setEnabled | ( | bool | enabled | ) |
Sets the master feature toggle.
References enabled().
| void makVre::DtOwnershipTransferManager::setAcquireTimeoutSeconds | ( | double | seconds | ) |
Sets the acquire timeout in seconds. Values <= 0 are ignored with a warning.
| void makVre::DtOwnershipTransferManager::setIdleReleaseTimeoutSeconds | ( | double | seconds | ) |
Sets the idle-release timeout in seconds. A value of 0.0 disables the timer. Negative values are clamped to 0.0.
| uint64_t makVre::DtOwnershipTransferManager::nextRequestId | ( | ) |
Allocates and returns the next ownership transfer request identifier.
Returns a monotonically increasing uint64_t used to correlate request, status, and terminal response messages across timeouts and retries.
|
virtual |
Populate this instance from a DtInitTable.
Reads the OwnershipTransfer Lua table fields: enabled, acquireTimeoutSeconds, and idleReleaseTimeoutSeconds. Override in a subclass to extend or replace the default parsing logic.
| table | The DtInitTable wrapping the OwnershipTransfer Lua table. |
|
protectedvirtual |
Handles a close event before VR-Vantage begins shutdown.
|
protectedvirtual |
Starts releases for all owned entities.
|
protectedvirtual |
Completes a pending exit or voluntary disconnect after every release succeeds or is skipped.
|
protectedvirtual |
Resumes application exit after successful divest or a failed exit-time release.
|
protectedvirtual |
Cancels a pending voluntary disconnect after a release failure.
|
protectedvirtual |
Processes terminal responses for release requests created by beginDivest().
A skipped release permits the deferred action to proceed. A failed release permits a pending application exit to proceed, but cancels a pending voluntary network disconnect.
|
protectedvirtual |
Defers a voluntary disconnect until owned entities are divested.
|
friend |
References DtOwnershipTransferExitEventFilter.
Referenced by DtOwnershipTransferExitEventFilter.
|
protected |
Back-pointer to the owning DtPlayerStationApp.
Set by initialize(). Used by isOwnershipTransferAvailable() and roleTriggersOwnershipTransfer() to access the app attribute store, entity resolver, and player creation palette.
|
protected |
|
protected |
|
protected |
Seconds an owned entity may sit idle in the choose-role panel before ownership is automatically released.
Set to 0.0 to disable the idle-release timer entirely. Negative values supplied via setIdleReleaseTimeoutSeconds() or the Lua config are clamped to 0.0.
|
protected |
Monotonic counter used to assign unique request identifiers.
Incremented by nextRequestId() on each call.
|
protected |
Main-window filter that defers close events until divest succeeds.
|
protected |
Member-scope instance of message handler group.
Used to manage message handler connections for this component. Handlers connected through this group will be automatically disconnected when this component is destroyed.
|
protected |
True while an exit or voluntary disconnect waits for owned entities to be divested.
|
protected |
Allows the close event posted after a successful divest to reach VR-Vantage.
|
protected |
Suppresses the VR-Vantage confirmation after this manager already confirmed a close.
|
protected |
Release request IDs that must succeed before the deferred action may resume.
|
protected |
True when a voluntary network disconnect is waiting for divest completion.
|
protected |
Driver Data retained while the voluntary disconnect is deferred.