CTR Pia  4.11.3
Game Communication Engine
nn::pia::clone::EventCloneElement< Value_, BUFFER_SIZE, SerializePolicy_ > Class Template Reference

Manages the sending and receiving of events. More...

+ Inheritance diagram for nn::pia::clone::EventCloneElement< Value_, BUFFER_SIZE, SerializePolicy_ >:

Public Types

typedef u16 Id
 Specifies the type of the ID for identifying clone elements.
 
typedef SerializePolicy_ SerializePolicy
 Specifies the algorithm to use for serializing Value.
 
typedef Value_ Value
 Specifies the argument type to be sent with this event.
 

Public Member Functions

 EventCloneElement ()
 Instantiates the object with default parameters (default constructor).
 
virtual ~EventCloneElement ()
 Destroys the object.
 
const ClockValueGetClock () const
 Gets the pointer to the issued time for when the current event was raised. More...
 
const CloneBaseGetCloneBase () const
 Gets the CloneBase this object is registered to. More...
 
Index GetEventIndex () const
 Gets the index of the event currently being referenced. More...
 
Id GetId () const
 Gets the ID. More...
 
const CloneProtocolGetProtocol () const
 Gets the CloneProtocol of the CloneBase this object is registered to. More...
 
StationIndex GetSetterStationIndex () const
 Gets the index of the station that raised the event being referenced. More...
 
size_t GetUsingBufferNum () const
 Gets the current number of event buffers in use. More...
 
const ValueGetValue () const
 Gets the pointer to the value for when the current event was raised. More...
 
const ValueHandleNext ()
 References the next event. More...
 
bool IsDropEvent () const
 Gets whether a drop event error occurred. More...
 
bool IsReadyToSetValue () const
 Determines whether a value can be set. More...
 
bool IsRegisteredWithCloneBase () const
 Determines whether the object is registered with CloneBase. More...
 
bool IsRegisteredWithProtocol () const
 Determines whether the object is registered with CloneProtocol. More...
 
nn::Result SetValue (const Value &value, bool isEnableSendDelay=false)
 Raises an event. More...
 
void Trace (u64 flag) const
 Prints information that is useful for debugging. More...
 
Profiling
nn::Result SetProfiler (CloneProfilerBase *pSendProfiler, CloneProfilerBase *pReceiveProfiler)
 Sets an object to manage send/receive profiling. More...
 
const CloneProfilerBaseGetSendProfiler () const
 Gets the object configured to manage send profiling. More...
 
const CloneProfilerBaseGetReceiveProfiler () const
 Gets the object configured to manage receive profiling. More...
 
void ResetProfiler ()
 Resets the results of send/receive profiling. More...
 
u32 GetProfiledLatestSendCount (StationIndex stationIndex) const
 Gets the send count for the last CloneProfiler::LATEST_BUFFER_SIZE times common::Scheduler::Dispatch was called. More...
 
u32 GetProfiledLatestSendSize (StationIndex stationIndex) const
 Gets the total amount of data, in bytes, sent during the last CloneProfiler::LATEST_BUFFER_SIZE times of common::Scheduler::Dispatch being called. More...
 
u32 GetProfiledTotalSendCount (StationIndex stationIndex) const
 Gets the number of times sent since ResetProfiler was called. More...
 
u32 GetProfiledTotalSendSize (StationIndex stationIndex) const
 Gets the amount of data, in bytes, sent since ResetProfiler was called. More...
 
u32 GetProfiledLatestReceiveCount (StationIndex stationIndex) const
 Gets the receive count for the last CloneProfiler::LATEST_BUFFER_SIZE times common::Scheduler::Dispatch was called. More...
 
u32 GetProfiledLatestReceiveSize (StationIndex stationIndex) const
 Gets the total amount of data, in bytes, received during the last CloneProfiler::LATEST_BUFFER_SIZE times of common::Scheduler::Dispatch being called. More...
 
u32 GetProfiledTotalReceiveCount (StationIndex stationIndex) const
 Gets the number of times received since ResetProfiler was called. More...
 
