proxygen
wangle::ContextImplBase< H, Context > Class Template Reference

#include <HandlerContext-inl.h>

Inheritance diagram for wangle::ContextImplBase< H, Context >:
wangle::PipelineContext

Public Member Functions

 ~ContextImplBase () override=default
 
H * getHandler ()
 
void initialize (std::weak_ptr< PipelineBase > pipeline, std::shared_ptr< H > handler)
 
void attachPipeline () override
 
void detachPipeline () override
 
void setNextIn (PipelineContext *ctx) override
 
void setNextOut (PipelineContext *ctx) override
 
HandlerDir getDirection () override
 
- Public Member Functions inherited from wangle::PipelineContext
virtual ~PipelineContext ()=default
 
template<class H , class HandlerContext >
void attachContext (H *handler, HandlerContext *ctx)
 
template<class H , class HandlerContext >
void detachContext (H *handler, HandlerContext *)
 

Protected Attributes

Context * impl_
 
std::weak_ptr< PipelineBasepipelineWeak_
 
PipelineBasepipelineRaw_
 
std::shared_ptr< H > handler_
 
InboundLink< typename H::rout > * nextIn_ {nullptr}
 
OutboundLink< typename H::wout > * nextOut_ {nullptr}
 

Private Attributes

bool attached_ {false}
 

Detailed Description

template<class H, class Context>
class wangle::ContextImplBase< H, Context >

Definition at line 75 of file HandlerContext-inl.h.

Constructor & Destructor Documentation

template<class H, class Context>
wangle::ContextImplBase< H, Context >::~ContextImplBase ( )
overridedefault

Member Function Documentation

template<class H, class Context>
void wangle::ContextImplBase< H, Context >::attachPipeline ( )
inlineoverridevirtual

Implements wangle::PipelineContext.

Definition at line 92 of file HandlerContext-inl.h.

92  {
93  if (!attached_) {
94  this->attachContext(handler_.get(), impl_);
95  handler_->attachPipeline(impl_);
96  attached_ = true;
97  }
98  }
std::shared_ptr< H > handler_
void attachContext(H *handler, HandlerContext *ctx)
template<class H, class Context>
void wangle::ContextImplBase< H, Context >::detachPipeline ( )
inlineoverridevirtual

Implements wangle::PipelineContext.

Definition at line 100 of file HandlerContext-inl.h.

100  {
101  handler_->detachPipeline(impl_);
102  attached_ = false;
103  this->detachContext(handler_.get(), impl_);
104  }
void detachContext(H *handler, HandlerContext *)
std::shared_ptr< H > handler_
template<class H, class Context>
HandlerDir wangle::ContextImplBase< H, Context >::getDirection ( )
inlineoverridevirtual

Implements wangle::PipelineContext.

Definition at line 134 of file HandlerContext-inl.h.

134  {
135  return H::dir;
136  }
template<class H, class Context>
H* wangle::ContextImplBase< H, Context >::getHandler ( )
inline

Definition at line 79 of file HandlerContext-inl.h.

79  {
80  return handler_.get();
81  }
std::shared_ptr< H > handler_
template<class H, class Context>
void wangle::ContextImplBase< H, Context >::initialize ( std::weak_ptr< PipelineBase pipeline,
std::shared_ptr< H >  handler 
)
inline

Definition at line 83 of file HandlerContext-inl.h.

85  {
86  pipelineWeak_ = pipeline;
87  pipelineRaw_ = pipeline.lock().get();
89  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void handler(int, siginfo_t *, void *)
std::weak_ptr< PipelineBase > pipelineWeak_
std::shared_ptr< H > handler_
template<class H, class Context>
void wangle::ContextImplBase< H, Context >::setNextIn ( PipelineContext ctx)
inlineoverridevirtual

Implements wangle::PipelineContext.

Definition at line 106 of file HandlerContext-inl.h.

106  {
107  if (!ctx) {
108  nextIn_ = nullptr;
109  return;
110  }
111  auto nextIn = dynamic_cast<InboundLink<typename H::rout>*>(ctx);
112  if (nextIn) {
113  nextIn_ = nextIn;
114  } else {
115  throw std::invalid_argument(folly::sformat(
116  "inbound type mismatch after {}", folly::demangle(typeid(H))));
117  }
118  }
InboundLink< typename H::rout > * nextIn_
std::string sformat(StringPiece fmt, Args &&...args)
Definition: Format.h:280
fbstring demangle(const char *name)
Definition: Demangle.cpp:111
template<class H, class Context>
void wangle::ContextImplBase< H, Context >::setNextOut ( PipelineContext ctx)
inlineoverridevirtual

Implements wangle::PipelineContext.

Definition at line 120 of file HandlerContext-inl.h.

120  {
121  if (!ctx) {
122  nextOut_ = nullptr;
123  return;
124  }
125  auto nextOut = dynamic_cast<OutboundLink<typename H::wout>*>(ctx);
126  if (nextOut) {
127  nextOut_ = nextOut;
128  } else {
129  throw std::invalid_argument(folly::sformat(
130  "outbound type mismatch after {}", folly::demangle(typeid(H))));
131  }
132  }
std::string sformat(StringPiece fmt, Args &&...args)
Definition: Format.h:280
OutboundLink< typename H::wout > * nextOut_
fbstring demangle(const char *name)
Definition: Demangle.cpp:111

Member Data Documentation

template<class H, class Context>
bool wangle::ContextImplBase< H, Context >::attached_ {false}
private

Definition at line 147 of file HandlerContext-inl.h.

template<class H, class Context>
std::shared_ptr<H> wangle::ContextImplBase< H, Context >::handler_
protected

Definition at line 142 of file HandlerContext-inl.h.

template<class H, class Context>
Context* wangle::ContextImplBase< H, Context >::impl_
protected

Definition at line 139 of file HandlerContext-inl.h.

template<class H, class Context>
InboundLink<typename H::rout>* wangle::ContextImplBase< H, Context >::nextIn_ {nullptr}
protected

Definition at line 143 of file HandlerContext-inl.h.

template<class H, class Context>
OutboundLink<typename H::wout>* wangle::ContextImplBase< H, Context >::nextOut_ {nullptr}
protected

Definition at line 144 of file HandlerContext-inl.h.

template<class H, class Context>
PipelineBase* wangle::ContextImplBase< H, Context >::pipelineRaw_
protected

Definition at line 141 of file HandlerContext-inl.h.

template<class H, class Context>
std::weak_ptr<PipelineBase> wangle::ContextImplBase< H, Context >::pipelineWeak_
protected

Definition at line 140 of file HandlerContext-inl.h.


The documentation for this class was generated from the following file: