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

Public Member Functions

 RaiseEventOptions (nByte channelID=0, nByte eventCaching=Lite::EventCache::DO_NOT_CACHE, const int *targetPlayers=NULL, short numTargetPlayers=0, nByte receiverGroup=Lite::ReceiverGroup::OTHERS, nByte interestGroup=0, const WebFlags &webFlags=WebFlags(), int cacheSliceIndex=0)
 
 ~RaiseEventOptions (void)
 
 RaiseEventOptions (const RaiseEventOptions &toCopy)
 
RaiseEventOptionsoperator= (const RaiseEventOptions &toCopy)
 
nByte getChannelID (void) const
 
RaiseEventOptionssetChannelID (nByte channelID)
 
nByte getEventCaching (void) const
 
RaiseEventOptionssetEventCaching (nByte eventCaching)
 
const int * getTargetPlayers (void) const
 
short getNumTargetPlayers (void) const
 
RaiseEventOptionssetTargetPlayers (const int *targetPlayers, short numTargetPlayers)
 
nByte getReceiverGroup (void) const
 
RaiseEventOptionssetReceiverGroup (nByte receiverGroup)
 
nByte getInterestGroup (void) const
 
RaiseEventOptionssetInterestGroup (nByte interestGroup)
 
const WebFlagsgetWebFlags (void) const
 
RaiseEventOptionssetWebFlags (const WebFlags &webFlags)
 
int getCacheSliceIndex (void) const
 
RaiseEventOptionssetCacheSliceIndex (int cacheSliceIndex)
 
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::opRaiseEvent().

See also
Client::opRaiseEvent()

Constructor & Destructor Documentation

◆ RaiseEventOptions() [1/2]

RaiseEventOptions ( nByte  channelID = 0,
nByte  eventCaching = Lite::EventCache::DO_NOT_CACHE,
const int *  targetPlayers = NULL,
short  numTargetPlayers = 0,
nByte  receiverGroup = Lite::ReceiverGroup::OTHERS,
nByte  interestGroup = 0,
const WebFlags webFlags = WebFlags(),
int  cacheSliceIndex = 0 
)

Constructor: Creates a new instance with the specified parameters.

Parameters
channelIDsee setChannelID() - optional, defaults to 0.
eventCachingsee setEventCaching() - optional, defaults to Lite::EventCache::DO_NOT_CACHE.
targetPlayerssee setTargetPlayers() - optional, defaults to NULL.
numTargetPlayerssee setTargetPlayers() - optional, defaults to 0.
receiverGroupsee setReceiverGroup() - optional, defaults to Lite::ReceiverGroup::OTHERS.
interestGroupsee setInterestGroup() - optional, defaults to 0.
webFlagssee setWebFlags() - optional, defaults to a default-constructed WebFlags instance.
cacheSliceIndexsee setCacheSliceIndex() - optional, defaults to 0.

◆ ~RaiseEventOptions()

~RaiseEventOptions ( void  )

Destructor.

◆ RaiseEventOptions() [2/2]

