CTR Pia  4.11.3
Game Communication Engine
nn::pia::clone::AtomicSharingClone Class Reference

This class is a derivative of CloneBase and provides functionality for exclusively controlling the lock on sending and for bidirectional sending and receiving. More...

+ Inheritance diagram for nn::pia::clone::AtomicSharingClone:

Public Types

typedef u32 Id
 Specifies the type of the ID for identifying clones.
 

Public Member Functions

 AtomicSharingClone ()
 Instantiates the object with default parameters (default constructor).
 
virtual ~AtomicSharingClone ()
 Destroys the object (destructor).
 
Id GetId () const
 Gets the ID. More...
 
LockStatus GetLockStatus () const
 Gets the status of the lock. More...
 
const CloneProtocolGetProtocol () const
 Gets the CloneProtocol this object is registered to. More...
 
bool IsActive () const
 Determines whether this object is active. More...
 
bool IsConnected (StationId stationId) const
 Determines whether another station's SharingClone exchanges data with this SharingClone. More...
 
bool IsConnectedWithAll () const
 Determines whether all stations have a SharingClone that exchanges data with this SharingClone. More...
 
bool IsRegisteredWithProtocol () const
 Determines whether the object is registered with CloneProtocol. More...
 
nn::Result RegisterElement (CloneElementBase *pElement, CloneElementBase::Id elementId)
 Registers a clone element. More...
 
CloneElementBaseSearchElement (CloneElementBase::Id elementId)
 Searches for the clone element of the specified ID. More...
 
const CloneElementBaseSearchElement (CloneElementBase::Id elementId) const
 Searches for the clone element of the specified ID. More...
 
virtual void Trace (u64 flag) const
 Prints information that is useful for debugging. More...
 
nn::Result TryLock ()
 Attempts to acquire a lock on sending. More...
 
nn::Result Unlock ()
 Releases the send lock. More...
 
nn::Result UnregisterElement (CloneElementBase *pElement)
 Unregisters a clone element. More...
 
nn::Result UnregisterElement (CloneElementBase::Id elementId)
 Unregisters a clone element. 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

This class is a derivative of CloneBase and provides functionality for exclusively controlling the lock on sending and for bidirectional sending and receiving.


Revision History:
2013-09-25 Initial version.

Member Enumeration Documentation

Enumerates the status of the lock.

Enumerator
LOCK_STATUS_UNLOCKED 

Specifies that the station does not have the lock.

LOCK_STATUS_TRY_LOCK 

Specifies that the station is attempting to acquire the lock.

LOCK_STATUS_LOCKED 

Specifies that the station has the lock.

Member Function Documentation

Id nn::pia::clone::CloneBase::GetId ( ) const
inlineinherited

Gets the ID.

Returns
Returns the ID specified when registering the object with CloneProtocol. Returns 0 if not registered with CloneProtocol.
LockStatus nn::pia::clone::AtomicSharingClone::GetLockStatus ( ) const
inline

Gets the status of the lock.

Returns
Returns the status of the lock.
u32 nn::pia::clone::CloneBase::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::CloneBase::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::CloneBase::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::CloneBase::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::CloneBase::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::CloneBase::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::CloneBase::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::CloneBase::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::CloneBase::GetProtocol ( ) const
inlineinherited

Gets the CloneProtocol this object is registered to.

Returns
Returns the CloneProtocol this object is registered to.
const CloneProfilerBase* nn::pia::clone::CloneBase::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::CloneBase::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
bool nn::pia::clone::CloneBase::IsActive ( ) const
inlineinherited

Determines whether this object is active.

An object is treated as active when it is registered with CloneProtocol and can actually send and receive data. An object is not active when it is in the process of being registered or unregistered with CloneProtocol, or when CloneProtocol is starting up or being finalized.

Returns
Returns true if active.
bool nn::pia::clone::SharingClone::IsConnected ( StationId  stationId) const
inherited

Determines whether another station's SharingClone exchanges data with this SharingClone.

Note that if the paired SharingClone is unregistered in the middle of an operation, the change is not applied until after something takes place, like data being sent or received by the application or internally, the ending of CloneProtocol communications, or a station leaving the session.

Parameters
[in]stationIdSpecifies the paired StationId.
Returns
Returns true if there is a SharingClone that exchanges data with this SharingClone.
See also
IsConnectedWithAll
bool nn::pia::clone::SharingClone::IsConnectedWithAll ( ) const
inherited

Determines whether all stations have a SharingClone that exchanges data with this SharingClone.

The stations that are assessed are those for which the CloneProtocol::IsActiveStation function returns true.

Note that if the paired SharingClone is unregistered in the middle of an operation, the change is not applied until something takes place, like data being sent or received by the application or internally.

Returns
Returns true if all stations have a SharingClone that exchanges data with this SharingClone.
See also
IsConnected
bool nn::pia::clone::CloneBase::IsRegisteredWithProtocol ( ) const
inlineinherited

