00001 #ifndef __BUFFEREDSERIALIZEACTION_H__ 00002 #define __BUFFEREDSERIALIZEACTION_H__ 00003 00004 #include "Serialize.h" 00005 00006 namespace oasys { 00007 00008 class ExpandableBuffer; 00009 00011 00015 class BufferedSerializeAction : public SerializeAction { 00016 public: 00020 BufferedSerializeAction(action_t action, context_t context, 00021 u_char* buf, size_t length, 00022 int options = 0); 00023 00027 BufferedSerializeAction(action_t action, context_t context, 00028 ExpandableBuffer* buf, 00029 int options = 0); 00030 00036 virtual void process(const char* name, SerializableObject* object) 00037 { 00038 (void)name; 00039 object->serialize(this); 00040 } 00041 00042 protected: 00048 u_char* next_slice(size_t length); 00049 00051 u_char* buf(); 00052 00054 size_t length(); 00055 00057 size_t offset(); 00058 00059 private: 00061 ExpandableBuffer* expandable_buf_; 00062 00063 // Fields used for fixed length buffer 00064 00065 u_char* buf_; 00066 size_t length_; 00067 size_t offset_; 00068 }; 00069 00070 } // namespace oasys 00071 00072 #endif /* __BUFFEREDSERIALIZEACTION_H__ */