u32 GetProfiledTotalReceiveSize (StationIndex stationIndex) const
 Gets the amount of data, in bytes, received since ResetProfiler was called. More...
 

Detailed Description

template<typename Value_, size_t BUFFER_SIZE, typename SerializePolicy_ = HostByteOrderSerializePolicy<Value_>>
class nn::pia::clone::EventCloneElement< Value_, BUFFER_SIZE, SerializePolicy_ >

Manages the sending and receiving of events.

Template Parameters
Value_Specifies the value type to specify when raising an event. You must specify a value even if none is required.
BUFFER_SIZESpecifies the size of the event buffer. Specify a positive value.
SerializePolicy_Specifies the algorithm to use for serializing Value.


Revision History:
2013-07-18 Initial version.

Member Function Documentation

template<typename Value_ , size_t BUFFER_SIZE, typename SerializePolicy_ = HostByteOrderSerializePolicy<Value_>>
const ClockValue* nn::pia::clone::EventCloneElement< Value_, BUFFER_SIZE, SerializePolicy_ >::GetClock ( ) const
inline

Gets the pointer to the issued time for when the current event was raised.

Returns
Returns the pointer to the issued time for when the current event was raised. Returns NULL when no event is being referenced.
const CloneBase* nn::pia::clone::CloneElementBase::GetCloneBase ( ) const
inlineinherited

Gets the CloneBase this object is registered to.

Returns
Returns the CloneBase this object is registered to.
template<typename Value_ , size_t BUFFER_SIZE, typename SerializePolicy_ = HostByteOrderSerializePolicy<Value_>>
Index nn::pia::clone::EventCloneElement< Value_, BUFFER_SIZE, SerializePolicy_ >::GetEventIndex ( ) const
inline

Gets the index of the event currently being referenced.

Returns
Returns the index of the event currently being referenced. If no event is being referenced, 0 is returned.
Id nn::pia::clone::CloneElementBase::GetId ( ) const
inlineinherited

Gets the ID.

Returns
Returns the ID specified when registering the object with CloneBase. Returns 0 if the object is not registered with CloneBase. (If 0 was specified as the ID when registering the object, 0 may be returned as a valid value.)
u32 nn::pia::clone::CloneElementBase::GetProfiledLatestReceiveCount ( StationIndex  stationIndex) const
inherited

Gets the receive count for the last CloneProfiler::LATEST_BUFFER_SIZE times common::Scheduler::Dispatch was called.

Parameters
[in]stationIndexThe StationIndex that is subject to profiling.
Returns
The receive count for the last CloneProfiler::LATEST_BUFFER_SIZE times common::Scheduler::Dispatch was called. Returns 0 if no object is configured to manage receive profiling.
See also
SetProfiler
u32 nn::pia::clone::CloneElementBase::GetProfiledLatestReceiveSize ( StationIndex  stationIndex) const
inherited

Gets the total amount of data, in bytes, received during the last CloneProfiler::LATEST_BUFFER_SIZE times of common::Scheduler::Dispatch being called.

Parameters
[in]stationIndexThe StationIndex that is subject to profiling.
Returns
The total amount of data, in bytes, received during the last CloneProfiler::LATEST_BUFFER_SIZE times of common::Scheduler::Dispatch being called. Returns 0 if no object is configured to manage receive profiling.
See also
SetProfiler
u32 nn::pia::clone::CloneElementBase::GetProfiledLatestSendCount ( StationIndex  stationIndex) const
inherited

Gets the send count for the last CloneProfiler::LATEST_BUFFER_SIZE times common::Scheduler::Dispatch was called.

Parameters
[in]stationIndexThe StationIndex that is subject to profiling.
Returns
The send count for the last CloneProfiler::LATEST_BUFFER_SIZE times common::Scheduler::Dispatch was called. Returns 0 if no object is configured to manage send profiling.
See also
SetProfiler
u32 nn::pia::clone::CloneElementBase::GetProfiledLatestSendSize ( StationIndex  stationIndex) const
inherited

Gets the total amount of data, in bytes, sent during the last CloneProfiler::LATEST_BUFFER_SIZE times of common::Scheduler::Dispatch being called.

