Communication Library for Autonomous Systems v1.0
Reliable and secure communication library for autonomous vehicle systems
Loading...
Searching...
No Matches
LeaderKeyStorage Class Reference

Thread-safe singleton for leader key storage. More...

#include <leaderKeyStorage.h>

Public Member Functions

void setLeaderId (const Ethernet::Address &leader_id)
 Set the current leader ID.
 
Ethernet::Address getLeaderId () const
 Get the current leader ID.
 
void setGroupMacKey (const MacKeyType &key)
 Set the current group MAC key.
 
MacKeyType getGroupMacKey () const
 Get the current group MAC key.
 
std::chrono::steady_clock::time_point getLastUpdateTime () const
 Get the last update time.
 

Static Public Member Functions

static LeaderKeyStoragegetInstance ()
 Get the singleton instance.
 

Detailed Description

Thread-safe singleton for leader key storage.

This class is thread-safe and can be accessed from multiple threads. All public methods are protected by mutex locks. The singleton instance is initialized in a thread-safe manner using C++11's static initialization guarantees.

Member Function Documentation

◆ getGroupMacKey()

MacKeyType LeaderKeyStorage::getGroupMacKey ( ) const
inline

Get the current group MAC key.

Returns
The current MAC key

Thread-safe: Protected by mutex

◆ getInstance()

LeaderKeyStorage & LeaderKeyStorage::getInstance ( )
inlinestatic

Get the singleton instance.

Returns
Reference to the singleton instance

Thread-safe: Uses C++11's static initialization guarantees

◆ getLastUpdateTime()

std::chrono::steady_clock::time_point LeaderKeyStorage::getLastUpdateTime ( ) const
inline

Get the last update time.

Returns
The time of the last update

Thread-safe: Uses atomic operations

◆ getLeaderId()

Ethernet::Address LeaderKeyStorage::getLeaderId ( ) const
inline

Get the current leader ID.

Returns
The MAC address of the current leader

Thread-safe: Protected by mutex

◆ setGroupMacKey()

void LeaderKeyStorage::setGroupMacKey ( const MacKeyType key)
inline

Set the current group MAC key.

Parameters
keyThe new MAC key

Thread-safe: Protected by mutex

◆ setLeaderId()

void LeaderKeyStorage::setLeaderId ( const Ethernet::Address leader_id)
inline

Set the current leader ID.

Parameters
leader_idThe MAC address of the new leader

Thread-safe: Protected by mutex


The documentation for this class was generated from the following file: