source: tags/arb_5.3/ARBDBPP/adextended.cxx

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