Photon C++ Client API  5.0.7.3
Public Member Functions | List of all members
SendDirectOptions Class Reference
Inheritance diagram for SendDirectOptions:
Inheritance graph
[legend]
Collaboration diagram for SendDirectOptions:
Collaboration graph
[legend]

Public Member Functions

 SendDirectOptions (const Common::JVector< int > &targetPlayers=Common::JVector< int >(), bool fallbackRelay=false, nByte receiverGroup=Lite::ReceiverGroup::OTHERS)
 
 ~SendDirectOptions (void)
 
 SendDirectOptions (const SendDirectOptions &toCopy)
 
SendDirectOptionsoperator= (const SendDirectOptions &toCopy)
 
const Common::JVector< int > & getTargetPlayers (void) const
 
SendDirectOptionssetTargetPlayers (const Common::JVector< int > &targetPlayers)
 
nByte getReceiverGroup (void) const
 
SendDirectOptionssetReceiverGroup (nByte receiverGroup)
 
bool getFallbackRelay (void) const
 
SendDirectOptionssetFallbackRelay (bool fallbackRelay)
 
virtual Common::JStringtoString (Common::JString &retStr, bool withTypes=false) const
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const=0
 
JString toString (bool withTypes=false) const
 
- Public Member Functions inherited from ToString
virtual ~ToString (void)
 
virtual JString typeToString (void) const
 
JString toString (bool withTypes=false) const
 

Detailed Description

This class aggregates the various optional parameters that can be passed to Client::sendDirect().

See also
Client::sendDirect()

Constructor & Destructor Documentation

◆ SendDirectOptions() [1/2]

SendDirectOptions ( const Common::JVector< int > &  targetPlayers = Common::JVector<int>(),
bool  fallbackRelay = false,
nByte  receiverGroup = Lite::ReceiverGroup::OTHERS 
)

Constructor: Creates a new instance with the specified parameters.

Parameters
targetPlayerssee setTargetPlayers() - optional, defaults to an empty JVector<int>.
fallbackRelaysee setFallbackRelay() - optional, defaults to false.
receiverGroupsee setReceiverGroup() - optional, defaults to Lite::ReceiverGroup::OTHERS.

◆ ~SendDirectOptions()

~SendDirectOptions ( void  )

Destructor.

◆ SendDirectOptions() [2/2]

SendDirectOptions ( const SendDirectOptions toCopy)

Copy-Constructor: Creates a new instance that is a deep copy of the argument instance.

Parameters
toCopyThe instance to copy.

Member Function Documentation

◆ operator=()

SendDirectOptions & operator= ( const SendDirectOptions toCopy)

operator=.

Makes a deep copy of its right operand into its left operand.

This overwrites old data in the left operand.

◆ getTargetPlayers()

const JVector< int > & getTargetPlayers ( void  ) const
Returns
the currently set target players
See also
setTargetPlayers()

◆ setTargetPlayers()

SendDirectOptions & setTargetPlayers ( const Common::JVector< int > &  targetPlayers)

Sets the target players.

Set this to the player numbers of the clients, which should receive the event. The default value when not setting anything is an empty JVector and equivalent to a JVector that consists of the player numbers of all clients inside the room except for the sending client itself. Player Numbers that do not correspond to any active player inside the room get ignored.

Note
The options setTargetPlayers() and setReceiverGroup() provide alternative ways of specifying the receivers of an event and can not be combined with each other.
If getTargetPlayers() evaluates to a non-empty JVector, then the value for the target players gets used and the value for the receiver group gets ignored.
Else the value for the receiver group gets used.
Parameters
targetPlayerseither an empty JVector (to reset the value of the option to the default) or an array of integer values that correspond to the player numbers of the intended receivers
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getTargetPlayers()

◆ getReceiverGroup()

nByte getReceiverGroup ( void  ) const
Returns
the currently set receiver group
See also
setReceiverGroup()

◆ setReceiverGroup()

SendDirectOptions & setReceiverGroup ( nByte  receiverGroup)

Sets the receiver group.

Set this to one of the values from Lite::ReceiverGroup. The default value when not setting anything is Lite::ReceiverGroup::OTHERS.

Note
The options setTargetPlayers() and setReceiverGroup() provide alternative ways of specifying the receivers of an event and can not be combined with each other.
If getTargetPlayers() evaluates to a non-empty JVector, then the value for the target players gets used and the value for the receiver group gets ignored.
Else the value for the receiver group gets used.
Parameters
receiverGroupneeds to be one of the values from Lite::ReceiverGroup
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getReceiverGroup()

◆ getFallbackRelay()

bool getFallbackRelay ( void  ) const
Returns
true if the Photon game server that hosts the room should be used as a fallback relay (by an automatic call to opRaiseEvent()) for all specified receivers to which no direct connection exists, false otherwise
See also
setFallbackRelay()

◆ setFallbackRelay()

SendDirectOptions & setFallbackRelay ( bool  fallbackRelay)

Turns the fallback relay option on or off.

When the fallback relay option is turned on, then the message is relayed through the game server via opRaiseEvent() for all specified receivers to which no direct connection exists. When it is turned off, then it is only sent to recipients to which a direct connection exists and not to any other recipients. sendDirect() returns the number of recipients to which the message could be sent out. If the fallback relay option is turned on, then this number includes the recipients for which the fallback relay has been used.

Parameters
fallbackRelaytrue if the Photon game server that hosts the room should be used as a fallback relay (by an automatic call to opRaiseEvent()) for all specified receivers to which no direct connection exists, false otherwise
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getFallbackRelay()

◆ toString() [1/3]

JString & toString ( Common::JString retStr,
bool  withTypes = false 
) const
virtual
Remarks
The cost of this function depends a lot on implementation details of the implementing subclasses, but for container classes this function can become quite expensive, if the instance contains huge amounts of data, as its cost for many container class implementations increases disproportionately high to the size of the payload.
Parameters
retStrreference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.

Implements ToString.

◆ toString() [2/3]

toString
Remarks
The cost of this function depends a lot on implementation details of the implementing subclasses, but for container classes this function can become quite expensive, if the instance contains huge amounts of data, as its cost for many container class implementations increases disproportionately high to the size of the payload.
Parameters
retStrreference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.

◆ toString() [3/3]

JString toString

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.
See also
JString