Commit c9927aaa authored by Ivan Donchevskiy's avatar Ivan Donchevskiy

\include Comments for Storages.h

parent 80a9435e
...@@ -36,28 +36,33 @@ ...@@ -36,28 +36,33 @@
#define key_size 20 #define key_size 20
/*! TableBlockStorage */
struct StorageAttr struct StorageAttr
{ {
int k_size, inf_size,size,block_number; int k_size, inf_size,size,block_number;
int lim, seekpos; int lim, seekpos;
} __attribute__((__packed__)); } __attribute__((__packed__));
/*! CycleStorage */
struct CycleStorageAttr struct CycleStorageAttr
{ {
int size, inf_size, seekpos; int size, inf_size, seekpos;
} __attribute__((__packed__)); } __attribute__((__packed__));
/*! TableStorage */
struct TableStorageElem struct TableStorageElem
{ {
char status; char status;
char key[key_size]; char key[key_size];
} __attribute__((__packed__)); } __attribute__((__packed__));
/*! TableBlockStorage */
struct TableBlockStorageElem struct TableBlockStorageElem
{ {
int count; int count;
} __attribute__((__packed__)); } __attribute__((__packed__));
/*! CycleStorage */
struct CycleStorageElem struct CycleStorageElem
{ {
char status; char status;
...@@ -79,14 +84,32 @@ class TableStorage ...@@ -79,14 +84,32 @@ class TableStorage
class TableBlockStorage class TableBlockStorage
{ {
public: public:
/*! */
TableBlockStorage(); TableBlockStorage();
/*! Open, create=true
*/
TableBlockStorage(const char* name, int key_sz, int inf_sz, int sz, int block_num, int block_lim, int seek, bool create=false); TableBlockStorage(const char* name, int key_sz, int inf_sz, int sz, int block_num, int block_lim, int seek, bool create=false);
~TableBlockStorage(); ~TableBlockStorage();
/*! inf_sz - , key_sz - , sz -
block_num - - ( = sz/block_num
, ), block_lim - ,
seek - ( , ) */
bool Open(const char* name, int inf_sz, int key_sz, int sz, int block_num, int block_lim, int seek); bool Open(const char* name, int inf_sz, int key_sz, int sz, int block_num, int block_lim, int seek);
bool Create(const char* name, int inf_sz, int key_sz, int sz, int block_num, int block_lim, int seek); bool Create(const char* name, int inf_sz, int key_sz, int sz, int block_num, int block_lim, int seek);
/*! , */
bool AddRow(void* key, void* val); bool AddRow(void* key, void* val);
/*! , , */
bool DelRow(void* key); bool DelRow(void* key);
/*! , 0 */
void* FindKeyValue(void* key, void* val); void* FindKeyValue(void* key, void* val);
/*! ( ) */
int GetCurBlock(void); int GetCurBlock(void);
protected: protected:
FILE *file; FILE *file;
...@@ -106,16 +129,36 @@ class TableBlockStorage ...@@ -106,16 +129,36 @@ class TableBlockStorage
class CycleStorage class CycleStorage
{ {
public: public:
/*! */
CycleStorage(); CycleStorage();
/*! Open, create=true
*/
CycleStorage(const char* name, int inf_sz, int sz, int seek,bool create=false); CycleStorage(const char* name, int inf_sz, int sz, int seek,bool create=false);
~CycleStorage(); ~CycleStorage();
/*! inf_sz - , sz - ,
seek - ( , ) */
bool Open(const char* name, int inf_sz, int sz, int seek); bool Open(const char* name, int inf_sz, int sz, int seek);
bool Create(const char* name, int inf_sz, int sz, int seek); bool Create(const char* name, int inf_sz, int sz, int seek);
/*! */
bool AddRow(void* str); bool AddRow(void* str);
/*! row */
bool DelRow(int row); bool DelRow(int row);
/*! *?
bool DelAllRows(void); bool DelAllRows(void);
/*! num */
void* ViewRow(int num, void* str); void* ViewRow(int num, void* str);
/*! Xml- name */
bool ExportToXML(const char* name); bool ExportToXML(const char* name);
/*! - / ( ) */
int GetIter(void); int GetIter(void);
protected: protected:
FILE *file; FILE *file;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment