summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/StreamStack/StreamStack.h')
-rw-r--r--Swiften/StreamStack/StreamStack.h27
1 files changed, 13 insertions, 14 deletions
diff --git a/Swiften/StreamStack/StreamStack.h b/Swiften/StreamStack/StreamStack.h
index bc2e89b..87c522d 100644
--- a/Swiften/StreamStack/StreamStack.h
+++ b/Swiften/StreamStack/StreamStack.h
@@ -1,5 +1,4 @@
-#ifndef SWIFTEN_STREAMSTACK_H
-#define SWIFTEN_STREAMSTACK_H
+#pragma once
#include <boost/shared_ptr.hpp>
#include <boost/signal.hpp>
@@ -15,31 +14,31 @@ namespace Swift {
class StreamStack {
public:
- StreamStack(XMPPLayer* xmppLayer, LowLayer* physicalLayer);
+ StreamStack(boost::shared_ptr<XMPPLayer> xmppLayer, boost::shared_ptr<LowLayer> physicalLayer);
+ ~StreamStack();
- void addLayer(StreamLayer*);
+ void addLayer(boost::shared_ptr<StreamLayer>);
- XMPPLayer* getXMPPLayer() const {
+ boost::shared_ptr<XMPPLayer> getXMPPLayer() const {
return xmppLayer_;
}
- template<typename T> T* getLayer() {
- foreach(StreamLayer* streamLayer, layers_) {
- T* layer = dynamic_cast<T*>(streamLayer);
+ template<typename T> boost::shared_ptr<T> getLayer() {
+ foreach(const boost::shared_ptr<StreamLayer>& streamLayer, layers_) {
+ boost::shared_ptr<T> layer = boost::dynamic_pointer_cast<T>(streamLayer);
if (layer) {
return layer;
}
}
- return 0;
+ return boost::shared_ptr<T>();
}
private:
- XMPPLayer* xmppLayer_;
- LowLayer* physicalLayer_;
- std::vector<StreamLayer*> layers_;
+ boost::shared_ptr<XMPPLayer> xmppLayer_;
+ boost::shared_ptr<LowLayer> physicalLayer_;
+ std::vector< boost::shared_ptr<StreamLayer> > layers_;
boost::bsignals::connection xmppReadSlotConnection_;
boost::bsignals::connection xmppWriteSignalConnection_;
+ std::vector< boost::bsignals::connection > writeSignalConnections_;
};
}
-
-#endif