Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
RemoteViz::Rendering::Service Class Reference

RemoteViz More...

#include <RemoteViz/Rendering/Service.h>

Public Member Functions

void dispatch () const
 This method has to be used with the ServiceSettings::INVENTOR_SERVICE and ServiceSettings::INDEPENDENT_SERVICE mode in a loop.
 
bool open (std::shared_ptr< const ServiceSettings > settings)
 Opens the rendering service.
 
bool close ()
 Closes the rendering service.
 
bool isRunning () const
 This method is used to know if the rendering service is running.
 
void createRenderArea (const std::string &id, unsigned int width, unsigned int height, std::shared_ptr< const RenderAreaHardware > renderAreaHardware)
 Forces the creation of a renderArea.
 
std::shared_ptr< RenderAreagetRenderArea (const std::string &id) const
 Gets a RenderArea from id.
 
std::shared_ptr< RenderAreagetRenderArea (unsigned int index) const
 Gets a RenderArea from index.
 
unsigned int getNumRenderAreas () const
 Gets the number of renderAreas.
 
std::shared_ptr< const ServiceSettingsgetSettings () const
 Gets the settings of the service.
 
void addListener (std::shared_ptr< ServiceListener > listener)
 Adds a ServiceListener.
 
void removeListener (std::shared_ptr< ServiceListener > listener)
 Removes a ServiceListener.
 
void removeAllListeners ()
 Removes all ServiceListeners.
 
unsigned int getNumListeners () const
 Gets the number of ServiceListener.
 
std::shared_ptr< ClientgetClient (const std::string &id) const
 Gets a Client from id.
 
std::shared_ptr< ClientgetClient (unsigned int index) const
 Gets a Client from index.
 
unsigned int getNumClients () const
 Gets the number of clients.
 

Static Public Member Functions

static Serviceinstance ()
 Renderering service instance (Singleton)
 

Detailed Description

RemoteViz

Defines the RemoteViz rendering service.

This class uses the singleton pattern restricting its instantiation to a single unique object in the program. Use the Service::instance() method to get the Service object.

To use RemoteViz, the service must first be opened with the method Service::open(). Create an instance of ServiceSettings to set properties such as the Service IP address and port.

Create an implementation of class ServiceListener to receive notifications from the Service. Register a listener using the addListener() method.

The Service object can also be used to query the current Clients and RenderAreas.

Thread-safety :
All methods in the RemoteViz API are thread-safe. I.e., they are guaranteed to be free of race conditions when accessed by multiple threads simultaneously. But note this limitation with the class Service:

SEE ALSO

ServiceSettings, ServiceListener, Client, RenderArea

Definition at line 85 of file Service.h.

Member Function Documentation

◆ addListener()

void RemoteViz::Rendering::Service::addListener ( std::shared_ptr< ServiceListener listener)

Adds a ServiceListener.

Parameters
listener: object that listens to the service events

◆ close()

bool RemoteViz::Rendering::Service::close ( )

Closes the rendering service.

If renderAreas still exist, this method will dispose them and close the rendering service.

Returns
true if successful, otherwise returns false.

◆ createRenderArea()

void RemoteViz::Rendering::Service::createRenderArea ( const std::string &  id,
unsigned int  width,
unsigned int  height,
std::shared_ptr< const RenderAreaHardware renderAreaHardware 
)

Forces the creation of a renderArea.


This method is optional. The other way to create a renderArea is to return true to the callback ServiceListener::onPendingCreateRenderArea when a connection requests it.
If the renderArea already exists, the call will be ignored.

Parameters
id: ID identifying the RenderArea
width: renderArea width
height: renderArea height
renderAreaHardware: renderArea hardware settings.

◆ dispatch()

void RemoteViz::Rendering::Service::dispatch ( ) const

This method has to be used with the ServiceSettings::INVENTOR_SERVICE and ServiceSettings::INDEPENDENT_SERVICE mode in a loop.

It processes all waiting RemoteViz events.

◆ getClient() [1/2]

std::shared_ptr< Client > RemoteViz::Rendering::Service::getClient ( const std::string &  id) const

Gets a Client from id.

Range is [0..getNumClients - 1].

Parameters
id: ID identifying the client
Returns
the client object if the id exists, otherwise returns null.

◆ getClient() [2/2]

std::shared_ptr< Client > RemoteViz::Rendering::Service::getClient ( unsigned int  index) const

Gets a Client from index.

Range is [0..getNumClients - 1].

Parameters
index: index identifying the client
Returns
the client object if the index exists, otherwise returns null.

◆ getNumClients()

unsigned int RemoteViz::Rendering::Service::getNumClients ( ) const

Gets the number of clients.

Returns
the number clients attached to the service.

◆ getNumListeners()

unsigned int RemoteViz::Rendering::Service::getNumListeners ( ) const

Gets the number of ServiceListener.

Returns
number of ServiceListener.

◆ getNumRenderAreas()

unsigned int RemoteViz::Rendering::Service::getNumRenderAreas ( ) const

Gets the number of renderAreas.

Returns
the renderArea number of the Instance.

◆ getRenderArea() [1/2]

std::shared_ptr< RenderArea > RemoteViz::Rendering::Service::getRenderArea ( const std::string &  id) const

Gets a RenderArea from id.

Range is [0..getNumRenderAreas - 1].

Parameters
id: ID identifying the RenderArea
Returns
the renderArea object if the id exists, otherwise returns null.

◆ getRenderArea() [2/2]

std::shared_ptr< RenderArea > RemoteViz::Rendering::Service::getRenderArea ( unsigned int  index) const

Gets a RenderArea from index.

Range is [0..getNumRenderAreas - 1].

Parameters
index: index identifying the renderArea
Returns
the renderArea object if the index exists, otherwise returns null.

◆ getSettings()

std::shared_ptr< const ServiceSettings > RemoteViz::Rendering::Service::getSettings ( ) const

Gets the settings of the service.

Returns
the service settings object

◆ instance()

static Service * RemoteViz::Rendering::Service::instance ( )
static

Renderering service instance (Singleton)

Returns
the service instance

◆ isRunning()

bool RemoteViz::Rendering::Service::isRunning ( ) const

This method is used to know if the rendering service is running.

Returns
true if running; otherwise returns false.

◆ open()

bool RemoteViz::Rendering::Service::open ( std::shared_ptr< const ServiceSettings settings)

Opens the rendering service.

Parameters
settings: the settings of the instance. This object cannot be null.

SEE ALSO

Service::getSettings

Returns
true if successful, otherwise returns false.

◆ removeAllListeners()

void RemoteViz::Rendering::Service::removeAllListeners ( )

Removes all ServiceListeners.

◆ removeListener()

void RemoteViz::Rendering::Service::removeListener ( std::shared_ptr< ServiceListener listener)

Removes a ServiceListener.

Parameters
listener: object that listens to the service events

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