7 #include "Tuto16MultithreadConsole/SIncrementArray.hpp" 9 #include <fwCom/Signal.hxx> 10 #include <fwCom/Slots.hxx> 12 #include <fwData/Array.hpp> 13 #include <fwData/mt/ObjectWriteLock.hpp> 15 #include <fwDataTools/helper/Array.hpp> 17 #include <fwServices/macros.hpp> 19 #include <fwThread/Timer.hpp> 28 static const ::fwCom::Slots::SlotKeyType s_START_TIMER_SLOT =
"startTimer";
32 SIncrementArray::SIncrementArray() noexcept :
33 m_periodInMillisec(500)
35 newSlot(s_START_TIMER_SLOT, &SIncrementArray::startTimer,
this);
40 SIncrementArray::~SIncrementArray() noexcept
50 m_timer->setDuration( std::chrono::milliseconds(m_periodInMillisec) );
57 if (m_timer->isRunning())
68 ::fwData::Array::sptr array = this->getInOut< ::fwData::Array >(
"array");
72 SLM_ASSERT(
"Array : bad number of dimensions.", array->getNumberOfDimensions() == 1 );
74 const size_t arraySize = array->getSize()[0];
78 unsigned int* buffer =
static_cast< unsigned int*
>( arrayHelper.
getBuffer() );
81 for (
size_t i = 0; i < arraySize; i++)
87 ::fwData::Object::ModifiedSignalType::sptr sig
106 void SIncrementArray::startTimer()
Class allowing to block a Connection.
A helper to lock object on exclusive mode.
virtual void configuring() override
Do nothing.
virtual void starting() override
Initialize the timer.
UpdateSlotType::sptr m_slotUpdate
Slot to call update method.
virtual void updating() override
Increment all the values of the current array.
Provides a way to manage a view on a multidimentionnal array.
This interface defines control service API. Does nothing particularly, can be considered as a default...
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
This service increments all the values of a fwData::Array.
virtual void stopping() override
Stop and reset the timer.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG
Key in m_signals map of signal m_sigModified.
std::shared_ptr< ::fwThread::Worker > m_associatedWorker
Associated worker.
The namespace Tuto16MultithreadConsole contains services to run the Tuto16MultithreadConsole example...