RaiseEventOptions ( const RaiseEventOptions 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=()

RaiseEventOptions & operator= ( const RaiseEventOptions toCopy)

operator=.

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

This overwrites old data in the left operand.

◆ getChannelID()

nByte getChannelID ( void  ) const
Returns
the currently set channel ID
See also
setChannelID()

◆ setChannelID()

RaiseEventOptions & setChannelID ( nByte  channelID)

Sets the channel ID.

Please see Fragmentation and Channels for further information.

Parameters
channelIDthe ID of the channel on which to send the message. Needs to be in the range from 0 to Client::getChannelCountUserChannels()
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getChannelID()

◆ getEventCaching()

nByte getEventCaching ( void  ) const
Returns
the currently set event caching option
See also
setEventCaching()

◆ setEventCaching()

RaiseEventOptions & setEventCaching ( nByte  eventCaching)

Sets the event caching option.

This option defines if the server should simply send the event, put it in the cache, remove events that are like this one or if the Cache Slice should be modified. Leave this to the default value of DO_NOT_CACHE to not use the EventCache at all.

For a more in-depth description about event caching please see Cached Events

Remarks
When using one of the options SLICE_SET_INDEX, SLICE_PURGE_INDEX or SLICE_PURGE_UP_TO_INDEX, you also need to provide a value for the CacheSliceIndex by a call to setCacheSliceIndex(). All other options except setChannelID() and also all other parameters of Client::opRaiseEvent() get ignored in this case.
Note
The value that you set for this option gets ignored if any of the following statements is true:
getReceiverGroup() == ReceiverGroup::MASTER_CLIENT
getTargetPlayers() != NULL
getInterestGroup() != 0
Parameters
eventCachingneeds to be one of the values from Lite::EventCache
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getEventCaching(), Cached Events

◆ getTargetPlayers()

const int * getTargetPlayers ( void  ) const
Returns
the currently set array of target players
See also
getNumTargetPlayers(), setTargetPlayers()

◆ getNumTargetPlayers()

short getNumTargetPlayers ( void  ) const
Returns
the number of elements in the array that is returned by getTargetPlayers()
See also
getTargetPlayers(), setTargetPlayers()

◆ setTargetPlayers()

RaiseEventOptions & setTargetPlayers ( const int *  targetPlayers,
short  numTargetPlayers 
)

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 NULL and equivalent to an array 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 will get ignored by the server.

Note
If you set this option to anything else than NULL, then any value that might have been passed for setEventCaching() will be ignored.
The options setTargetPlayers(), setInterestGroup() and setReceiverGroup() provide alternative ways of specifying the receivers of an event and can not be combined with each other.
If getTargetPlayers() evaluates to !NULL, then the value for the target players gets used and the values for the other 2 options get ignored.
Otherwise, if getInterestGroup() evaluates to !0, then the value for the interest group gets used and the value for the receiver group gets ignored.
Else the value for the receiver group gets used.
Parameters
targetPlayerseither NULL (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
numTargetPlayersthe element count of the array that is passed for targetPlayers
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getTargetPlayers(), getNumTargetPlayers()

◆ getReceiverGroup()

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

◆ setReceiverGroup()

RaiseEventOptions & 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
If you set this option to Lite::ReceiverGroup::MASTER_CLIENT, then any value that might have been passed for setEventCaching() will be ignored.
The options setTargetPlayers(), setInterestGroup() and setReceiverGroup() provide alternative ways of specifying the receivers of an event and can not be combined with each other.
If getTargetPlayers() evaluates to !NULL, then the value for the target players gets used and the values for the other 2 options get ignored.
Otherwise, if getInterestGroup() evaluates to !0, then the value for the interest group 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()

◆ getInterestGroup()

nByte getInterestGroup ( void  ) const
Returns
the currently set interest group
See also
setInterestGroup()

◆ setInterestGroup()

RaiseEventOptions & setInterestGroup ( nByte  interestGroup)

Sets the interest group.

Set this to a value between 0 and 255. The default value when not setting anything is 0. More information about interest groups can be found at Interest Groups.

Note
If you set this option to anything else than 0, then any value that might have been passed for setEventCaching() will be ignored.
The options setTargetPlayers(), setInterestGroup() and setReceiverGroup() provide alternative ways of specifying the receivers of an event and can not be combined with each other.
If getTargetPlayers() evaluates to !NULL, then the value for the target players gets used and the values for the other 2 options get ignored.
Otherwise, if getInterestGroup() evaluates to !0, then the value for the interest group gets used and the value for the receiver group gets ignored.
Else the value for the receiver group gets used.
Parameters
interestGroupthe number of the interest group to which the event should be sent
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getInterestGroup(), Interest Groups

◆ getWebFlags()

const WebFlags & getWebFlags ( void  ) const
Returns
the currently set web flags options
See also
setWebFlags()

◆ setWebFlags()

RaiseEventOptions & setWebFlags ( const WebFlags webFlags)

Sets the web flags options.

For more information see class WebFlags.

Parameters
webFlagsan instance of class WebFlags
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getWebFlags(), WebFlags

◆ getCacheSliceIndex()

int getCacheSliceIndex ( void  ) const
Returns
the currently set cache slice index
See also
setCacheSliceIndex()

◆ setCacheSliceIndex()

RaiseEventOptions & setCacheSliceIndex ( int  cacheSliceIndex)

Sets the index of the cache slice that should be used in conjunction with the value that you have passed to setEventCaching().

When you pass one of the options SLICE_SET_INDEX, SLICE_PURGE_INDEX or SLICE_PURGE_UP_TO_INDEX to setEventCaching(), then you also need to provide the cache slice index for that option to setCacheSliceIndex().

Parameters
cacheSliceIndexthe index of the cache slice to which the event should be added
Returns
a reference to the instance on which it was called to allow for chaining multiple setter calls
See also
getCacheSliceIndex(), setEventCaching(), Cached Events

◆ 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