00001 #ifndef INFOTON_CLASS
00002 #define INFOTON_CLASS
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "dll_octopus.h"
00019
00020 #include <basis/object_base.h>
00021 #include <basis/packable.h>
00022
00024
00028 class OCTOPUS_CLASS_STYLE infoton
00029 : public packable, public clonable, public virtual object_base
00030 {
00031 public:
00032 infoton(const string_array &classifier);
00034
00040
00041 infoton(const istring &class_1);
00042 infoton(const istring &class_1, const istring &class_2);
00043 infoton(const istring &class_1, const istring &class_2, const istring &cl_3);
00044
00045 infoton(const infoton &to_copy);
00047
00050 virtual ~infoton();
00051
00052 IMPLEMENT_CLASS_NAME("infoton");
00053
00054 infoton &operator =(const infoton &to_copy);
00056
00058 const string_array &classifier() const;
00060
00067 void set_classifier(const string_array &new_classifier);
00069
00072
00073
00074 void set_classifier(const istring &class_1);
00075 void set_classifier(const istring &class_1, const istring &class_2);
00076 void set_classifier(const istring &class_1, const istring &class_2,
00077 const istring &cl_3);
00078
00079 bool check_classifier(const istring &class_name, const istring &caller);
00081
00084 virtual void pack(byte_array &packed_form) const = 0;
00086
00088 virtual bool unpack(byte_array &packed_form) = 0;
00090
00093 virtual clonable *clone() const = 0;
00095
00096 virtual int packed_size() const = 0;
00098
00102
00103
00104
00105
00106
00107
00108 static void fast_pack(byte_array &packed_form, const infoton &to_pack);
00110
00111 static bool fast_unpack(byte_array &packed_form, string_array &classifier,
00112 byte_array &info);
00114
00117 static bool test_fast_unpack(const byte_array &packed_form,
00118 int &packed_length);
00120
00127 static int fast_pack_overhead(const string_array &classifier);
00129
00134 private:
00135 string_array *_classifier;
00136 };
00137
00139
00141
00142 template <class contents>
00143 clonable *cloner(const contents &this_obj) { return new contents(this_obj); }
00144
00145 #endif
00146