00001 #ifndef _DHT_KADC_MESSAGE_H_
00002 #define _DHT_KADC_MESSAGE_H_
00003
00004 #include "../notify_handler.h"
00005 #include "task.h"
00006
00007 namespace dht {
00008 namespace kadc {
00009 class message {
00010 task *_from;
00011 int _msg_type;
00012 int _code;
00013 const char *_string;
00014 notify_handler *_handler;
00015 bool _success;
00016 public:
00017 message(task *f, int type) :
00018 _from(f),
00019 _msg_type(type),
00020 _code(0),
00021 _string(NULL),
00022 _handler(NULL),
00023 _success(false)
00024 {
00025 }
00026
00027 virtual ~message();
00028
00029 inline int type() const { return _msg_type; }
00030 inline void type(int t) { _msg_type = t; }
00031
00032 inline task *from_task() const { return _from; }
00033
00034 inline bool success() const { return _success; }
00035 inline void success(bool s) { _success = s; }
00036
00037 inline notify_handler *handler() const { return _handler; }
00038 inline void handler(notify_handler *h) { _handler = h; }
00039
00040 inline int code() const { return _code; }
00041 inline void code(int c) { _code = c; }
00042
00043 inline const char *string() const { return _string; }
00044 inline void string(const char *s) { _string = s; }
00045 };
00046 }
00047 }
00048
00049 #endif //_DHT_KADC_MESSAGE_H_