OpenWalnut  1.5.0dev
WDataModule.cpp
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #include "WDataModule.h"
26 
28  WModule(),
29  m_suppressColormaps( false ),
30  m_dataModuleInput( WDataModuleInput::SPtr() ),
31  m_inputChanged( new WCondition )
32 {
33  // initialize members
34 }
35 
37 {
38  // cleanup
39 }
40 
41 MODULE_TYPE WDataModule::getType() const
42 {
43  return MODULE_DATA;
44 }
45 
46 void WDataModule::setSuppressColormaps( bool suppress )
47 {
48  m_suppressColormaps = suppress;
49 }
50 
52 {
53  return m_suppressColormaps;
54 }
55 
57 {
58  m_dataModuleInput = input;
59  m_inputChanged->notify();
61 }
62 
64 {
65  return m_dataModuleInput;
66 }
67 
69 {
71 }
72 
74 {
75  return m_inputChanged;
76 }
Class to encapsulate boost::condition_variable_any.
Definition: WCondition.h:42
std::shared_ptr< const WCondition > ConstSPtr
Const shared pointer type for WCondition.
Definition: WCondition.h:53
This class is the abstract interface to all the possible inputs a WDataModule might handle.
std::shared_ptr< WDataModuleInput > SPtr
Convenience typedef for a std::shared_ptr< WDataModuleInput >.
bool m_suppressColormaps
If true, data modules are instructed to suppress colormap registration.
Definition: WDataModule.h:155
WDataModuleInput::SPtr m_dataModuleInput
The input this data module should use.
Definition: WDataModule.h:160
virtual MODULE_TYPE getType() const
Gets the type of the module.
Definition: WDataModule.cpp:41
WDataModule()
Default constructor.
Definition: WDataModule.cpp:27
virtual void handleInputChange()=0
Handle a newly set input.
WCondition::SPtr m_inputChanged
Condition that fires whenever the input changes via setInput.
Definition: WDataModule.h:165
WCondition::ConstSPtr getInputChangedCondition() const
Return the condition that gets triggered upon input change.
Definition: WDataModule.cpp:73
void reload()
Initiate an reloading of the data.
Definition: WDataModule.cpp:68
bool getSuppressColormaps() const
Checks whether suppression of colormaps is active.
Definition: WDataModule.cpp:51
virtual ~WDataModule()
Destructor.
Definition: WDataModule.cpp:36
virtual WDataModuleInput::SPtr getInput() const
Get the currently set input or NULL if none was set.
Definition: WDataModule.cpp:63
void setInput(WDataModuleInput::SPtr input)
Set the input of this data module.
Definition: WDataModule.cpp:56
virtual void setSuppressColormaps(bool suppress=true)
Allows suppression of colormap registration in data modules.
Definition: WDataModule.cpp:46
Class representing a single module of OpenWalnut.
Definition: WModule.h:72
std::shared_ptr< WThreadedRunner > SPtr
Abbreviation to a shared_ptr to this type.