Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

cms_up.hh

Go to the documentation of this file.
00001 /**************************************************************************
00002 * File: cms_up.hh
00003 * This C++ header file defines the abstract CMS_UPDATER class that defines the
00004 * interface used by CMS to convert between local machine-specific data
00005 * representations and network machine-independant represantations such as XDR
00006 *  via the derived classes of CMS_UPDATER.
00007 ***************************************************************************/
00008 
00009 
00010 #ifndef CMS_UP_HH
00011 #define CMS_UP_HH
00012 
00013 #include "cms.hh"               /* enum CMS_STATUS, class CMS  */
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 /* Abstract CMS_UPDATER CLASS */
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   /* Neutrally Encoded Buffer positioning functions. */
00059   virtual void rewind ();       /* positions at beginning */
00060   virtual int get_encoded_msg_size () = 0;      /* Store last position in header.size */
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   * Aliases to variables in the CMS parent
00074   * using aliases lets CMS and its CMS_UPDATER share this information
00075   * more conveniently and allowed the CMS_UPDATER functions to be pulled out
00076   * of CMS with fewer changes.
00077   *********************************************/
00078   void *(&encoded_data);        /* pointer to local copy of encoded data */
00079   void *(&encoded_header);      /* pointer to local copy of encoded header */
00080   void *(&encoded_queuing_header);      /* pointer to local copy of encoded queue info */
00081     CMS_STATUS & status;
00082   long &size;
00083   long &encoded_header_size;    /* Dynamically determined size */
00084   long &encoded_queuing_header_size;    /* Dynamically determined 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   /* Friends */
00111   friend class RCS_EXPORT CMS;
00112 };
00113 
00114 
00115 #endif /* !defined( CMS_UP_HH ) */

Generated on Sun Dec 2 15:56:49 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001