Maintains WorldObject and Sense objects during the application lifetime.
More...
#include <srcontext.h>
Maintains WorldObject and Sense objects during the application lifetime.
◆ NetworkMode
enum SR::SRContext::NetworkMode |
Enumerator |
---|
EdgeMode | Identical to ServerMode.
|
ServerMode | Send data to client.
|
ClientMode | Receive data from server, keep connecting to server until available.
|
HybridMode | Same as StandAlone mode.
|
StandaloneMode | ClientMode if server is reachable, ServerMode behaviour otherwise.
|
NonBlockingClientMode | Try to connect to server once, throw exception otherwise.
|
◆ SRContext() [1/4]
SR::SRContext::SRContext |
( |
NetworkMode |
mode = NetworkMode::NonBlockingClientMode | ) |
|
Construct the SRContext.
- Parameters
-
mode | affects which implementation of a certain interface will be constructed when the associated create function is called |
- Exceptions
-
◆ SRContext() [2/4]
SR::SRContext::SRContext |
( |
std::string |
serverAddress, |
|
|
NetworkMode |
mode = NetworkMode::NonBlockingClientMode |
|
) |
| |
Construct the SRContext.
- Parameters
-
server | address to connect to |
mode | affects which implementation of a certain interface will be constructed when the associated create function is called |
- Exceptions
-
◆ SRContext() [3/4]
SR::SRContext::SRContext |
( |
bool |
lensPreference, |
|
|
NetworkMode |
mode = NetworkMode::NonBlockingClientMode |
|
) |
| |
Construct the SRContext.
- Parameters
-
lens | preference determines the initial lens state preference |
mode | affects which implementation of a certain interface will be constructed when the associated create function is called |
- Exceptions
-
◆ SRContext() [4/4]
SR::SRContext::SRContext |
( |
bool |
lensPreference, |
|
|
std::string |
serverAddress, |
|
|
NetworkMode |
mode = NetworkMode::NonBlockingClientMode |
|
) |
| |
Construct the SRContext.
- Parameters
-
lens | preference determines the initial lens state preference |
server | address to connect to |
mode | affects which implementation of a certain interface will be constructed when the associated create function is called |
- Exceptions
-
◆ ~SRContext()
SR::SRContext::~SRContext |
( |
| ) |
|
◆ addObject()
void SR::SRContext::addObject |
( |
std::string |
interfaceIdentifier, |
|
|
WorldObject * |
worldObject |
|
) |
| |
Register a world object of the given interface with the context.
- Parameters
-
interfaceIdentifier | group identifier used as part of a given interface's create function |
worldObject | to be registered as interfaceIdentifier |
◆ addSense()
void SR::SRContext::addSense |
( |
std::string |
interfaceIdentifier, |
|
|
Sense * |
sense |
|
) |
| |
Register a sense of the given interface with the context.
- Parameters
-
interfaceIdentifier | group identifier used as part of a given interface's create function |
sense | to be registered as interfaceIdentifier |
◆ create() [1/4]
static SRContext * SR::SRContext::create |
( |
bool |
lensPreference, |
|
|
const char * |
serverAddress, |
|
|
NetworkMode |
mode = NetworkMode::NonBlockingClientMode |
|
) |
| |
|
static |
create new SRContext instance
- Parameters
-
lens | preference determines the initial lens state preference |
server | address to connect to |
mode | affects which implementation of a certain interface will be constructed when the associated create function is called |
- Exceptions
-
- Returns
- SRContext* new instance
◆ create() [2/4]
static SRContext * SR::SRContext::create |
( |
bool |
lensPreference, |
|
|
NetworkMode |
mode = NetworkMode::NonBlockingClientMode |
|
) |
| |
|
static |
create new SRContext instance
- Parameters
-
lens | preference determines the initial lens state preference |
mode | affects which implementation of a certain interface will be constructed when the associated create function is called |
- Exceptions
-
- Returns
- SRContext* new instance
◆ create() [3/4]
static SRContext * SR::SRContext::create |
( |
const char * |
serverAddress, |
|
|
NetworkMode |
mode = NetworkMode::NonBlockingClientMode |
|
) |
| |
|
static |
create new SRContext instance
- Parameters
-
server | address to connect to |
mode | affects which implementation of a certain interface will be constructed when the associated create function is called |
- Exceptions
-
- Returns
- SRContext* new instance
◆ create() [4/4]
create new SRContext instance
- Parameters
-
mode | affects which implementation of a certain interface will be constructed when the associated create function is called |
- Exceptions
-
- Returns
- SRContext* new instance
◆ deleteSRContext()
static void SR::SRContext::deleteSRContext |
( |
SRContext * |
context | ) |
|
|
static |
◆ getConfiguration()
Get configuration information.
- Returns
- const Configuration & object to represent configurations of the full system
- Deprecated:
- Senses should handle their own configuration.
◆ getObjects()
const std::vector< WorldObject * > & SR::SRContext::getObjects |
( |
std::string |
interfaceIdentifier | ) |
|
Get all registered world objects of the given interface.
- Parameters
-
interfaceIdentifier | group identifier used as part of a given interface's create function |
- Returns
- std::vector<WorldObject*>& which is a list of objects registered as
interfaceIdentifier
◆ getSenses()
const std::vector< Sense * > & SR::SRContext::getSenses |
( |
std::string |
interfaceIdentifier | ) |
|
Get all registered senses of the given interface.
- Parameters
-
interfaceIdentifier | group identifier used as part of a given interface's create function |
- Returns
- std::vector<Sense*>& which is a list of senses registered as
interfaceIdentifier
◆ initialize()
void SR::SRContext::initialize |
( |
| ) |
|
Initialize all senses.
Call after all objects and senses have been added.
◆ print()
virtual void SR::SRContext::print |
( |
SR_packet & |
packet | ) |
|
|
overridevirtual |
Prints text representation of SR_packet containing eye position updates sent over network.
- Parameters
-
packet | is a C-compatible message which requires no further serialization |
Used for debugging purposes. Inherited via Receiver.
Implements SR::Receiver.
◆ receive()
virtual void SR::SRContext::receive |
( |
SR_packet & |
packet | ) |
|
|
overridevirtual |
Receives SR_packet sent over network to control remote instances of SRContext.
- Parameters
-
packet | is a C-compatible message which requires no further serialization |
SRContext specifically receives packets to achieve the desired startup behaviour. Inherited via Receiver.
Implements SR::Receiver.
◆ removeSense()
void SR::SRContext::removeSense |
( |
std::string |
interfaceIdentifier, |
|
|
Sense * |
sense |
|
) |
| |
Unregister a sense of the given interface from the context.
- Parameters
-
interfaceIdentifier | group identifier used as part of a given interface's create function |
sense | to be unregistered as interfaceIdentifier |
◆ setOther()
void SR::SRContext::setOther |
( |
uint64_t |
srContext | ) |
|
set remote SRContext to communicate with
- Parameters
-
srContext | is used to identify remote SRContext |
◆ client
instance of Client
Connection to a more centralized application in the SR system. This may connect to the application controlling the physical components or services shared between SR devices connectionToServer may point to the same instance as client unless server is connected to a remote server
TODO scope should be private (accessed to check mode in several locations to switch between implementations)
◆ connectionToServer
NetworkInterface to application controlling sense implementations.
There is one application which controls the physical components, this NetworkInterface connects to it. When a Sense is created and this is not nullptr, the functional implementation will be constructed on the remote application.
TODO scope should be private (server is setting connectionToServer directly)
◆ mode
Affects which implementation of a certain interface will be constructed when the associated create function is called.
The documentation for this class was generated from the following file: