00001 #ifndef BUFFER_BASE_CLASS
00002 #define BUFFER_BASE_CLASS
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <basis/object_base.h>
00019
00020
00021 class buffer_key;
00022 class span_manager;
00023 class time_stamp;
00024
00026
00027 class buffer_base : public virtual object_base
00028 {
00029 public:
00030 virtual ~buffer_base();
00032
00033 virtual bool alive() const = 0;
00035
00037 enum outcomes {
00038 OKAY = common::OKAY,
00039 IN_USE = common::IN_USE,
00040 OUT_OF_MEMORY = common::OUT_OF_MEMORY,
00041 BAD_INPUT = common::BAD_INPUT,
00042 NO_SPACE = common::NO_SPACE,
00043 INCOMPLETE = common::INCOMPLETE,
00044 NOT_FOUND = common::NOT_FOUND
00045 };
00046
00047 static const char *outcome_name(const outcome &to_name);
00049
00050 virtual int packets() const = 0;
00052
00053 virtual buffer_key key() const = 0;
00055 virtual void set_key(const buffer_key &to_set) = 0;
00057
00058 virtual outcome store_packet(int packet_number, const byte_array &buffer) = 0;
00060
00063 virtual byte_array get_packet(int packet_number) const = 0;
00065
00067 virtual int packet_length(int packet_number) const = 0;
00069
00070 virtual bool whole() const = 0;
00072
00073 virtual bool empty() const = 0;
00075
00076 virtual int full_length(int offset = 0) const = 0;
00078
00085 virtual int guess_size(int offset = 0) = 0;
00087
00093 virtual bool did_estimate() const = 0;
00095 virtual void reset_estimate() = 0;
00097 virtual int estimate() const = 0;
00099
00100 virtual outcome dump(byte_array &storage_location, int offset = 0) = 0;
00102
00109 enum release_style { RESET_STATUS, KEEP_STATUS };
00110 virtual void release(int packet_number,
00111 release_style status_handling = KEEP_STATUS) = 0;
00113
00118 virtual void release() = 0;
00120
00121 virtual istring text_form() const = 0;
00123
00124 virtual istring detailed_form(bool really_detailed = false) const = 0;
00126
00129 virtual time_stamp last_add() const = 0;
00131 virtual void set_last_add(const time_stamp &new_last_add) = 0;
00133
00134 virtual bool owner_alerted() const = 0;
00136
00138 virtual void set_alerted(bool owner_alerted) = 0;
00140
00141 virtual void get_attachment(byte_array &storage) const = 0;
00143 virtual void set_attachment(const byte_array &new_attachment) = 0;
00145
00146 virtual span_manager buffer_status() const = 0;
00148 virtual int_array packet_sizes() const = 0;
00150 };
00151
00152 #endif
00153