00001 #ifndef TYPELIB_VALUE_OPS_HH 00002 #define TYPELIB_VALUE_OPS_HH 00003 00004 #include <typelib/memory_layout.hh> 00005 #include <typelib/value.hh> 00006 #include <iosfwd> 00007 00008 namespace Typelib 00009 { 00010 void init(Value v); 00011 void init(Value v, MemoryLayout const& ops); 00012 void init(uint8_t* data, MemoryLayout const& ops); 00013 00014 void zero(Value v); 00015 void zero(Value v, MemoryLayout const& ops); 00016 void zero(uint8_t* data, MemoryLayout const& ops); 00017 00018 void destroy(Value v); 00019 void destroy(Value v, MemoryLayout const& ops); 00020 void destroy(uint8_t* data, MemoryLayout const& ops); 00021 00022 void copy(Value dst, Value src); 00023 void copy(void* dst, void* src, Type const& type); 00024 00025 bool compare(Value dst, Value src); 00026 bool compare(void* dst, void* src, Type const& type); 00027 00028 void display(std::ostream& io, 00029 MemoryLayout::const_iterator const begin, MemoryLayout::const_iterator const end); 00030 00031 std::vector<uint8_t> dump(Value v); 00032 00033 void dump(Value v, std::vector<uint8_t>& buffer); 00034 void dump(Value v, std::vector<uint8_t>& buffer, MemoryLayout const& ops); 00035 void dump(uint8_t const* v, std::vector<uint8_t>& buffer, MemoryLayout const& ops); 00036 00037 void dump(Value v, std::ostream& stream); 00038 void dump(Value v, std::ostream& stream, MemoryLayout const& ops); 00039 void dump(uint8_t const* v, std::ostream& stream, MemoryLayout const& ops); 00040 00041 void dump(Value v, int fd); 00042 void dump(Value v, int fd, MemoryLayout const& ops); 00043 void dump(uint8_t const* v, int fd, MemoryLayout const& ops); 00044 00045 void dump(Value v, FILE* fd); 00046 void dump(Value v, FILE* fd, MemoryLayout const& ops); 00047 void dump(uint8_t const* v, FILE* fd, MemoryLayout const& ops); 00048 00049 int dump(Value v, uint8_t* buffer, unsigned int buffer_size); 00050 int dump(Value v, uint8_t* buffer, unsigned int buffer_size, MemoryLayout const& ops); 00051 int dump(uint8_t const* v, uint8_t* buffer, unsigned int buffer_size, MemoryLayout const& ops); 00052 00053 size_t getDumpSize(Value v); 00054 size_t getDumpSize(Value v, MemoryLayout const& ops); 00055 size_t getDumpSize(uint8_t const* v, MemoryLayout const& ops); 00056 00057 void load(Value v, std::vector<uint8_t> const& buffer); 00058 void load(Value v, std::vector<uint8_t> const& buffer, MemoryLayout const& ops); 00059 void load(uint8_t* v, Type const& type, std::vector<uint8_t> const& buffer, MemoryLayout const& ops); 00060 00061 void load(Value v, uint8_t const* buffer, unsigned int buffer_size); 00062 void load(Value v, uint8_t const* buffer, unsigned int buffer_size, MemoryLayout const& ops); 00063 void load(uint8_t* v, Type const& type, uint8_t const* buffer, unsigned int buffer_size, MemoryLayout const& ops); 00064 } 00065 00066 #endif 00067