Determines whether the object is registered with CloneProtocol.

Returns
Returns true if it is registered with CloneProtocol.
nn::Result nn::pia::clone::CloneBase::RegisterElement ( CloneElementBase pElement,
CloneElementBase::Id  elementId 
)
inherited

Registers a clone element.

This function must be called while the object is not registered with CloneProtocol.

Parameters
[in]pElementSpecifies the clone element to register.
[in]elementIdSpecifies the ID of the clone element to register.
Returns
Returns a Result value for which the IsSuccess function returns true if execution succeeds.
Error Return Values:

ResultInvalidState Indicates that this object is already registered with CloneProtocol. Programming error. Fix your program so that this error is not returned.

ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.

ResultAlreadyExists Indicates that a clone element is already registered to the specified ID. Programming error. Fix your program so that this error is not returned.

void nn::pia::clone::CloneBase::ResetProfiler ( )
inherited

Resets the results of send/receive profiling.

See also
SetProfiler
CloneElementBase* nn::pia::clone::CloneBase::SearchElement ( CloneElementBase::Id  elementId)
inlineinherited

Searches for the clone element of the specified ID.

Parameters
[in]elementIdSpecifies the clone element to search for.
Returns
Returns the clone element with the specified ID. Returns NULL if it does not exist.
const CloneElementBase* nn::pia::clone::CloneBase::SearchElement ( CloneElementBase::Id  elementId) const
inlineinherited

Searches for the clone element of the specified ID.

Parameters
[in]elementIdSpecifies the clone element to search for.
Returns
Returns the clone element with the specified ID. Returns NULL if it does not exist.
nn::Result nn::pia::clone::CloneBase::SetProfiler ( CloneProfilerBase pSendProfiler,
CloneProfilerBase pReceiveProfiler 
)
inherited

Sets an object to manage send/receive profiling.

Send/receive tasks carried out by registered clone elements and clones themselves can be profiled by configuring CloneProfiler. This calculation includes all exchanges of data between this clone and other clones, so the data exchanges between clones on the local station are also included in the value.

When multiple clone elements are sending data at the same time, it gets calculated on a per-clone basis. In most cases, the total send/receive count of the clones is less than that of the clone elements.

When compression is enabled, the compressed size is used in the calculation. For this reason, calculations may result in a value that is small relative to the total amount of data sent or received that was measured for registered clone elements.

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.
virtual void nn::pia::clone::AtomicSharingClone::Trace ( u64  flag) const
virtual

Prints information that is useful for debugging.

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

Reimplemented from nn::pia::clone::SharingClone.

nn::Result nn::pia::clone::AtomicSharingClone::TryLock ( )

Attempts to acquire a lock on sending.

If this function is called while the state is LOCK_STATUS_UNLOCKED, the state transitions to LOCK_STATUS_TRY_LOCK. If the lock successfully acquired, the state changes to LOCK_STATUS_LOCKED. If the lock cannot be acquired because another station has them, the state changes to LOCK_STATUS_UNLOCKED. This function does nothing if called while the state is LOCK_STATUS_TRY_LOCK or LOCK_STATUS_LOCKED.

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:
ResultInvalidState Indicates that the object is not active. (IsActive returns false. ) Programming error. Fix your program so that this error is not returned.
nn::Result nn::pia::clone::AtomicSharingClone::Unlock ( )

Releases the send lock.

If this function is called while the state is LOCK_STATUS_LOCKED, the state transitions to LOCK_STATUS_UNLOCKED and other stations can acquire the lock. If called while the state is LOCK_STATUS_TRY_LOCK, the object stops trying to acquire a lock and the state changes to LOCK_STATUS_UNLOCKED. This function does nothing if it is called while the state is LOCK_STATUS_UNLOCKED.

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:
ResultInvalidState Indicates that the object is not active. (IsActive returns false. ) Programming error. Fix your program so that this error is not returned.
nn::Result nn::pia::clone::CloneBase::UnregisterElement ( CloneElementBase pElement)
inherited

Unregisters a clone element.

This function must be called while the object is not registered with CloneProtocol.

Parameters
[in]pElementSpecifies the clone element to unregister.
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:

ResultInvalidState Indicates that this object is already registered with CloneProtocol. Programming error. Fix your program so that this error is not returned.

ResultInvalidArgument Indicates that an argument is invalid. Programming error. Fix your program so that this error is not returned.

nn::Result nn::pia::clone::CloneBase::UnregisterElement ( CloneElementBase::Id  elementId)
inherited

Unregisters a clone element.

This function must be called while the object is not registered with CloneProtocol.

Parameters
[in]elementIdSpecifies the ID of the clone element to unregister.
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:

ResultInvalidState Indicates that this object is already registered with CloneProtocol. Programming error. Fix your program so that this error is not returned.

ResultNotSet Indicates that a clone element is not registered to the specified ID. Programming error. Fix your program so that this error is not returned.