00001 #ifndef DG_RECORD_H
00002 #define DG_RECORD_H
00003
00004 #ifndef CTL_SERIAL_H
00005 #include "ctl/serial.h"
00006 #endif
00007
00008
00009
00010
00011
00012
00013 size_t ctl_record_head_size( const char* label, const char* type );
00014 size_t ctl_record_objarray_head_size( const char* label, const char* type, const char* mbrtype );
00015 bool ctl_record_valid( const ctl_serial* serial );
00016 bool ctl_record_next( ctl_serial* serial );
00017 bool ctl_record_find( ctl_serial* serial, const char* label );
00018 bool ctl_record_find_next( ctl_serial* serial, const char* label );
00019 size_t ctl_record_getdata( ctl_serial* serial );
00020 const uint8* ctl_record_end( const ctl_serial* serial );
00021 const char* ctl_record_label( const ctl_serial* serial );
00022 const char* ctl_record_type( const ctl_serial* serial );
00023 const char* ctl_record_contained_type( const ctl_serial* serial );
00024 bool ctl_record_is( const char* label, const ctl_serial* serial );
00025 bool ctl_record_type_is( const char* label, const ctl_serial* serial );
00026 bool ctl_record_contained_type_is( const char* label, const ctl_serial* serial );
00027 size_t ctl_record_count( const ctl_serial* serial );
00028 size_t ctl_record_container_validatedata( ctl_serial* serial, const char* type, const char* mbrtype );
00029 uint8* ctl_record_write_begin( const char* type, size_t size, ctl_serial* serial, const char* label );
00030 uint8* ctl_record_write_container_begin( const char* containertype, const char* contenttype, size_t size, size_t count, ctl_serial* serial, const char* label );
00031 void ctl_record_write_end( uint8* begret, ctl_serial* serial );
00032
00033
00034 size_t ctl_serial_record_size( const ctl_serial* serial, const char* label );
00035 void ctl_serial_record_write( const ctl_serial* serial, ctl_serial* to, const char* label );
00036 bool ctl_serial_record_read( ctl_serial* serial, ctl_serial* from, const char* label );
00037
00038
00039 #define bool_record_size( p,l ) (ctl_record_head_size("bool",(l))+1)
00040 #define int8_record_size( p,l ) (ctl_record_head_size("int8",(l))+1)
00041 #define uint8_record_size( p,l ) (ctl_record_head_size("uint8",(l))+1)
00042 #define int16_record_size( p,l ) (ctl_record_head_size("int16",(l))+2)
00043 #define uint16_record_size( p,l ) (ctl_record_head_size("uint16",(l))+2)
00044 #define int32_record_size( p,l ) (ctl_record_head_size("int32",(l))+4)
00045 #define uint32_record_size( p,l ) (ctl_record_head_size("uint32",(l))+4)
00046 #define int64_record_size( p,l ) (ctl_record_head_size("int64",(l))+8)
00047 #define uint64_record_size( p,l ) (ctl_record_head_size("uint64",(l))+8)
00048 #define float32_record_size( p,l ) (ctl_record_head_size("float32",(l))+4)
00049 #define float64_record_size( p,l ) (ctl_record_head_size("float64",(l))+8)
00050
00051
00052 #define X_RECORD_WRITE(type,unused) void ppConcat(type,_record_write)( const type* pdata, ctl_serial* serial, const char* label );
00053 DEF_ENUMTYPES(X_RECORD_WRITE,unused)
00054 #undef X_RECORD_WRITE
00055 #define X_RECORD_ARRAY_WRITE(type,unused) void ppConcat(type,_record_writearray)( const type* pdata, size_t count, ctl_serial* serial, const char* label );
00056 DEF_ENUMTYPES(X_RECORD_ARRAY_WRITE,unused)
00057 #undef X_RECORD_ARRAY_WRITE
00058
00059
00060 #define X_RECORD_READ(type,unused) bool ppConcat(type,_record_read)( type* pdata, const ctl_serial* serial, const char* label );
00061 DEF_ENUMTYPES(X_RECORD_READ,unused)
00062 #undef X_RECORD_READ
00063 #define X_RECORD_ARRAY_READ(type,unused) bool ppConcat(type,_record_readarray)( type* pdata, size_t count, const ctl_serial* serial, const char* label );
00064 DEF_ENUMTYPES(X_RECORD_ARRAY_READ,unused)
00065 #undef X_RECORD_ARRAY_READ
00066
00070 size_t char_record_size_string( const char* str, size_t maxsize, const char* label );
00071 size_t wchar_t_record_size_string( const wchar_t* str, size_t maxsize, const char* label );
00072 size_t char_record_size_gstring( const ctl_gstring(char)* str, const char* label );
00073 size_t wchar_t_record_size_gstring( const ctl_gstring(wchar_t)* str, const char* label );
00074
00075
00076 uint8* ctl_record_write_begin( const char* type, size_t size, ctl_serial* serial, const char* label );
00077 uint8* ctl_record_write_container_begin( const char* containertype, const char* contenttype, size_t size, size_t count, ctl_serial* serial, const char* label );
00078 void ctl_record_write_end( uint8* begret, ctl_serial* serial );
00079
00080
00081 void char_record_write_string( const char* sz, size_t size, ctl_serial* serial, const char* label );
00082 void wchar_t_record_write_string( const wchar_t* sz, size_t size, ctl_serial* serial, const char* label );
00083
00084
00085 bool char_record_read_string( char* sz, size_t size, const ctl_serial* serial, const char* label );
00086 bool wchar_t_record_read_string( wchar_t* sz, size_t size, const ctl_serial* serial, const char* label );
00087 bool char_record_read_gstring( ctl_gstring(char)* str, const ctl_serial* serial, const char* label );
00088 bool wchar_t_record_read_gstring( ctl_gstring(wchar_t)* str, const ctl_serial* serial, const char* label );
00089
00090 #endif