VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtOwnershipTransferManager Class Reference

Detailed Description

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>

Inheritance diagram for makVre::DtOwnershipTransferManager:
[legend]

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 ()
 

Constructor & Destructor Documentation

◆ DtOwnershipTransferManager() [1/2]

makVre::DtOwnershipTransferManager::DtOwnershipTransferManager ( )
default

◆ DtOwnershipTransferManager() [2/2]

makVre::DtOwnershipTransferManager::DtOwnershipTransferManager ( const DtOwnershipTransferManager & )
delete

◆ ~DtOwnershipTransferManager()

virtual makVre::DtOwnershipTransferManager::~DtOwnershipTransferManager ( )
overridevirtual

Member Function Documentation

◆ operator=()

DtOwnershipTransferManager & makVre::DtOwnershipTransferManager::operator= ( const DtOwnershipTransferManager & )
delete

◆ initialize()

virtual void makVre::DtOwnershipTransferManager::initialize ( DtPlayerStationApp * app)
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.

Parameters
appPointer to the owning DtPlayerStationApp instance.

◆ requestExit()

virtual void makVre::DtOwnershipTransferManager::requestExit ( )
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.

◆ enabled()

bool makVre::DtOwnershipTransferManager::enabled ( ) const

Returns true when the Ownership Transfer feature is active.

Referenced by setEnabled().

◆ acquireTimeoutSeconds()

double makVre::DtOwnershipTransferManager::acquireTimeoutSeconds ( ) const

Returns the maximum seconds to wait for an acquire response.

◆ idleReleaseTimeoutSeconds()

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.

◆ isOwnershipTransferAvailable()

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.

◆ roleTriggersOwnershipTransfer()

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).

Parameters
entityIdThe entity being engaged.
roleNameThe name of the role being engaged.
displayLayoutThe display layout name for the station.
spectatorModeTrue when the station is in spectator mode.

◆ setEnabled()

void makVre::DtOwnershipTransferManager::setEnabled ( bool enabled)

Sets the master feature toggle.

References enabled().

◆ setAcquireTimeoutSeconds()

void makVre::DtOwnershipTransferManager::setAcquireTimeoutSeconds ( double seconds)

Sets the acquire timeout in seconds. Values <= 0 are ignored with a warning.

◆ setIdleReleaseTimeoutSeconds()

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.

◆ nextRequestId()

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.

◆ parseConfiguration()

virtual void makVre::DtOwnershipTransferManager::parseConfiguration ( DtInitTable table)
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.

Parameters
tableThe DtInitTable wrapping the OwnershipTransfer Lua table.

◆ handleMainWindowCloseRequested()

virtual void makVre::DtOwnershipTransferManager::handleMainWindowCloseRequested ( )
protectedvirtual

Handles a close event before VR-Vantage begins shutdown.

◆ beginDivest()

virtual bool makVre::DtOwnershipTransferManager::beginDivest ( )
protectedvirtual

Starts releases for all owned entities.

Returns
True when at least one release was queued; false when no entity is owned.

◆ completeDivest()

virtual void makVre::DtOwnershipTransferManager::completeDivest ( )
protectedvirtual

Completes a pending exit or voluntary disconnect after every release succeeds or is skipped.

◆ completeExit()

virtual void makVre::DtOwnershipTransferManager::completeExit ( )
protectedvirtual

Resumes application exit after successful divest or a failed exit-time release.

◆ cancelDivest()

virtual void makVre::DtOwnershipTransferManager::cancelDivest ( const std::string & reason)
protectedvirtual

Cancels a pending voluntary disconnect after a release failure.

◆ handleDivestResponse()

virtual DtVreMessageResult makVre::DtOwnershipTransferManager::handleDivestResponse ( DtVreMessage * message)
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.

◆ handleStopConnectionRequest()

virtual DtVreMessageResult makVre::DtOwnershipTransferManager::handleStopConnectionRequest ( DtVreMessage * message)
protectedvirtual

Defers a voluntary disconnect until owned entities are divested.

Friends And Related Symbol Documentation

◆ DtOwnershipTransferExitEventFilter

friend class DtOwnershipTransferExitEventFilter
friend

Member Data Documentation

◆ myApp

DtPlayerStationApp* makVre::DtOwnershipTransferManager::myApp = nullptr
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.

◆ myEnabled

bool makVre::DtOwnershipTransferManager::myEnabled = true
protected

◆ myAcquireTimeoutSeconds

double makVre::DtOwnershipTransferManager::myAcquireTimeoutSeconds = 10.0
protected

◆ myIdleReleaseTimeoutSeconds

double makVre::DtOwnershipTransferManager::myIdleReleaseTimeoutSeconds = 10.0
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.

Note
Default value is 10.0 seconds.

◆ myNextRequestId

uint64_t makVre::DtOwnershipTransferManager::myNextRequestId = 1
protected

Monotonic counter used to assign unique request identifiers.

Incremented by nextRequestId() on each call.

◆ myExitEventFilter

DtOwnershipTransferExitEventFilter* makVre::DtOwnershipTransferManager::myExitEventFilter = nullptr
protected

Main-window filter that defers close events until divest succeeds.

◆ myMessageHandlers

DtVreMessageHandlerGroup makVre::DtOwnershipTransferManager::myMessageHandlers
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.

◆ myDivestInProgress

bool makVre::DtOwnershipTransferManager::myDivestInProgress = false
protected

True while an exit or voluntary disconnect waits for owned entities to be divested.

◆ myExitCloseApproved

bool makVre::DtOwnershipTransferManager::myExitCloseApproved = false
protected

Allows the close event posted after a successful divest to reach VR-Vantage.

◆ myExitSkipCloseDialog

bool makVre::DtOwnershipTransferManager::myExitSkipCloseDialog = false
protected

Suppresses the VR-Vantage confirmation after this manager already confirmed a close.

◆ myDivestRequestIds

std::set<unsigned long long> makVre::DtOwnershipTransferManager::myDivestRequestIds
protected

Release request IDs that must succeed before the deferred action may resume.

◆ myDisconnectPending

bool makVre::DtOwnershipTransferManager::myDisconnectPending = false
protected

True when a voluntary network disconnect is waiting for divest completion.

◆ myDisconnectDriverData

StopConnectionDriverMessage::StopConnectionDriverData makVre::DtOwnershipTransferManager::myDisconnectDriverData
protected

Driver Data retained while the voluntary disconnect is deferred.


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