Parameters
[in]stationIndexThe StationIndex that is subject to profiling.
Returns
The total amount of data, in bytes, sent during the last CloneProfiler::LATEST_BUFFER_SIZE times of common::Scheduler::Dispatch being called. Returns 0 if no object is configured to manage send profiling.
See also
SetProfiler
u32 nn::pia::clone::CloneElementBase::GetProfiledTotalReceiveCount ( StationIndex  stationIndex) const
inherited

Gets the number of times received since ResetProfiler was called.

Parameters
[in]stationIndexThe StationIndex that is subject to profiling.
Returns
The number of times received since ResetProfiler was called. Returns 0 if no object is configured to manage receive profiling.
See also
SetProfiler, ResetProfiler
u32 nn::pia::clone::CloneElementBase::GetProfiledTotalReceiveSize ( StationIndex  stationIndex) const
inherited

Gets the amount of data, in bytes, received since ResetProfiler was called.

Parameters
[in]stationIndexThe StationIndex that is subject to profiling.
Returns
The amount of data, in bytes, received since ResetProfiler was called. Returns 0 if no object is configured to manage receive profiling.
See also
SetProfiler, ResetProfiler
u32 nn::pia::clone::CloneElementBase::GetProfiledTotalSendCount ( StationIndex  stationIndex) const
inherited

Gets the number of times sent since ResetProfiler was called.

Parameters
[in]stationIndexThe StationIndex that is subject to profiling.
Returns
The number of times sent since ResetProfiler was called. Returns 0 if no object is configured to manage send profiling.
See also
SetProfiler, ResetProfiler
u32 nn::pia::clone::CloneElementBase::GetProfiledTotalSendSize ( StationIndex  stationIndex) const
inherited

Gets the amount of data, in bytes, sent since ResetProfiler was called.

Parameters
[in]stationIndexThe StationIndex that is subject to profiling.
Returns
The amount of data, in bytes, sent since ResetProfiler was called. Returns 0 if no object is configured to manage send profiling.
See also
SetProfiler, ResetProfiler
const CloneProtocol* nn::pia::clone::CloneElementBase::GetProtocol ( ) const
inherited

Gets the CloneProtocol of the CloneBase this object is registered to.

Returns
Returns the CloneProtocol of the CloneBase this object is registered to.
const CloneProfilerBase* nn::pia::clone::CloneElementBase::GetReceiveProfiler ( ) const
inlineinherited

Gets the object configured to manage receive profiling.

Returns
The object configured to manage receive profiling. Returns NULL if nothing has been set.
See also
SetProfiler
const CloneProfilerBase* nn::pia::clone::CloneElementBase::GetSendProfiler ( ) const
inlineinherited

Gets the object configured to manage send profiling.

Returns
The object configured to manage send profiling. Returns NULL if nothing has been set.
See also
SetProfiler
template<typename Value_ , size_t BUFFER_SIZE, typename SerializePolicy_ = HostByteOrderSerializePolicy<Value_>>
StationIndex nn::pia::clone::EventCloneElement< Value_, BUFFER_SIZE, SerializePolicy_ >::GetSetterStationIndex ( ) const
inline

Gets the index of the station that raised the event being referenced.

Returns
Returns the index of the station that raised the event being referenced. If no event is being referenced, STATION_INDEX_INVALID is returned.
size_t nn::pia::clone::EventCloneElementBase::GetUsingBufferNum ( ) const
inherited

Gets the current number of event buffers in use.

Sometimes the return value is not zero (0) when it is registered to ReceiveClone, AtomicSharingClone, or SequentialSharingClone. When subsequent data is received, data that can be deleted will be deleted from the buffer.

Returns
Returns the number of event buffers in use.
template<typename Value_ , size_t BUFFER_SIZE, typename SerializePolicy_ = HostByteOrderSerializePolicy<Value_>>
const Value* nn::pia::clone::EventCloneElement< Value_, BUFFER_SIZE, SerializePolicy_ >::GetValue ( ) const
inline

Gets the pointer to the value for when the current event was raised.

