Get *=default*ed default constructors
[folly.git] / folly / wangle / channel / Pipeline.h
index 14a586ffa813f76b7d3aa94cc9577ee6c09e2d96..174c5d9f1b7512bfd3d77a2b0d801de54410da12 100644 (file)
@@ -27,12 +27,14 @@ namespace folly { namespace wangle {
 
 class PipelineManager {
  public:
-  virtual ~PipelineManager() {}
+  virtual ~PipelineManager() = default;
   virtual void deletePipeline(PipelineBase* pipeline) = 0;
 };
 
-class PipelineBase {
+class PipelineBase : public DelayedDestruction {
  public:
+  virtual ~PipelineBase() = default;
+
   void setPipelineManager(PipelineManager* manager) {
     manager_ = manager;
   }
@@ -43,8 +45,17 @@ class PipelineBase {
     }
   }
 
+  void setTransport(std::shared_ptr<AsyncTransport> transport) {
+    transport_ = transport;
+  }
+
+  std::shared_ptr<AsyncTransport> getTransport() {
+    return transport_;
+  }
+
  private:
   PipelineManager* manager_{nullptr};
+  std::shared_ptr<AsyncTransport> transport_;
 };
 
 struct Nothing{};
@@ -58,13 +69,11 @@ struct Nothing{};
  * If W is Nothing, write() and close() will be disabled.
  */
 template <class R, class W = Nothing>
-class Pipeline : public PipelineBase, public DelayedDestruction {
+class Pipeline : public PipelineBase {
  public:
   Pipeline();
   ~Pipeline();
 
-  std::shared_ptr<AsyncTransport> getTransport();
-
   void setWriteFlags(WriteFlags flags);
   WriteFlags getWriteFlags();
 
@@ -83,6 +92,14 @@ class Pipeline : public PipelineBase, public DelayedDestruction {
   typename std::enable_if<!std::is_same<T, Nothing>::value>::type
   readException(exception_wrapper e);
 
+  template <class T = R>
+  typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+  transportActive();
+
+  template <class T = R>
+  typename std::enable_if<!std::is_same<T, Nothing>::value>::type
+  transportInactive();
+
   template <class T = W>
   typename std::enable_if<!std::is_same<T, Nothing>::value, Future<void>>::type
   write(W msg);
@@ -121,10 +138,6 @@ class Pipeline : public PipelineBase, public DelayedDestruction {
   template <class H>
   bool setOwner(H* handler);
 
-  void attachTransport(std::shared_ptr<AsyncTransport> transport);
-
-  void detachTransport();
-
  protected:
   explicit Pipeline(bool isStatic);
 
@@ -137,7 +150,6 @@ class Pipeline : public PipelineBase, public DelayedDestruction {
   template <class Context>
   Pipeline& addHelper(std::shared_ptr<Context>&& ctx, bool front);
 
-  std::shared_ptr<AsyncTransport> transport_;
   WriteFlags writeFlags_{WriteFlags::NONE};
   std::pair<uint64_t, uint64_t> readBufferSettings_{2048, 2048};
 
@@ -162,7 +174,7 @@ class PipelineFactory {
   virtual std::unique_ptr<Pipeline, folly::DelayedDestruction::Destructor>
   newPipeline(std::shared_ptr<AsyncSocket>) = 0;
 
-  virtual ~PipelineFactory() {}
+  virtual ~PipelineFactory() = default;
 };
 
 }