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

#include <csv_agent.h>

Inheritance diagram for CSVAgent:
Agent

Public Member Functions

 CSVAgent (CAN *bus, const std::string &name, Unit unit, Type type, Address address, DataProducer producer, ResponseHandler handler, std::unique_ptr< ComponentData > data, bool external)
 
 ~CSVAgent ()
 
- Public Member Functions inherited from Agent
 Agent (CAN *bus, const std::string &name, Unit unit, Type type, Address address, DataProducer producer, ResponseHandler handler, std::unique_ptr< ComponentData > data, bool external=true)
 Constructor for EPOS-inspired Agent using composition.
 
 ~Agent ()
 Destructor with proper cleanup order.
 
Value get (Unit unit)
 Get data using function pointer instead of virtual method.
 
void handle_response (Message *msg)
 Handle response using function pointer instead of virtual method.
 
int send (Unit unit, Microseconds period)
 
int receive (Message *msg)
 
bool running ()
 
void external (const bool external)
 
const bool external () const
 
std::string name () const
 
void set_csv_logger (const std::string &log_dir)
 
void log_message (const Message &msg, const std::string &direction)
 
int start_periodic_interest (Unit unit, Microseconds period)
 Start sending periodic INTEREST messages for the specified unit and period.
 
void stop_periodic_interest ()
 Stop sending periodic INTEREST messages.
 
void send_interest (Unit unit)
 Send a single INTEREST message (called by periodic thread)
 
void update_interest_period (Microseconds new_period)
 Update the period for periodic interest sending.
 

Protected Member Functions

void reply (Unit unit)
 Reply method that calls function pointer instead of virtual method.
 
- Protected Member Functions inherited from Agent
bool thread_running ()
 
int can_send (Message *msg)
 
Address address () const
 

Additional Inherited Members

- Public Types inherited from Agent
typedef CAN::Message Message
 
typedef Message::Origin Address
 
typedef Message::Array Value
 
typedef Message::Unit Unit
 
typedef Message::Type Type
 
typedef Message::Microseconds Microseconds
 
typedef Periodic_Thread< AgentThread
 
typedef CAN::Observer Observer
 
- Static Public Member Functions inherited from Agent
static voidrun (void *arg)
 
- Static Public Attributes inherited from Agent
static const unsigned int _units_per_vehicle = 5
 
static constexpr int MAX_RESPONSES_PER_INTEREST = 5
 

Constructor & Destructor Documentation

◆ CSVAgent()

CSVAgent::CSVAgent ( CAN bus,
const std::string &  name,
Unit  unit,
Type  type,
Address  address,
DataProducer  producer,
ResponseHandler  handler,
std::unique_ptr< ComponentData data,
bool  external 
)
inline

◆ ~CSVAgent()

CSVAgent::~CSVAgent ( )
inline

Member Function Documentation

◆ reply()

void CSVAgent::reply ( Unit  unit)
inlineprotectedvirtual

Reply method that calls function pointer instead of virtual method.

This is the critical method where the race condition used to occur. Instead of calling the virtual get() method, we now call the function pointer directly, eliminating the vtable dependency.

Reimplemented from Agent.


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