UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DbFileStorage.H
1 /* DbFileStorage.H */
2 /* $Id: DbFileStorage.H,v 1.4 2004/02/24 12:10:08 vlad Exp $ */
3 #ifndef __DbFileStorage_H
4 #define __DbFileStorage_H
5 
6 
7 /***********************************************************************
8  *
9  * Локальная База Данных (версия 4)
10  * Хранение таблицы ЛБД в на диске и операции с ней
11  *
12  ***********************************************************************/
13 
14 #include <sys/types.h>
15 
16 #include <mix/wenv.h>
17 #include <mix/trans.h>
18 
19 #include <ldb/DbTableTypes.H>
20 
21 
28 class DbFile
29 {
30 public:
31 
33  DbFile (int fd, size_t nFHdrSize, size_t nLineSize);
34 
37  DbFile (int fd, const DbFile& filstor);
38 
40  DbIndex lines_count () const;
41 
43  size_t file_size () const;
44 
46  void load_lines (DbIndex line1, DbIndex line2, void* pBuf) const;
47 
52  DbIndex save_lines (DbIndex& line1, DbIndex& line2, const void* pBuf);
53 
55  void add_lines (DbIndex lines);
56 
58  void del_lines (DbIndex lines);
59 
62  void set_file_sizes (size_t nFHdrSize, size_t nLineSize);
63 
64 private:
65 
67  int fildes;
68 
70  size_t fhdr_size, line_size;
71 
73  DbIndex total_lines;
74 
75 };
76 
77 
84 // @{
85 
88 void DbFileReadHdr (int fd, DbFileHeader* pHdr, ByteOrder& eBO);
89 
93 void DbFileReadDmnAttrs (int fd, ByteOrder eBO, unsigned nDmns,
94  DbFileDomainAttr* pDmnAttrs);
95 
99 DbIndex DbFileReadLines (int fd, ByteOrder bo, DbIndex line_cnt,
100  DbTTDesc& tt, void* mem);
101 
102 
105 void DbFileWriteHdr (int fd, const DbFileHeader* pHdr, ByteOrder eBO);
106 
110 void DbFileWriteDmnAttrs (int fd, ByteOrder eBO, unsigned nDmns,
111  const DbFileDomainAttr* pDmnAttrs);
112 
116 DbIndex DbFileWriteLines (int fd, ByteOrder bo, DbIndex line_cnt,
117  DbTTDesc& tt, void* mem);
118 
119 
122 void DbTableTransLines (ByteOrder eSrcBO, ByteOrder eDstBO,
123  int nLines, DbTTDesc& rTTD, void* pBuf);
124 
125 // @}
126 
127 
128 #endif /* DbFileStorage.H */
void load_lines(DbIndex line1, DbIndex line2, void *pBuf) const
void add_lines(DbIndex lines)
void del_lines(DbIndex lines)
DbIndex save_lines(DbIndex &line1, DbIndex &line2, const void *pBuf)
DbIndex lines_count() const
size_t file_size() const
Definition: DbFileStorage.H:28
Definition: dbdefs.h:158
Definition: dbdefs.h:134
Definition: DbTableTypes.H:61
void set_file_sizes(size_t nFHdrSize, size_t nLineSize)
DbFile(int fd, size_t nFHdrSize, size_t nLineSize)