Safir SDK Core
Loading...
Searching...
No Matches
Safir::Dob::ConnectionAspectMisc Class Reference

Class that provides miscellaneous methods that are used less frequently. More...

#include <Safir/Dob/ConnectionAspectMisc.h>

Inheritance diagram for Safir::Dob::ConnectionAspectMisc:
[legend]
Collaboration diagram for Safir::Dob::ConnectionAspectMisc:
[legend]

Public Member Functions

 ConnectionAspectMisc (const ConnectionBase &connection)
 Constructor.
 
Dob::CallbackId::Enumeration GetCurrentCallbackId () const
 Get info about which callback you are currently executing in.
 
Connection info
const std::wstring GetConnectionName () const
 Get the name for this connection used in the system.
 
const std::wstring GetConnectionNameCommonPart () const
 Get the common part of the connection name.
 
const std::wstring GetConnectionNameInstancePart () const
 Get the instance part of the connection name.
 
Dob::Typesystem::Int32 GetContext () const
 Get the context that the connection is opened in.
 
Dob::Typesystem::Int64 GetNodeId () const
 Get the Node Identifier of the current node.
 
bool IsLightNode () const
 Check whether the current node is a light node.
 
Queue Status
Dob::Typesystem::Int32 GetQueueCapacity (const Dob::ConnectionQueueId::Enumeration queue) const
 Get the capacity of the specified queue.
 
Dob::Typesystem::Int32 GetQueueSize (const Dob::ConnectionQueueId::Enumeration queue) const
 Get the number of items currently in the queue.
 
Debug
void SimulateOverflows (const bool inQueues, const bool outQueues) const
 Turn simulation of overflow on/off.
 
Shared Memory statistics
Typesystem::Int64 GetSharedMemoryUsage () const
 Get the number of currently used bytes in the shared memory.
 
Dob::MemoryLevel::Enumeration GetSharedMemoryLevel () const
 Get the usage level of the shared memory.
 

Additional Inherited Members

- Protected Member Functions inherited from Safir::Dob::ConnectionAspectBase
 ConnectionAspectBase (const ConnectionBase &connection)
 Constructor.
 
virtual ~ConnectionAspectBase ()
 Destructor.
 
long GetControllerId () const
 Get the id of the controller.
 

Detailed Description

Class that provides miscellaneous methods that are used less frequently.

Constructor & Destructor Documentation

◆ ConnectionAspectMisc()

Safir::Dob::ConnectionAspectMisc::ConnectionAspectMisc ( const ConnectionBase & connection)
explicit

Constructor.

Parameters
connectionThe connection that you want to operate through.

Member Function Documentation

◆ GetConnectionName()

const std::wstring Safir::Dob::ConnectionAspectMisc::GetConnectionName ( ) const

Get the name for this connection used in the system.

The connection name is composed of the name parts given by the application when opening the connection, with some additional decoration made by the DOB.

Returns
The connection name.

◆ GetConnectionNameCommonPart()

const std::wstring Safir::Dob::ConnectionAspectMisc::GetConnectionNameCommonPart ( ) const

Get the common part of the connection name.

Returns
The connection name common part specified when opening the connection.

◆ GetConnectionNameInstancePart()

const std::wstring Safir::Dob::ConnectionAspectMisc::GetConnectionNameInstancePart ( ) const

Get the instance part of the connection name.

Returns
The connection name instance part specified when opening the connection.

◆ GetContext()

Dob::Typesystem::Int32 Safir::Dob::ConnectionAspectMisc::GetContext ( ) const

Get the context that the connection is opened in.

Returns
Context

◆ GetCurrentCallbackId()

Dob::CallbackId::Enumeration Safir::Dob::ConnectionAspectMisc::GetCurrentCallbackId ( ) const

Get info about which callback you are currently executing in.

Returns
Id of the callback you are currently inside, or None if not in a callback.

◆ GetNodeId()

Dob::Typesystem::Int64 Safir::Dob::ConnectionAspectMisc::GetNodeId ( ) const

Get the Node Identifier of the current node.

Be aware that this identifier changes every time the node restarts.

Returns
NodeId of current node

◆ GetQueueCapacity()

Dob::Typesystem::Int32 Safir::Dob::ConnectionAspectMisc::GetQueueCapacity ( const Dob::ConnectionQueueId::Enumeration queue) const

Get the capacity of the specified queue.

This method returns the maximum number of items that the queue can hold.

Parameters
queue[in] The queue to get info for.
Returns
The capacity of the queue.

◆ GetQueueSize()

Dob::Typesystem::Int32 Safir::Dob::ConnectionAspectMisc::GetQueueSize ( const Dob::ConnectionQueueId::Enumeration queue) const

Get the number of items currently in the queue.

This method returns the number of items that is currently in the specified queue. NOTE: This method is only implemented for out-queues (MessageOutQueue, RequestOutQueue) If this method is called for an in-queue, a SoftwareViolationException will be thrown.

Parameters
queue[in] The queue to get info for.
Returns
The current size of the queue.

◆ GetSharedMemoryLevel()

Dob::MemoryLevel::Enumeration Safir::Dob::ConnectionAspectMisc::GetSharedMemoryLevel ( ) const

Get the usage level of the shared memory.

When the memory level gets to Low or below that there will be operations that are no longer allowed. See the User's Guide for more information.

Calling this function does not require the underlying Connection to have been opened.

Returns
The memory level.

◆ GetSharedMemoryUsage()

Typesystem::Int64 Safir::Dob::ConnectionAspectMisc::GetSharedMemoryUsage ( ) const

Get the number of currently used bytes in the shared memory.

The size of the shared memory is defined by the parameter Safir.Dob.NodeParameters.SharedMemorySize, which is defined in megabytes (1024*1024 bytes).

Calling this function does not require the underlying Connection to have been opened.

Returns
The amount of shared memory used, in bytes.

◆ IsLightNode()

bool Safir::Dob::ConnectionAspectMisc::IsLightNode ( ) const

Check whether the current node is a light node.

This is slightly easier than looking through the parameters to work this out.

Returns
true if the current node is a light node.

◆ SimulateOverflows()

void Safir::Dob::ConnectionAspectMisc::SimulateOverflows ( const bool inQueues,
const bool outQueues ) const

Turn simulation of overflow on/off.

For test purposes.

Setting inQueues to true means that no messages or requests are handled by the application. An incoming request will result in an overflow, and an incoming message will be discarded. Setting outQueues to true means that no messages or requests can be sent from the application, instead these calls will throw a Safir::Dob::OverflowException. When reset to false OnXxxxNotOverflow will be called as expected. Use this to verify that your application handles overflows correctly.

Note that the inQueues flag is not applied to new consumers added after this call.

Parameters
[in]inQueuesIf true all incoming queues are simulated full.
[in]outQueuesIf true all outgoing queues are simulated full.