ddt 1.1.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
ddt::DdtProducerConsumerBase Class Referenceabstract

#include <ddtProducerConsumerBase.hpp>

Inheritance diagram for ddt::DdtProducerConsumerBase:
DdtDataProducerConsumerFake ddt::DdtDataConsumer ddt::DdtDataProducer DdtDataConsumerFake

Public Types

enum  NotificationType { NEW_DATA , PUB_REG , PUB_UNREG , SHM_DEL }
 

Public Member Functions

virtual void Notify (NotificationType type)=0
 

Protected Attributes

int32_t min_port
 
int32_t max_port
 
DdtLoggerlogger
 
const int MIN_PORT_DEFAULT = 5100
 
const int MAX_PORT_DEFAULT = 5500
 
const int MIN_RANGE = 3
 
const int LINE_LENGTH = 256
 
 DdtProducerConsumerBase (DdtLogger *ddt_logger)
 
virtual ~DdtProducerConsumerBase ()
 
void Init (DdtLogger *ddt_logger)
 
void LoadDefaults ()
 
void ReadIni ()
 
void PrintConfigValues ()
 
int32_t GetFreePort () const
 

Detailed Description

This class serves as a base class for DdtDataProducer and DdtDataConsumer classes. It provides the ReadIni() and GetFreePort() functions for derived classes.

Member Enumeration Documentation

◆ NotificationType

There are different types of notifications:

Enumerator
NEW_DATA 

New data notification

PUB_REG 

Publisher registration

PUB_UNREG 

Publisher unregisters

SHM_DEL 

Shared memory deleted

Constructor & Destructor Documentation

◆ DdtProducerConsumerBase()

DdtProducerConsumerBase::DdtProducerConsumerBase ( DdtLogger ddt_logger)
explicit

Constructor

Parameters
ddt_loggerA DDT logger object (no transfer of ownership).

◆ ~DdtProducerConsumerBase()

DdtProducerConsumerBase::~DdtProducerConsumerBase ( )
virtualdefault

Destructor

Member Function Documentation

◆ GetFreePort()

int32_t DdtProducerConsumerBase::GetFreePort ( ) const
protected

Reads /proc/net/tcp and returns a free port from the port range specified in databroker.ini.

Returns
A free port number.

iterate over port range check each iteration if port is in use break and return the port if it is free

◆ Init()

void DdtProducerConsumerBase::Init ( DdtLogger ddt_logger)
protected

Initializes member variables.

Parameters
ddt_loggerA DDT logger object (no transfer of ownership).

◆ LoadDefaults()

void DdtProducerConsumerBase::LoadDefaults ( )
protected

Loads default values for configuration parameters.

◆ Notify()

virtual void ddt::DdtProducerConsumerBase::Notify ( NotificationType  type)
pure virtual

Sends a notification to local subscribers.

Parameters
typeThe type of the notification.

Implemented in DdtDataProducerConsumerFake, ddt::DdtDataConsumer, and ddt::DdtDataProducer.

◆ PrintConfigValues()

void DdtProducerConsumerBase::PrintConfigValues ( )
protected

Prints the values of configuration parameters.

◆ ReadIni()

void DdtProducerConsumerBase::ReadIni ( )
protected

Reads the databroker configuration file.

Member Data Documentation

◆ LINE_LENGTH

const int ddt::DdtProducerConsumerBase::LINE_LENGTH = 256
protected

Number of characters per line when reading the ports file.

◆ logger

DdtLogger* ddt::DdtProducerConsumerBase::logger
protected

The DDT logger object.

◆ max_port

int32_t ddt::DdtProducerConsumerBase::max_port
protected

Configurable upper boundary of the port range used for notifications.

◆ MAX_PORT_DEFAULT

const int ddt::DdtProducerConsumerBase::MAX_PORT_DEFAULT = 5500
protected

The default upper boundary of the port range used for notifications.

◆ min_port

int32_t ddt::DdtProducerConsumerBase::min_port
protected

Configurable lower boundary of the port range used for notifications.

◆ MIN_PORT_DEFAULT

const int ddt::DdtProducerConsumerBase::MIN_PORT_DEFAULT = 5100
protected

The default lower boundary of the port range used for notifications.

◆ MIN_RANGE

const int ddt::DdtProducerConsumerBase::MIN_RANGE = 3
protected

Minimum number of ports for the specified port range.


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