From: Kefu Chai Date: Sun, 14 Apr 2019 15:33:50 +0000 (+0800) Subject: msg/Message: drop MessageFactory and friends X-Git-Tag: v15.1.0~2896^2~7 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0a7415b049bffe3afb45b27ed8c9df0f8f0a1883;p=ceph-ci.git msg/Message: drop MessageFactory and friends we'd better decouple the helpers from the definition of Message types, to keep the definition Messages simple and concise. Signed-off-by: Kefu Chai --- diff --git a/src/msg/Message.h b/src/msg/Message.h index 8686d1871b1..e52dc528073 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -521,44 +521,6 @@ extern void encode_message(Message *m, uint64_t features, ceph::buffer::list& bl extern Message *decode_message(CephContext *cct, int crcflags, ceph::buffer::list::const_iterator& bl); -template -class MessageFactory { -public: -template - static typename MessageType::ref build(Args&&... args) { - return typename MessageType::ref(new MessageType(std::forward(args)...), false); - } -}; - -template -class MessageSubType : public M { -public: - typedef boost::intrusive_ptr ref; - typedef boost::intrusive_ptr const_ref; - -protected: -template - MessageSubType(Args&&... args) : M(std::forward(args)...) {} - virtual ~MessageSubType() override {} -}; - - -template -class MessageInstance : public MessageSubType { -public: - using factory = MessageFactory; - - template - static auto create(Args&&... args) { - return MessageFactory::build(std::forward(args)...); - } - -protected: -template - MessageInstance(Args&&... args) : MessageSubType(std::forward(args)...) {} - virtual ~MessageInstance() override {} -}; - namespace ceph { template using ref_t = boost::intrusive_ptr; template using cref_t = boost::intrusive_ptr;