Returns
Returns the pointer to the value for when the current event was raised. The return value is the same as the value returned when HandleNext was last called. Returns NULL when no event is being referenced.
template<typename Value_ , size_t BUFFER_SIZE, typename SerializePolicy_ = HostByteOrderSerializePolicy<Value_>>
const Value* nn::pia::clone::EventCloneElement< Value_, BUFFER_SIZE, SerializePolicy_ >::HandleNext ( )
inline

References the next event.

The event currently being referenced can be accessed until the HandleNext function is called again.

Returns
Returns the value for the newly referenced event. Returns NULL when there is no next event.
bool nn::pia::clone::EventCloneElementBase::IsDropEvent ( ) const
inlineinherited

Gets whether a drop event error occurred.

If a station disconnects abnormally when using AtomicSharingClone, an event that was supposed to be received may be lost. If this error occurs in any of the EventCloneElement objects, the CloneProtocol::GetError function returns CloneProtocol::ERROR_TYPE_DROP_EVENT.

Returns
Returns true if a drop event error occurred.
See also
CloneProtocol::GetError
bool nn::pia::clone::CloneElementBase::IsReadyToSetValue ( ) const
inherited

Determines whether a value can be set.

Returns
Returns true if a value can be set.
bool nn::pia::clone::CloneElementBase::IsRegisteredWithCloneBase ( ) const
inlineinherited

Determines whether the object is registered with CloneBase.

Returns
Returns true if it is registered with CloneBase.
bool nn::pia::clone::CloneElementBase::IsRegisteredWithProtocol ( ) const
inherited

Determines whether the object is registered with CloneProtocol.

Returns
Returns true if it is registered with CloneProtocol.
void nn::pia::clone::CloneElementBase::ResetProfiler ( )
inherited

Resets the results of send/receive profiling.

See also
SetProfiler
nn::Result nn::pia::clone::CloneElementBase::SetProfiler ( CloneProfilerBase pSendProfiler,
CloneProfilerBase pReceiveProfiler 
)
inherited

Sets an object to manage send/receive profiling.

Clone element send/receive tasks can be profiled by configuring CloneProfiler. This calculation includes all exchanges of data between this clone element and other clone elements, so the data exchanges between clone elements on the local station are also included in the value.

Even when compression is enabled, the uncompressed size is used in the calculation.

A CloneProfiler instance that is already configured can be released by specifying NULL in the arguments.

Parameters
[in]pSendProfilerSpecifies the CloneProfiler that manages the send profiling. Specify NULL if not necessary.
[in]pReceiveProfilerSpecifies the CloneProfiler that manages the receive profiling. Specify NULL if not necessary.
Returns
Returns a Result value for which the IsSuccess function returns true if execution succeeds. You must make sure that the implementation of this function in your application does not return any errors.
Error Return Values:
ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.
template<typename Value_ , size_t BUFFER_SIZE, typename SerializePolicy_ = HostByteOrderSerializePolicy<Value_>>
nn::Result nn::pia::clone::EventCloneElement< Value_, BUFFER_SIZE, SerializePolicy_ >::SetValue ( const Value value,
bool  isEnableSendDelay = false 
)

Raises an event.

Parameters
[in]valueThe event's value.
[in]isEnableSendDelaySpecifying true defers the sending of data. The data is then sent along with other immediate-send items among the elements registered to the same clone. The maximum deferment time can be specified using the CloneProtocol::SetMaxSendDelay function. After that time elapses, the data is sent even if there is no other data to send. This feature can reduce the number of packets sent, but also delays the arrival of packets by the deferment time. Specify false to send the data immediately.
Returns
Returns a Result value for which the IsSuccess function returns true if execution succeeds.
Error Return Values:

ResultInvalidState Specifies that the registered clone cannot send in its current state. Programming error. Fix your program so that this error is not returned.

ResultBufferIsFull Specifies that the event cannot be raised because the buffer is full. Handle appropriately in the application.

void nn::pia::clone::EventCloneElementBase::Trace ( u64  flag) const
inherited

Prints information that is useful for debugging.

Parameters
[in]flagSpecifies the bitwise OR of trace flags. For more information, see the TraceFlag type.