00001 #ifndef OUTCOME_CLASS
00002 #define OUTCOME_CLASS
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 class byte_array;
00020
00022
00029 class outcome
00030 {
00031 public:
00032 inline outcome(int value = 0) : _o_value(value) {}
00034
00040 inline ~outcome() { _o_value = 0; }
00041
00042 inline bool operator == (const outcome &to_compare) const
00043 { return _o_value == to_compare._o_value; }
00045
00047 inline bool operator != (const outcome &to_compare) const
00048 { return _o_value != to_compare._o_value; }
00050
00051 inline bool operator == (int to_compare) const
00052 { return _o_value == to_compare; }
00054 inline bool operator != (int to_compare) const
00055 { return _o_value != to_compare; }
00057
00058 inline int value() const { return _o_value; }
00059
00060
00061 void pack(byte_array &packed_form) const;
00062
00063
00064 bool unpack(byte_array &packed_form);
00065
00066
00067 int packed_size() const { return sizeof(_o_value); }
00068
00069
00070 private:
00071 int _o_value;
00072 };
00073
00075
00077 #define PROMOTE_OUTCOME(outc) \
00078 if (outc != common::OKAY) return outc
00079
00081
00083
00089 #define DEFINE_OUTCOME(NAME, CURRENT_VALUE, INFO_STRING) \
00090 NAME = CURRENT_VALUE
00091
00093
00099 #define DEFINE_API_OUTCOME(NAME, CURRENT_VALUE, INFO_STRING) \
00100 NAME = CURRENT_VALUE
00101
00103
00104 #endif
00105