Skip to content

Commit df142de

Browse files
committed
Refactoring for #1387
1 parent 74de077 commit df142de

31 files changed

+272
-121
lines changed

src/Core/Datatypes/Color.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
#include <iosfwd>
3535
#include <Core/Datatypes/Datatype.h>
36+
#include <Core/Datatypes/Geometry.h>
37+
#include <Core/Algorithms/Base/Variable.h>
3638
#include <Core/Datatypes/share.h>
3739

3840
namespace SCIRun {
@@ -49,24 +51,24 @@ namespace Datatypes {
4951
ColorRGB(double r, double g, double b);
5052
ColorRGB(double r, double g, double b, double a);
5153
//adjust alpha while copying
52-
ColorRGB(const ColorRGB& color, double a);
54+
//ColorRGB(const ColorRGB& color, double a);
5355

5456
// These equality operations should use floating point comparisons.
55-
inline bool operator==(const ColorRGB& c) const {
57+
bool operator==(const ColorRGB& c) const {
5658
return ((r_==c.r_)&&(g_==c.g_)&&(b_==c.b_)&&(a_==c.a_));
5759
}
5860

59-
inline bool operator!=(const ColorRGB& c) const {
61+
bool operator!=(const ColorRGB& c) const {
6062
return !(*this == c);
6163
}
6264

6365
/// \todo Add normalization function to normalize 0 - 255 to 0 - 1.0.
6466
/// useful when reading colors from strings.
6567

66-
inline double r() const {return r_;}
67-
inline double g() const {return g_;}
68-
inline double b() const {return b_;}
69-
inline double a() const {return a_;}
68+
double r() const {return r_;}
69+
double g() const {return g_;}
70+
double b() const {return b_;}
71+
double a() const {return a_;}
7072

7173
std::string toString() const;
7274
};
@@ -75,6 +77,11 @@ namespace Datatypes {
7577

7678
SCISHARE std::ostream& operator<<(std::ostream& out, const ColorRGB& color);
7779

80+
struct SCISHARE ViewSceneFeedback : ModuleFeedback
81+
{
82+
Algorithms::Variable info;
83+
};
84+
7885
}}}
7986

8087

src/Core/Datatypes/Geometry.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ GeometryObject::GeometryObject(const GeometryIDGenerator& idGenerator, const std
3636
{
3737
}
3838

39-
GeometryObject::GeometryObject(const std::string& tag) :
40-
objectName_(tag)
41-
{
42-
}
43-
4439
GeometryObject* GeometryObject::clone() const
4540
{
4641
return nullptr; //TODO

src/Core/Datatypes/Geometry.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ namespace Datatypes
4343
{
4444
public:
4545
GeometryObject(const GeometryIDGenerator& idGenerator, const std::string& tag);
46-
GeometryObject(const std::string& tag);
4746

4847
GeometryObject(const GeometryObject& other) = delete;
4948
GeometryObject& operator=(const GeometryObject& other) = delete;
@@ -58,6 +57,11 @@ namespace Datatypes
5857
const std::string objectName_; ///< Name of this object. Should be unique across all modules in the network.
5958
};
6059

60+
struct SCISHARE ModuleFeedback
61+
{
62+
// tag class
63+
};
64+
6165
}}}
6266

6367

src/Core/GeometryPrimitives/BBox.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ BBox::overlaps_inside(const BBox & bb) const
111111
}
112112

