Skip to content

Commit e6472d5

Browse files
committed
Add disable method
1 parent 5c18320 commit e6472d5

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

src/Dataflow/Network/Module.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,9 @@ Module::Module(const ModuleLookupInfo& info,
154154
const std::string& version)
155155
: info_(info),
156156
id_(info.module_name_, idGenerator_->makeId(info.module_name_)),
157-
inputsChanged_(false),
158157
has_ui_(hasUi),
159158
state_(stateFactory ? stateFactory->make_state(info.module_name_) : new NullModuleState),
160159
metadata_(state_),
161-
threadStopped_(false),
162160
executionState_(new detail::ModuleExecutionStateImpl)
163161
{
164162
iports_.set_module(this);

src/Dataflow/Network/Module.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ namespace Networks {
103103

104104
virtual const MetadataMap& metadata() const override final;
105105

106+
virtual bool isDisabled() const override final { return disabled_; }
107+
virtual void setDisabled(bool disable) override final { disabled_ = disable; }
108+
106109
private:
107110
virtual Core::Datatypes::DatatypeHandleOption get_input_handle(const PortId& id) override final;
108111
virtual std::vector<Core::Datatypes::DatatypeHandleOption> get_dynamic_input_handles(const PortId& id) override final;
@@ -274,7 +277,7 @@ namespace Networks {
274277
template <class T>
275278
boost::shared_ptr<T> checkInput(Core::Datatypes::DatatypeHandleOption inputOpt, const PortId& id);
276279

277-
boost::atomic<bool> inputsChanged_;
280+
boost::atomic<bool> inputsChanged_ { false };
278281

279282

280283
friend class Builder;
@@ -297,9 +300,10 @@ namespace Networks {
297300
ExecutionSelfRequestSignalType executionSelfRequested_;
298301

299302
ModuleReexecutionStrategyHandle reexecute_;
300-
std::atomic<bool> threadStopped_;
303+
std::atomic<bool> threadStopped_ { false };
301304

302305
ModuleExecutionStateHandle executionState_;
306+
std::atomic<bool> disabled_ { false };
303307

304308
Core::Logging::LoggerHandle log_;
305309
Core::Algorithms::AlgorithmStatusReporter::UpdaterFunc updaterFunc_;

src/Dataflow/Network/ModuleInterface.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ namespace Networks {
178178

179179
virtual bool isStoppable() const = 0;
180180

181-
181+
virtual bool isDisabled() const = 0;
182+
virtual void setDisabled(bool disable) = 0;
182183
};
183184

184185
struct SCISHARE DataPortException : virtual Core::ExceptionBase {};

src/Dataflow/Network/Tests/MockModule.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ namespace SCIRun {
8888
MOCK_METHOD1(setReexecutionStrategy, void(ModuleReexecutionStrategyHandle));
8989
MOCK_METHOD0(enqueueExecuteAgain, void());
9090
MOCK_METHOD1(connectExecuteSelfRequest, boost::signals2::connection(const ExecutionSelfRequestSignalType::slot_type&));
91+
MOCK_METHOD1(setDisabled, void(bool));
92+
MOCK_CONST_METHOD0(isDisabled, bool(void));
9193
};
9294

9395
typedef boost::shared_ptr<MockModule> MockModulePtr;

0 commit comments

Comments
 (0)