Hotwheels-Cluster 1.2
Creation of Cluster APP for SEA:ME project.
 
Loading...
Searching...
No Matches
Data::CarDataI Class Reference

Class for the car data. More...

#include <CarDataI.hpp>

Public Member Functions

 CarDataI (QObject *parent=nullptr)
 Constructor for the CarDataI class.
 
 ~CarDataI ()
 Destructor for the CarDataI class.
 
void setJoystickValue (bool newValue, const Ice::Current &) override
 Set the joystick value.
 
bool getJoystickValue (const Ice::Current &) override
 Get the joystick value.
 
void setCarTemperatureValue (double newValue, const Ice::Current &) override
 Set the car temperature value.
 
double getCarTemperatureValue (const Ice::Current &) override
 Get the car temperature value.
 
void runServer (int argc, char **argv)
 Runs the Ice server.
 
- Public Member Functions inherited from Data::CarData
virtual ~CarData ()
 
virtual bool ice_isA (const ::std::string &id, const ::Ice::Current &current=::Ice::emptyCurrent) const
 
virtual ::std::vector< ::std::string > ice_ids (const ::Ice::Current &current=::Ice::emptyCurrent) const
 
virtual const ::std::string & ice_id (const ::Ice::Current &current=::Ice::emptyCurrent) const
 
virtual void setJoystickValue (bool newValue, const ::Ice::Current &current=::Ice::emptyCurrent)=0
 
virtual bool getJoystickValue (const ::Ice::Current &current=::Ice::emptyCurrent)=0
 
virtual void setCarTemperatureValue (::Ice::Double newValue, const ::Ice::Current &current=::Ice::emptyCurrent)=0
 
virtual::Ice::Double getCarTemperatureValue (const ::Ice::Current &current=::Ice::emptyCurrent)=0
 
void setJoystickValue (bool newValue)
 
bool getJoystickValue ()
 
void setCarTemperatureValue (double newValue)
 
double getCarTemperatureValue ()
 

Private Attributes

bool joystick_enable
 
double car_temperature
 
std::mutex joystick_mutex
 
std::mutex temperature_mutex
 
std::thread serverThread
 
Ice::CommunicatorPtr communicator
 

Additional Inherited Members

- Public Types inherited from Data::CarData
typedef CarDataPrx ProxyType
 
typedef CarDataPtr PointerType
 
- Static Public Member Functions inherited from Data::CarData
static const ::std::string & ice_staticId ()
 

Detailed Description

Class for the car data.

Definition at line 37 of file CarDataI.hpp.

Constructor & Destructor Documentation

◆ CarDataI()

Data::CarDataI::CarDataI ( QObject * parent = nullptr)
explicit

Constructor for the CarDataI class.

Parameters
parentThe parent QObject

Definition at line 29 of file CarDataI.cpp.

◆ ~CarDataI()

Data::CarDataI::~CarDataI ( )

Destructor for the CarDataI class.

This destructor is responsible for stopping the Ice communicator and destroying it.

Definition at line 36 of file CarDataI.cpp.

Member Function Documentation

◆ getCarTemperatureValue()

double Data::CarDataI::getCarTemperatureValue ( const Ice::Current & )
override

Get the car temperature value.

This method is responsible for getting the car temperature value. It is thread-safe and uses a mutex to ensure that the temperature is retrieved without race conditions.

Returns
The current value of the car temperature

Definition at line 92 of file CarDataI.cpp.

◆ getJoystickValue()

bool Data::CarDataI::getJoystickValue ( const Ice::Current & )
override

Get the joystick value.

This method is responsible for getting the joystick value.

Returns
The current value of the joystick

Definition at line 63 of file CarDataI.cpp.

◆ runServer()

void Data::CarDataI::runServer ( int argc,
char ** argv )

Runs the Ice server.

This method runs the Ice server by initializing the Ice communicator with the given arguments and custom properties. The custom properties set the minimum and maximum thread pool size to 10 and 20 respectively. The server is then activated and will listen on the specified endpoint ("tcp -h 127.0.0.1 -p 10000"). The server will run until it is stopped with Ctrl+C.

Parameters
argcThe number of command-line arguments.
argvThe array of command-line arguments.

Definition at line 109 of file CarDataI.cpp.

◆ setCarTemperatureValue()

void Data::CarDataI::setCarTemperatureValue ( double newValue,
const Ice::Current &  )
override

Set the car temperature value.

This method sets the temperature of the car to the specified value. It is thread-safe and uses a mutex to ensure that the temperature is updated without race conditions. Logs the new temperature value to the console.

Parameters
newValueThe new temperature value to be set
currentThe current Ice context

Definition at line 78 of file CarDataI.cpp.

◆ setJoystickValue()

void Data::CarDataI::setJoystickValue ( bool newValue,
const Ice::Current &  )
override

Set the joystick value.

This method is responsible for setting the joystick value.

Parameters
newValueThe new value for the joystick
currentThe current Ice context

Definition at line 51 of file CarDataI.cpp.

Field Documentation

◆ car_temperature

double Data::CarDataI::car_temperature
private

Definition at line 42 of file CarDataI.hpp.

◆ communicator

Ice::CommunicatorPtr Data::CarDataI::communicator
private

Definition at line 47 of file CarDataI.hpp.

◆ joystick_enable

bool Data::CarDataI::joystick_enable
private

Definition at line 41 of file CarDataI.hpp.

◆ joystick_mutex

std::mutex Data::CarDataI::joystick_mutex
private

Definition at line 44 of file CarDataI.hpp.

◆ serverThread

std::thread Data::CarDataI::serverThread
private

Definition at line 46 of file CarDataI.hpp.

◆ temperature_mutex

std::mutex Data::CarDataI::temperature_mutex
private

Definition at line 45 of file CarDataI.hpp.


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