113113
bool
114-
BBox::intersect(const Point& origin, const Vector& dir,
115-
Point& hitPoint)
114+
BBox::intersect(const Point& origin, const Vector& dir, Point& hitPoint) const
116115
{
117116
Vector t1 = (cmin_ - origin) / dir;
118117
Vector t2 = (cmax_ - origin) / dir;

src/Core/GeometryPrimitives/BBox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ class BBox {
242242

243243
/// returns true if the ray hit the bbox and returns the hit point
244244
/// in hitNear
245-
SCISHARE bool intersect(const Point& e, const Vector& v, Point& hitNear);
245+
SCISHARE bool intersect(const Point& e, const Vector& v, Point& hitNear) const;
246246

247247
friend std::ostream& operator<<(std::ostream& out, const BBox& b);
248248

src/Dataflow/Network/Module.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ namespace Networks {
8383
virtual bool hasInputPort(const PortId& id) const;
8484
virtual bool hasOutputPort(const PortId& id) const;
8585
virtual InputPortHandle getInputPort(const PortId& id);
86-
virtual OutputPortHandle getOutputPort(const PortId& id) const;
86+
virtual OutputPortHandle getOutputPort(const PortId& id) const override final;
8787
virtual std::vector<InputPortHandle> findInputPortsWithName(const std::string& name) const;
8888
virtual std::vector<OutputPortHandle> findOutputPortsWithName(const std::string& name) const;
8989
virtual std::vector<InputPortHandle> inputPorts() const;
@@ -264,7 +264,7 @@ namespace Networks {
264264

265265
//For modules that need to initialize some internal state signal/slots, this needs to be called after set_state to reinitialize.
266266
virtual void postStateChangeInternalSignalHookup() {}
267-
void sendFeedbackUpstreamAlongIncomingConnections(const ModuleFeedback& feedback) const;
267+
void sendFeedbackUpstreamAlongIncomingConnections(const Core::Datatypes::ModuleFeedback& feedback) const;
268268

269269
private:
270270
template <class T>

src/Dataflow/Network/NetworkFwd.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ typedef boost::shared_ptr<NetworkFile> NetworkFileHandle;
100100
typedef std::map<std::string, std::map<std::string, std::map<std::string, ModuleDescription>>> ModuleDescriptionMap;
101101
typedef boost::function<bool(SCIRun::Dataflow::Networks::ModuleHandle)> ModuleFilter;
102102
typedef boost::function<bool(const SCIRun::Dataflow::Networks::ConnectionDescription&)> ConnectionFilter;
103-
typedef boost::any ModuleFeedback;
104103

105104
}}}
106105

src/Dataflow/Network/Port.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ boost::signals2::connection OutputPort::connectConnectionFeedbackListener(const
205205
return cxnFeedback_.connect(subscriber);
206206
}
207207

208-
void OutputPort::sendConnectionFeedback(ModuleFeedback info)
208+
void OutputPort::sendConnectionFeedback(const ModuleFeedback& info)
209209
{
210210
cxnFeedback_(info);
211211
}

src/Dataflow/Network/Port.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class SCISHARE OutputPort : public Port, public OutputPortInterface
127127
virtual void attach(Connection* conn) override;
128128
virtual PortDataDescriber getPortDataDescriber() const override;
129129
virtual boost::signals2::connection connectConnectionFeedbackListener(const ConnectionFeedbackSignalType::slot_type& subscriber) override;
130-
virtual void sendConnectionFeedback(ModuleFeedback info) override;
130+
virtual void sendConnectionFeedback(const Core::Datatypes::ModuleFeedback& info) override;
131131
private:
132132
DatatypeSourceInterfaceHandle source_;
133133
ConnectionFeedbackSignalType cxnFeedback_;

src/Dataflow/Network/PortInterface.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@
3535
#define DATAFLOW_NETWORK_PORT_INTERFACE_H
3636

3737
#include <string>
38-
#include <vector>
3938
#include <boost/signals2/signal.hpp>
4039
#include <Dataflow/Network/NetworkFwd.h>
41-
#include <Core/Datatypes/Datatype.h>
42-
#include <Core/Algorithms/Base/Variable.h>
40+
#include <Core/Datatypes/Geometry.h> //TODO
4341
#include <Dataflow/Network/share.h>
4442

4543
namespace SCIRun {
@@ -73,7 +71,7 @@ namespace Networks {
7371
virtual void setId(const PortId& id) = 0;
7472
};
7573

76-
typedef boost::signals2::signal<void(const PortId&, SCIRun::Core::Datatypes::DatatypeHandle)> DataOnPortHasChangedSignalType;
74+
typedef boost::signals2::signal<void(const PortId&, Core::Datatypes::DatatypeHandle)> DataOnPortHasChangedSignalType;
7775
typedef boost::function<std::string()> PortDataDescriber;
7876

7977
class SCISHARE InputPortInterface : virtual public PortInterface
@@ -87,7 +85,7 @@ namespace Networks {
8785
virtual boost::signals2::connection connectDataOnPortHasChanged(const DataOnPortHasChangedSignalType::slot_type& subscriber) = 0;
8886
};
8987

90-
typedef boost::signals2::signal<void(ModuleFeedback)> ConnectionFeedbackSignalType;
88+
typedef boost::signals2::signal<void(const Core::Datatypes::ModuleFeedback&)> ConnectionFeedbackSignalType;
9189

9290
class SCISHARE OutputPortInterface : virtual public PortInterface
9391
{
@@ -99,13 +97,13 @@ namespace Networks {
9997
virtual OutputPortInterface* clone() const { return nullptr; } // TODO
10098
virtual PortDataDescriber getPortDataDescriber() const = 0;
10199
virtual boost::signals2::connection connectConnectionFeedbackListener(const ConnectionFeedbackSignalType::slot_type& subscriber) = 0;
102-
virtual void sendConnectionFeedback(ModuleFeedback info) = 0;
100+
virtual void sendConnectionFeedback(const Core::Datatypes::ModuleFeedback& info) = 0;
103101
};
104102

105103
class SCISHARE PortConnectionDeterminer
106104
{
107105
public:
108-
bool canBeConnected(const SCIRun::Dataflow::Networks::PortDescriptionInterface& port1, const SCIRun::Dataflow::Networks::PortDescriptionInterface& port2) const;
106+
bool canBeConnected(const PortDescriptionInterface& port1, const PortDescriptionInterface& port2) const;
109107
};
110108

111109
}}}

0 commit comments

Comments
 (0)