1 /***********************************************************************
5 ** This file is part of libkfrgcs.
7 ************************************************************************
9 ** Copyright (c): 2002 by Garrecht Ingenieurgesellschaft
11 ** This file is distributed under the terms of the General Public
12 ** Licence. See the file COPYING for more information.
16 ***********************************************************************/
21 #include "Database.hpp"
28 static constexpr size_t DBBBeg
= 0x0000;
29 static constexpr size_t DBB_SIZE
= 0x3000;
30 static constexpr size_t DBBEnd
= DBBBeg
+ DBB_SIZE
;
31 static constexpr size_t FrmBeg
= 0x3000;
32 static constexpr size_t FRM_SIZE
= 0x1000;
33 static constexpr size_t FrmEnd
= FrmBeg
+ FRM_SIZE
;
34 static constexpr size_t SIZE
= DBB_SIZE
+ FRM_SIZE
;
40 unsigned dslaenge
, keylaenge
;
41 unsigned dsfirst
, dslast
;
48 * Konstruktor: leeren Datenbank-Block erzeugen.
52 void *GetBlock(size_t offset
=0) {
53 return buffer
+ DBBBeg
+ offset
;
56 const void *GetBlock(size_t offset
=0) const {
57 return buffer
+ DBBBeg
+ offset
;
60 void *GetFDF(size_t offset
=0) {
61 return buffer
+ FrmBeg
+ offset
;
64 const void *GetFDF(size_t offset
=0) const {
65 return buffer
+ FrmBeg
+ offset
;
69 Volkslogger::TableHeader
*GetHeader(unsigned i
) {
70 Volkslogger::TableHeader
*h
= (Volkslogger::TableHeader
*)GetBlock();
74 const Volkslogger::TableHeader
*GetHeader(unsigned i
) const {
75 const Volkslogger::TableHeader
*h
=
76 (const Volkslogger::TableHeader
*)GetBlock();
82 * Generate Header-Structure from DBB-File.
87 * Update header of specified table (kennung) of the database and
88 * close the table (it can't be extended anymore).
90 void close_db(int kennung
);
92 void add_ds(int kennung
, const void *quelle
);
97 * @return a writeable pointer of the specified size or nullptr if
100 void *AddFDF(uint8_t id
, size_t size
);
102 void add_fdf(int feldkennung
, size_t feldlaenge
, const void *quelle
);
105 * Add a FDF entry with the specified string value (convert to upper
108 void AddFDFStringUpper(uint8_t id
, const char *value
);
111 * Find an actual record of specified type(id) in the declaration
112 * memory and return it's position in the memory array.
114 int fdf_findfield(uint8_t id
) const;