omni::connect::core::LiveSessionInfo

Defined in omni/connect/core/LiveSessionInfo.h

class LiveSessionInfo

An interface class that collects the URIs and strings required by a live session.

The LiveSessionInfo class is first instantiated with the root stage URI (omniverse://server/folder/stage.usd), then LiveSessionInfo::getSessionNames() can be used to list the available sessions.

Once a session name is determined, LiveSessionInfo::init()

will finish the initialization of all of the paths and the other methods can be used.

Live session context data is stored under a

.live folder within the root stage’s folder. Stage-specific and session-specific folders are used under the .live folder to contain all of the data in one place. These are the important files within the session folder:

  • Live Layer URI: <stage_folder> / <.live> / <my_usd_file.live> / <session_name.live> / root.live

  • Live Config URI: <stage_folder> / <.live> / <my_usd_file.live> / <session_name.live> / __session__.toml

  • Live Channel URI: <stage_folder> / <.live> / <my_usd_file.live> / <session_name.live> / __session__.channel

Possible usecase of browsing for existing sessions on a root USD stage and connecting to one:

Note

The static factory method LiveSessionInfo::create() returns a std::shared_ptr so object lifetime is managed by scope.

Public Types

using SessionNames = std::vector<std::string>

A list of session names.

Public Functions

~LiveSessionInfo()
SessionNames getSessionNames() const

Get a list of existing sessions for the stage.

Returns

A list of session names Note: this validates that each session actually exists by checking for the existence of the session config file

bool init(const std::string &sessionName)

Set the session name and initialize the class so all member functions return complete URIs.

Many of the class methods don’t function correctly until this method is called.

Session names must start with an alphabetical character, but may contain alphanumeric, hyphen, or underscore characters.

Note

The session doesn’t need to already exist to be valid, the intent is to generate all of the necessary URIs so the application can then either join or create the new session files.

Parameters

sessionName – The intended name of the live session

Returns

true if the name is valid, false if it contains invalid characters

const std::string &getName() const

Get the live session name.

This method returns an empty string until the session name is set with LiveSessionInfo::init()

Returns

The name of the live session

bool exists() const

Check for the existence of the session config (TOML) file.

This method returns false until the session name is set with LiveSessionInfo::init()

Returns

Whether the session config file exists

const std::string &getAllSessionsFolderUri() const

Get the URI for the folder that contains all of the live sessions.

The Connector may want to watch this folder for new sessions, or poll it in a way that is different than how this class does.

eg. <stage_folder> / <.live> / <my_usd_file.live>

Returns

The folder URI where all of the live sessions for the stage are stored

const std::string &getRootStageUri() const

Get the root stage URI for the live session.

Returns

The root stage URI that was passed to the create() method

const std::string &getLiveLayerUri() const

Get the URI for the .live layer file.

This method returns an empty string until the session name is set with LiveSessionInfo::init()

Returns

The .live layer URI for the session

const std::string &getConfigUri() const

Get the URI for the live session configuration file (currently implemented as TOML)

This config file URI should be passed to getLiveSessionConfig() or createLiveSessionConfigFile()

This method returns an empty string until the session name is set with LiveSessionInfo::init()

Returns

The live session configuration file URI

const std::string &getChannelUri() const

Get the URI for the live session Omniverse message channel file.

This channel file URI should be passed to LiveSessionChannel::create()

This method returns an empty string until the session name is set with LiveSessionInfo::init()

Returns

The live session message channel URI

Public Static Functions

static std::shared_ptr<LiveSessionInfo> create(const std::string &rootStageUri)

Create an Omniverse live session info class.

Parameters

rootStageUri – The URI of the root USD stage in the live session

Returns

A live session info interface shared pointer (std::shared_ptr<LiveSessionInfo>). If rootStageUri is invalid then returns nullptr.

static std::string getSessionNameFromUri(const std::string &sessionLink)

Extracts the sessionName from a live session link uri ie: omniverse://ov/helloworld.usd?live_session_name=Default -> Default.

If sessionLink doesn’t contain the query string “live_session_name”, the resulting sessionName will be an empty string ex: omniverse://ov/helloworld.usd -> “” ex: omniverse://ov/helloworld.usd?live_session_NAME=Default -> “”

Parameters

sessionLink – Full session link uri

Returns

the live session name