00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef CMS_UP_HH
00011 #define CMS_UP_HH
00012
00013 #include "cms.hh"
00014
00015 enum CMS_UPDATER_MODE
00016 {
00017 CMS_NO_UPDATE = 0,
00018 CMS_ENCODE_DATA,
00019 CMS_DECODE_DATA,
00020 CMS_ENCODE_HEADER,
00021 CMS_DECODE_HEADER,
00022 CMS_ENCODE_QUEUING_HEADER,
00023 CMS_DECODE_QUEUING_HEADER
00024 };
00025
00026 struct CMS_POINTER_TABLE_ENTRY
00027 {
00028 void *ptr;
00029 };
00030
00031
00032
00033 class RCS_EXPORT CMS_UPDATER
00034 {
00035 public:
00036 virtual CMS_STATUS update (char &x) = 0;
00037 virtual CMS_STATUS update (unsigned char &x) = 0;
00038 virtual CMS_STATUS update (short int &x) = 0;
00039 virtual CMS_STATUS update (unsigned short int &x) = 0;
00040 virtual CMS_STATUS update (int &x) = 0;
00041 virtual CMS_STATUS update (unsigned int &x) = 0;
00042 virtual CMS_STATUS update (long int &x) = 0;
00043 virtual CMS_STATUS update (unsigned long int &x) = 0;
00044 virtual CMS_STATUS update (float &x) = 0;
00045 virtual CMS_STATUS update (double &x) = 0;
00046 virtual CMS_STATUS update (long double &x) = 0;
00047 virtual CMS_STATUS update (char *x, unsigned int len) = 0;
00048 virtual CMS_STATUS update (unsigned char *x, unsigned int len) = 0;
00049 virtual CMS_STATUS update (short *x, unsigned int len) = 0;
00050 virtual CMS_STATUS update (unsigned short *x, unsigned int len) = 0;
00051 virtual CMS_STATUS update (int *x, unsigned int len) = 0;
00052 virtual CMS_STATUS update (unsigned int *x, unsigned int len) = 0;
00053 virtual CMS_STATUS update (long *x, unsigned int len) = 0;
00054 virtual CMS_STATUS update (unsigned long *x, unsigned int len) = 0;
00055 virtual CMS_STATUS update (float *x, unsigned int len) = 0;
00056 virtual CMS_STATUS update (double *x, unsigned int len) = 0;
00057 virtual CMS_STATUS update (long double *x, unsigned int len) = 0;
00058
00059 virtual void rewind ();
00060 virtual int get_encoded_msg_size () = 0;
00061 virtual int set_mode (CMS_UPDATER_MODE);
00062 virtual CMS_UPDATER_MODE get_mode ();
00063 virtual void set_encoded_data (void *, long _encoded_data_size);
00064
00065 #ifdef CMS_SUPPORT_POINTERS
00066 virtual CMS_STATUS update_ptr (int (*update_ptr_func) (void *, CMS *),
00067 void **x, long xsize);
00068 virtual CMS_STATUS set_pointer_buffer (char *buf, long size);
00069 #endif
00070 protected:
00071
00072
00073
00074
00075
00076
00077
00078 void *(&encoded_data);
00079 void *(&encoded_header);
00080 void *(&encoded_queuing_header);
00081 CMS_STATUS & status;
00082 long &size;
00083 long &encoded_header_size;
00084 long &encoded_queuing_header_size;
00085 int &using_external_encoded_data;
00086 int &pointer_check_disabled;
00087 long &encoded_data_size;
00088
00089 virtual int check_pointer (char RCS_HUGE * ptr, long bytes);
00090 CMS_UPDATER_MODE mode;
00091 CMS *cms_parent;
00092
00093
00094
00095 CMS_UPDATER (CMS *, int create_encoded_data = 1, long _neutral_size_factor = 4);
00096 virtual ~ CMS_UPDATER ();
00097 long neutral_size_factor;
00098
00099 #ifdef CMS_SUPPORT_POINTERS
00100 CMS_POINTER_TABLE_ENTRY *ptr_table;
00101 CMS_POINTER_TABLE_ENTRY *ptr_table_entry;
00102 char *pointer_buf;
00103 long pointer_buf_size;
00104 char *unused_pointer_buf;
00105 long unused_pointer_buf_size;
00106 int pointers_in_table;
00107 #endif
00108 int encoding;
00109
00110
00111 friend class RCS_EXPORT CMS;
00112 };
00113
00114
00115 #endif