1 // SMInvoker.h 2 3 #ifndef SM_INVOKER_H 4 #define SM_INVOKER_H 5 6 #include <Messenger.h> 7 8 class SMInvoker { 9 public: 10 SMInvoker(); 11 virtual ~SMInvoker(); 12 13 virtual status_t Invoke(BMessenger &target, BHandler *replyHandler, 14 BMessenger &replyMessenger) = 0; 15 16 bool ReplySuccess(); 17 bool DirectReply(); 18 19 protected: 20 BMessage *fReplyMessage; 21 }; 22 23 // Invoker for SendMessage(uint32, BHandler *) 24 class SMInvoker1 : public SMInvoker { 25 public: 26 SMInvoker1(bool useReplyTo); 27 28 virtual status_t Invoke(BMessenger &target, BHandler *replyHandler, 29 BMessenger &replyMessenger); 30 31 private: 32 bool fUseReplyTo; 33 }; 34 35 // Invoker for SendMessage(BMessage *, BHandler *, bigtime_t) 36 class SMInvoker2 : public SMInvoker { 37 public: 38 SMInvoker2(bool useMessage, bool useReplyTo, bigtime_t timeout); 39 40 virtual status_t Invoke(BMessenger &target, BHandler *replyHandler, 41 BMessenger &replyMessenger); 42 43 private: 44 bool fUseMessage; 45 bool fUseReplyTo; 46 bigtime_t fTimeout; 47 }; 48 49 // Invoker for SendMessage(BMessage *, BMessenger, bigtime_t) 50 class SMInvoker3 : public SMInvoker { 51 public: 52 SMInvoker3(bool useMessage, bool useReplyTo, bigtime_t timeout); 53 54 virtual status_t Invoke(BMessenger &target, BHandler *replyHandler, 55 BMessenger &replyMessenger); 56 57 private: 58 bool fUseMessage; 59 bool fUseReplyTo; 60 bigtime_t fTimeout; 61 }; 62 63 // Invoker for SendMessage(uint32, BMessage *) 64 class SMInvoker4 : public SMInvoker { 65 public: 66 SMInvoker4(bool useReply); 67 68 virtual status_t Invoke(BMessenger &target, BHandler *replyHandler, 69 BMessenger &replyMessenger); 70 71 private: 72 bool fUseReply; 73 }; 74 75 // Invoker for SendMessage(BMessage *, BMessage *, bigtime_t, bigtime_t) 76 class SMInvoker5 : public SMInvoker { 77 public: 78 SMInvoker5(bool useMessage, bool useReply, bigtime_t deliveryTimeout, 79 bigtime_t replyTimeout); 80 81 virtual status_t Invoke(BMessenger &target, BHandler *replyHandler, 82 BMessenger &replyMessenger); 83 84 private: 85 bool fUseMessage; 86 bool fUseReply; 87 bigtime_t fDeliveryTimeout; 88 bigtime_t fReplyTimeout; 89 }; 90 91 #endif // SM_INVOKER_H 92