12#ifndef WSFMULTITHREADMANAGER_HPP
13#define WSFMULTITHREADMANAGER_HPP
15#include "wsf_export.h"
38 double aBreakUpdateTime,
39 bool aDebugMultiThread,
59 void AddPlatform(
double aSimTime,
WsfPlatform* aPlatformPtr);
63 void DeletePlatform(
double aSimTime,
WsfPlatform* aOldPlatformPtr);
70 void TurnSensorOff(
double aSimTime,
WsfSensor* aSensorPtr);
72 void TurnSensorOn(
double aSimTime,
WsfSensor* aSensorPtr);
123 bool PopNextPlatformElement(PlatformElement& aPlatformElement);
126 bool PopNextSensorElement(SensorElement& aSensorElement);
137 FunctionType DoWork()
override;
170 std::queue<PlatformElement> mPlatformQueue;
171 std::priority_queue<SensorElement> mSensorQueue;
173 unsigned int mNumberOfThreads;
176 std::vector<size_t> mThreadedPlatforms;
177 std::vector<size_t> mNonThreadedPlatforms;
179 std::vector<WsfSensor*> mThreadedSensors;
180 std::vector<WsfSensor*> mNonThreadedSensors;
182 double mBreakUpdateTime;
187 std::recursive_mutex mMutex;
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
double mNextUpdateTime
Definition WsfMultiThreadManager.hpp:117
SensorElement()
Definition WsfMultiThreadManager.hpp:99
SensorElement(WsfSensor *aSensorPtr, double aSimTime, double aNextUpdateTime)
Definition WsfMultiThreadManager.hpp:106
WsfSensor * mSensorPtr
Definition WsfMultiThreadManager.hpp:115
bool operator<(const SensorElement &aRhs) const
Definition WsfMultiThreadManager.hpp:113
double mSimTime
Definition WsfMultiThreadManager.hpp:116
Implementation of worker thread for updating a platform.
Definition WsfMultiThreadManager.hpp:131
SimulationUpdateThread(WsfMultiThreadManager *aManagerPtr)
Constructor and destructor.
Definition WsfMultiThreadManager.cpp:350
~SimulationUpdateThread() override
Definition WsfMultiThreadManager.hpp:135
WsfMultiThreadManager * mManagerPtr
Definition WsfMultiThreadManager.hpp:143
FunctionType Pause() override
Definition WsfMultiThreadManager.hpp:138
void AddPlatform(double aSimTime, WsfPlatform *aPlatformPtr)
Definition WsfMultiThreadManager.cpp:242
void DeletePlatform(double aSimTime, WsfPlatform *aOldPlatformPtr)
Definition WsfMultiThreadManager.cpp:266
bool BreakUpdate()
Definition WsfMultiThreadManager.hpp:53
void UpdatePlatforms(double aCurrentTime)
Definition WsfMultiThreadManager.cpp:89
void UpdateSensors(double aCurrentTime)
Definition WsfMultiThreadManager.cpp:145
bool PlatformsQueued()
Definition WsfMultiThreadManager.hpp:122
void PlatformDeleted(double aSimTime, WsfPlatform *aOldPlatformPtr)
Definition WsfMultiThreadManager.hpp:65
void Initialize()
Definition WsfMultiThreadManager.cpp:57
void Complete(double aSimTime)
Definition WsfMultiThreadManager.cpp:67
void PlatformIntroduced(double aSimTime, WsfPlatform *aPlatformPtr)
Definition WsfMultiThreadManager.hpp:61
WsfMultiThreadManager(unsigned int aNumberOfThreads, double aBreakUpdateTime, bool aDebugMultiThread, WsfSimulation *aSimulationPtr)
Constructor.
Definition WsfMultiThreadManager.cpp:27
bool SensorsQueued()
Definition WsfMultiThreadManager.hpp:125
Definition WsfSensor.hpp:92
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfThreadPool.hpp:40
FunctionType
Definition WsfThread.hpp:26
@ AVAILABLE
Definition WsfThread.hpp:28
WsfMultiThreadManager * mManagerPtr
Definition WsfMultiThreadManager.hpp:154
SimulationUpdateThread * operator()() const
Definition WsfMultiThreadManager.cpp:406
ThreadFactory(WsfMultiThreadManager *aManagerPtr)
Definition WsfMultiThreadManager.hpp:149