1 | #include <stdio.h> |
---|
2 | #include <memory.h> |
---|
3 | #include <string.h> |
---|
4 | #include <arbdb.h> |
---|
5 | #include <arbdbt.h> |
---|
6 | #include <iostream.h> |
---|
7 | #include "arbdb++.hxx" |
---|
8 | |
---|
9 | /*********************** |
---|
10 | *************************************************************** |
---|
11 | class AD_SAI |
---|
12 | |
---|
13 | ******************************************* |
---|
14 | *******************************************************/ |
---|
15 | |
---|
16 | AD_SAI::AD_SAI() |
---|
17 | { |
---|
18 | |
---|
19 | gb_main = 0; |
---|
20 | } |
---|
21 | |
---|
22 | AD_SAI::~AD_SAI() |
---|
23 | // callbacks nur innerhalb von transaktionen releasen ->exit |
---|
24 | // gibt speicherplatz frei |
---|
25 | { |
---|
26 | if (ad_main) |
---|
27 | new AD_ERR("AD_SAI: No exit() !!",CORE); |
---|
28 | } |
---|
29 | |
---|
30 | AD_ERR * AD_SAI::exit() |
---|
31 | { |
---|
32 | if (ad_main) release(); |
---|
33 | delete container; |
---|
34 | ad_main = 0; |
---|
35 | return 0; |
---|
36 | } |
---|
37 | |
---|
38 | |
---|
39 | AD_ERR * AD_SAI::init(AD_MAIN * gb_ptr) |
---|
40 | // stellt verknuepfung mit ubergeordneter Klasse her |
---|
41 | { |
---|
42 | if (ad_main != 0) { |
---|
43 | return new AD_ERR("AD_SAI: no reinit\n"); |
---|
44 | } |
---|
45 | if (gb_ptr->gbd) { |
---|
46 | ad_main = gb_ptr; |
---|
47 | gb_main = gb_ptr->gbd; |
---|
48 | last = count = 0; |
---|
49 | AD_READWRITE::gbdataptr = 0; |
---|
50 | return 0; |
---|
51 | } |
---|
52 | else { |
---|
53 | return new AD_ERR("SAI init (NULL)\n"); |
---|
54 | } |
---|
55 | } |
---|
56 | |
---|
57 | AD_ERR *AD_SAI::first() |
---|
58 | { |
---|
59 | if (ad_main) { |
---|
60 | AD_SAI::release(); // speicherplatz freigeben |
---|
61 | gb_species = GBT_first_SAI(gb_main); |
---|
62 | //erstes extended |
---|
63 | AD_SAI::initpntr(); |
---|
64 | return 0; |
---|
65 | } |
---|
66 | return new AD_ERR("AD_extended first: NO AD_MAIN\n"); |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | |
---|
71 | AD_ERR * AD_SAI::find(char *path) |
---|
72 | // sucht nach extended mit namen = path |
---|
73 | { |
---|
74 | error(); |
---|
75 | AD_SPECIES::release(); // speicherplatz freigeben` |
---|
76 | gb_species = GBT_find_SAI_rel_exdata(ad_main->extended_data,path); |
---|
77 | AD_SPECIES::initpntr(); |
---|
78 | return 0; |
---|
79 | } |
---|
80 | |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | AD_ERR * AD_SAI::create(char *name) { |
---|
85 | GBDATA *extended; |
---|
86 | if (strlen(name) < 2) |
---|
87 | return new AD_ERR("AD_SAI::create ungueltige Parameter"); |
---|
88 | extended = GBT_create_SAI(gb_main,name); |
---|
89 | gb_species = extended; |
---|
90 | initpntr(); |
---|
91 | return 0; |
---|
92 | } |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | char * AD_SAI::fullname() |
---|
97 | { |
---|
98 | return 0; |
---|
99 | } |
---|
100 | |
---|
101 | AD_ERR * AD_SAI::next() |
---|
102 | // initialisiert objekt auf naechstes extended oder erstes |
---|
103 | { |
---|
104 | error(); |
---|
105 | |
---|
106 | if (!gb_species && last == 0) |
---|
107 | first(); |
---|
108 | AD_SAI::release(); // speicherplatz freigeben |
---|
109 | gb_species = GBT_next_SAI(gb_species); |
---|
110 | AD_SAI::initpntr(); |
---|
111 | return 0; |
---|
112 | } |
---|
113 | |
---|
114 | /******** not yet in GBT |
---|
115 | AD_ERR *AD_SAI::firstmarked() |
---|
116 | { |
---|
117 | if (ad_main ) |
---|
118 | { |
---|
119 | gb_extended = GBT_first_marked_extended(gb_exdata); |
---|
120 | initpntr(); |
---|
121 | return 0; |
---|
122 | } |
---|
123 | return new AD_ERR("AD_SAI::firstmarked() but no init()!",CORE); |
---|
124 | } |
---|
125 | |
---|
126 | AD_ERR * AD_SAI::nextmarked() |
---|
127 | // naechstes markiertes extended oder erstes markiertes |
---|
128 | { |
---|
129 | if ((!gb_extended && (last ==0))) |
---|
130 | { |
---|
131 | gb_extended = GBT_first_marked_extended(gb_exdata); |
---|
132 | initpntr(); |
---|
133 | return 0; |
---|
134 | } |
---|
135 | else { |
---|
136 | release(); |
---|
137 | gb_extended = GBT_next_marked_extended(gb_extended); |
---|
138 | initpntr(); |
---|
139 | return 0; |
---|
140 | } |
---|
141 | } |
---|
142 | ************/ |
---|
143 | |
---|
144 | |
---|
145 | void AD_SAI::operator =(const AD_SAI& right) |
---|
146 | { |
---|
147 | gb_main = right.gb_main; |
---|
148 | (AD_SPECIES &) *this = (AD_SPECIES&) right; |
---|
149 | } |
---|
150 | |
---|
151 | |
---|
152 | |
---|
153 | |
---|