📄 elemdbm.h
字号:
#ifndef ELEMDBM_H
#define ELEMDBM_H
#include <iostream.h>
#include "element.h"
class mgcElementDBM
{
public:
typedef void (*EFinput)(istream&,void*);
typedef void (*EFoutput)(ostream&,const void*);
typedef void (*EFreverse)(int,void*);
typedef void (*EFcompact)(int,void*);
typedef void (*EFconvert)(int,void*,void*);
typedef struct _unresolvedconvert {
const int* srctype;
const int* trgtype;
EFconvert convert_to;
struct _unresolvedconvert* next;
} UnresolvedConvert;
typedef struct {
const int* addrtype; // address of variable defining the type
const char* description; // struct-type field description
int memory_size; // size for memory representation
int packed_size; // size for packed representation
EFinput input; // read element from input stream
EFoutput output; // write element to output stream
EFreverse reverse; // reorder bytes for current machine
EFcompact pack; // pack struct-type for file storage
EFcompact unpack; // unpack struct-type for memory storage
EFconvert* convert_to; // conversions to other types
} ElementRecord;
static int CreateDataBase ();
static void DestroyDataBase ();
static int AddType (const ElementRecord& er);
static int AddConvert (const int& srctype, const int& trgtype, EFconvert f);
static int Type (const char* description);
static int Valid (int type);
static const char* Description (int type);
static int MemorySize (int type);
static int PackedSize (int type);
// byte-ordering and reversal methods
static int ByteOrder ();
static void Reverse2 (int quantity, void* src);
static void Reverse4 (int quantity, void* src);
static void Reverse8 (int quantity, void* src);
static int Reversible (int type);
static int Reverse (int quantity, int type, void* src);
// packing and unpacking methods for struct types
static int Packable (int type);
static int Pack (int quantity, int type, void* src);
static int Unpackable (int type);
static int Unpack (int quantity, int type, void* src);
// conversions
static int Convertible (int srctype, int trgtype);
static int Convert (
int quantity, int srctype, void* src, int trgtype, void* trg
);
static ElementRecord* record;
private:
static int maxregistered;
static int registered;
static UnresolvedConvert* cnvlist;
// error handling
public:
static int verbose;
static unsigned error;
static void Report (ostream& ostr);
private:
static const unsigned allocation_failed;
static const unsigned unknown_ordering;
static const unsigned exceeded_maximum;
static const char* message[3];
static int Number (unsigned single_error);
static void Report (unsigned single_error);
};
// automatic creation of data base
static int mgcElementDBM_create = mgcElementDBM::CreateDataBase();
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -