00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00031 #ifndef __VDBL_HRVIEW_H
00032 #define __VDBL_HRVIEW_H
00033
00034 #include <iostream>
00035 #include <vdbl_table.h>
00036 #include <vdbl_view.h>
00037
00038 __VDBL_BEGIN_NAMESPACE
00039
00040 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
00041 #pragma set woff 1209
00042 #endif
00043
00045
00049 class _VDBL_hierarchicalview : public _VDBL_view
00050 {
00051 private:
00052 typedef _VDBL_view _Base;
00053
00055 typedef _VDBL_colid _V_colref;
00057 typedef std::pair<_VDBL_tableid,_VDBL_rowid> _V_rowref;
00059 typedef std::map<_V_rowref, _VDBL_col> _V_colentry;
00061 typedef std::map<_V_colref, _V_colentry> _V_colcache;
00063 typedef std::vector<_V_rowref> _V_rows;
00065 typedef std::vector<_V_colref> _V_cols;
00067 typedef std::map<std::pair<_VDBL_tableid,_VDBL_colid>,_VDBL_colid> _V_colxref;
00069 typedef std::map<_VDBL_tableid,std::pair<_VDBL_table *,unsigned int> > _V_tref;
00070
00071 private:
00073 std::vector<_VDBL_tableid> _V_th;
00075 _V_tref _V_t;
00077 const _VDBL_context* _V_ctx;
00078
00080 _V_colcache _V_cc;
00081
00082 protected:
00086 _V_rows _V_r;
00090 _V_cols _V_c;
00094 _V_colxref _V_cx;
00095
00096 private:
00098 std::map<std::string,_V_colref> _V_colnames;
00099
00100 friend class _VDBL_table;
00101
00102 public:
00103 typedef _Base::default_const_iterator defaults_const_iterator;
00104
00105 private:
00107 _VDBL_tableid get_master_table_id() const
00108 {
00109 std::vector<_VDBL_tableid>::const_iterator _e = _V_th.end();
00110 return *(--_e);
00111 }
00112
00114 _VDBL_table* get_table(const _VDBL_tableid& _ti) const
00115 {
00116 _V_tref::const_iterator _tr(_V_t.find(_ti));
00117 if(_tr == _V_t.end())
00118 return NULL;
00119 return (*_tr).second.first;
00120 }
00121
00123 _VDBL_table* get_master_table() const
00124 {
00125 std::vector<_VDBL_tableid>::const_iterator _e = _V_th.end();
00126 _V_tref::const_iterator _tr(_V_t.find(*(--_e)));
00127 if(_tr == _V_t.end())
00128 {
00129 std::cerr << "Error: hierarchical view is corrupted!" << std::endl;
00130 throw "Programming Error";
00131 }
00132 return (*_tr).second.first;
00133 }
00134
00141 std::pair<_VDBL_tableid,_VDBL_colid> _find_def(const _VDBL_colid& _c) const
00142 {
00143 std::vector<_VDBL_tableid>::const_iterator _x, _e(_V_th.end());
00144 for(_x = _V_th.begin(); _x != _e; ++_x)
00145 {
00146 _V_colxref::const_iterator _cy(_V_cx.find(std::make_pair(*_x,_c)));
00147 if(_cy != _V_cx.end())
00148 {
00149 _VDBL_table* _tp = get_table(*_x);
00150 if(_tp && _tp->has_def((*_cy).second))
00151 return std::make_pair(*_x,(*_cy).second);
00152 }
00153 }
00154 return std::make_pair(0,0);
00155 }
00156
00162 std::pair<_VDBL_tableid,_VDBL_colid> _find_col(const _VDBL_rowid& _r,
00163 const _VDBL_colid& _c) const
00164 {
00165 std::vector<_VDBL_tableid>::const_iterator _x, _e(_V_th.end());
00166 for(_x = _V_th.begin(); _x != _e; ++_x)
00167 {
00168 _V_colxref::const_iterator _cy(_V_cx.find(std::make_pair(*_x,_c)));
00169 if(_cy != _V_cx.end())
00170 {
00171 _VDBL_table* _tp = get_table(*_x);
00172 if(_tp && _tp->has_col(_r,(*_cy).second))
00173 return std::make_pair(*_x,(*_cy).second);
00174 }
00175 }
00176 return _find_def(_c);
00177 }
00178
00179 protected:
00180 std::triple<_VDBL_tableid,_VDBL_colid,void*>
00181 _next_def_col(const _VDBL_tableid& _t, const _VDBL_colid& _c,
00182 void *_d) const
00183 {
00184 _V_cols::const_iterator& _cit(*(_V_cols::const_iterator*)_d);
00185 std::pair<_VDBL_tableid,_VDBL_colid> _tc(0,0);
00186 if(_t == 0 && _c == 0)
00187 return std::make_triple(0,0,_d);
00188 ++_cit;
00189 while(_cit != _V_c.end())
00190 {
00191 _tc = _find_def(*_cit);
00192 if(_tc.first != 0)
00193 break;
00194 ++_cit;
00195 }
00196 if(_cit == _V_c.end())
00197 return std::make_triple(0,0,_d);
00198 else
00199 return std::make_triple(_tc.first,_tc.second,_d);
00200 }
00201
00202 std::triple<_VDBL_tableid,_VDBL_colid,void*>
00203 _prev_def_col(const _VDBL_tableid& _t, const _VDBL_colid& _c,
00204 void *_d) const
00205 {
00206 _V_cols::const_iterator& _cit(*(_V_cols::const_iterator*)_d);
00207 std::pair<_VDBL_tableid,_VDBL_colid> _tc(0,0);
00208 if(_t == 0 && _c == 0)
00209 _cit = _V_c.end();
00210 --_cit;
00211 while(_cit != _V_c.begin())
00212 {
00213 _tc = _find_def(*_cit);
00214 if(_tc.first != 0)
00215 break;
00216 --_cit;
00217 }
00218 if(_cit == _V_c.begin())
00219 {
00220 _tc = _find_def(*_cit);
00221 if(_tc.first == 0)
00222 return std::make_triple(0,0,_d);
00223 }
00224 if(_cit == _V_c.end())
00225 return std::make_triple(0,0,_d);
00226 else
00227 return std::make_triple(_tc.first,_tc.second,_d);
00228 }
00229
00230 void _destroy_def_data(void *&_d) const
00231 { delete (_V_cols::const_iterator*)_d; }
00232
00233 void* _copy_def_data(void *_d) const
00234 { return (void*)
00235 new _V_cols::const_iterator(*(_V_cols::const_iterator*)_d); }
00236
00237 std::triple<_VDBL_tableid,_VDBL_colid,void*>
00238 _next_col(const _VDBL_tableid& _t, const _VDBL_rowid& _r,
00239 const _VDBL_colid& _c, void *_d) const
00240 {
00241 _V_cols::const_iterator& _cit(*(_V_cols::const_iterator*)_d);
00242 std::pair<_VDBL_tableid,_VDBL_colid> _tc(0,0);
00243 if(_t == 0 && _c == 0)
00244 return std::make_triple(0,0,_d);
00245 ++_cit;
00246 while(_cit != _V_c.end())
00247 {
00248 _tc = _find_col(_r,*_cit);
00249 if(_tc.first != 0)
00250 break;
00251 ++_cit;
00252 }
00253 if(_cit == _V_c.end())
00254 return std::make_triple(0,0,_d);
00255 else
00256 return std::make_triple(_tc.first,_tc.second,_d);
00257 }
00258
00259 std::triple<_VDBL_tableid,_VDBL_colid,void*>
00260 _prev_col(const _VDBL_tableid& _t, const _VDBL_rowid& _r,
00261 const _VDBL_colid& _c, void *_d) const
00262 {
00263 _V_cols::const_iterator& _cit(*(_V_cols::const_iterator*)_d);
00264 std::pair<_VDBL_tableid,_VDBL_colid> _tc(0,0);
00265 if(_t == 0 && _c == 0)
00266 _cit = _V_c.end();
00267 --_cit;
00268 while(_cit != _V_c.begin())
00269 {
00270 _tc = _find_col(_r,*_cit);
00271 if(_tc.first != 0)
00272 break;
00273 --_cit;
00274 }
00275 if(_cit == _V_c.begin())
00276 {
00277 _tc = _find_def(*_cit);
00278 if(_tc.first == 0)
00279 return std::make_triple(0,0,_d);
00280 }
00281 if(_cit == _V_c.end())
00282 return std::make_triple(0,0,_d);
00283 else
00284 return std::make_triple(_tc.first,_tc.second,_d);
00285 }
00286
00287 void _destroy_col_data(void *&_d) const
00288 { delete (_V_cols::const_iterator*)_d; }
00289
00290 void* _copy_col_data(void *_d) const
00291 { return (void*)
00292 new _V_cols::const_iterator(*(_V_cols::const_iterator*)_d); }
00293
00294 std::triple<_VDBL_tableid,_VDBL_rowid,void*>
00295 _next_row(const _VDBL_tableid& _t, const _VDBL_rowid& _r,
00296 void *_d) const
00297 {
00298 _V_rows::const_iterator& _rit(*(_V_rows::const_iterator*)_d);
00299 if(_t == 0 && _r == 0)
00300 return std::make_triple(0,0,_d);
00301 ++_rit;
00302 if(_rit == _V_r.end())
00303 return std::make_triple(0,0,_d);
00304 else
00305 return std::make_triple((*_rit).first,(*_rit).second,_d);
00306 }
00307
00308 std::triple<_VDBL_tableid,_VDBL_rowid,void*>
00309 _prev_row(const _VDBL_tableid& _t, const _VDBL_rowid& _r,
00310 void *_d) const
00311 {
00312 _V_rows::const_iterator& _rit(*(_V_rows::const_iterator*)_d);
00313 if(_t == 0 && _r == 0)
00314 _rit = _V_r.end();
00315 if(_rit == _V_r.begin())
00316 return std::make_triple(0,0,_d);
00317 --_rit;
00318 if(_rit == _V_r.end())
00319 return std::make_triple(0,0,_d);
00320 else
00321 return std::make_triple((*_rit).first,(*_rit).second,_d);
00322 }
00323
00324 void _destroy_row_data(void *&_d) const
00325 { delete (_V_rows::const_iterator*)_d; }
00326
00327 void* _copy_row_data(void *_d) const
00328 { return (void*)
00329 new _V_rows::const_iterator(*(_V_rows::const_iterator*)_d); }
00330
00331 private:
00332 bool _row_visible(const std::pair<_VDBL_tableid,_VDBL_rowid>& _r) const
00333 {
00334 return std::binary_search(_V_r.begin(), _V_r.end(), _r);
00335 }
00336
00337 public:
00342 _VDBL_hierarchicalview(const _VDBL_tableid& __ti, _VDBL_table* __t,
00343 const _VDBL_context& __c, _V_enum __en)
00344 : _Base(__en), _V_th(1,__ti), _V_t(), _V_ctx(&__c),
00345 _V_cc(), _V_r(), _V_c(), _V_cx(), _V_colnames()
00346 {
00347 _V_t.insert(std::make_pair(__ti,
00348 std::make_pair(__t,__t->get_change_ctr())));
00349 _VDBL_table::col_const_iterator __x, __e(__t->col_end());
00350 for(__x = __t->col_begin(); __x != __e; ++__x)
00351 {
00352 _V_colnames.insert(*__x);
00353 _V_c.push_back((*__x).second);
00354 _V_cx.insert(std::make_pair(std::make_pair(__ti,(*__x).second),
00355 (*__x).second));
00356 }
00357 _VDBL_table::row_const_iterator __y, __f(__t->row_end());
00358 for(__y = __t->row_begin(); __y != __f; ++__y)
00359 _V_r.push_back(std::make_pair(__ti,*__y));
00360 std::sort(_V_r.begin(), _V_r.end());
00361 }
00362
00369 _VDBL_hierarchicalview(const _VDBL_tableid& __ti, _VDBL_table* __t,
00370 const _VDBL_context& __c, _V_enum __en,
00371 const std::vector<_VDBL_rowid>& _rs)
00372 : _Base(__en), _V_th(1,__ti), _V_t(), _V_ctx(&__c),
00373 _V_cc(), _V_r(), _V_c(), _V_cx(), _V_colnames()
00374 {
00375 _V_t.insert(std::make_pair(__ti,
00376 std::make_pair(__t,__t->get_change_ctr())));
00377 _VDBL_table::col_const_iterator __x, __e(__t->col_end());
00378 for(__x = __t->col_begin(); __x != __e; ++__x)
00379 {
00380 _V_colnames.insert(*__x);
00381 _V_c.push_back((*__x).second);
00382 _V_cx.insert(std::make_pair(std::make_pair(__ti,(*__x).second),
00383 (*__x).second));
00384 }
00385 std::vector<_VDBL_rowid>::const_iterator __y, __f(_rs.end());
00386 _V_r.reserve(_rs.size());
00387 for(__y = _rs.begin(); __y != __f; ++__y)
00388 _V_r.push_back(std::make_pair(__ti,*__y));
00389 std::sort(_V_r.begin(), _V_r.end());
00390 }
00391
00395 _VDBL_hierarchicalview(const _VDBL_hierarchicalview& __v)
00396 : _Base(__v), _V_th(__v._V_th), _V_t(__v._V_t),
00397 _V_ctx(__v._V_ctx), _V_cc(__v._V_cc), _V_r(__v._V_r),
00398 _V_c(__v._V_c), _V_cx(__v._V_cx), _V_colnames(__v._V_colnames)
00399 {}
00400
00404 virtual ~_VDBL_hierarchicalview() {}
00405
00409 void push_table(const _VDBL_tableid& __ti, _VDBL_table* __t)
00410 {
00411 _V_th.insert(_V_th.begin(), __ti);
00412 _V_t.insert(std::make_pair(__ti,std::make_pair(__t,__t->get_change_ctr())));
00413 _VDBL_table::col_const_iterator __x, __e(__t->col_end());
00414 for(__x = __t->col_begin(); __x != __e; ++__x)
00415 {
00416 std::map<std::string,_V_colref>::iterator
00417 _ccr(_V_colnames.find((*__x).first));
00418 if(_ccr == _V_colnames.end())
00419 continue;
00420 _V_cx.insert(std::make_pair(std::make_pair(__ti,(*__x).second),
00421 (*_ccr).second));
00422 }
00423 _VDBL_table::row_const_iterator __y, __f(__t->row_end());
00424 for(__y = __t->row_begin(); __y != __f; ++__y)
00425 _V_r.push_back(std::make_pair(__ti,*__y));
00426 std::sort(_V_r.begin(), _V_r.end());
00427 }
00428
00434 void push_table(const _VDBL_tableid& __ti, _VDBL_table* __t,
00435 const std::vector<_VDBL_rowid>& _rs)
00436 {
00437 _V_th.insert(_V_th.begin(), __ti);
00438 _V_t.insert(std::make_pair(__ti,std::make_pair(__t,__t->get_change_ctr())));
00439 _VDBL_table::col_const_iterator __x, __e(__t->col_end());
00440 for(__x = __t->col_begin(); __x != __e; ++__x)
00441 {
00442 std::map<std::string,_V_colref>::iterator
00443 _ccr(_V_colnames.find((*__x).first));
00444 if(_ccr == _V_colnames.end())
00445 continue;
00446 _V_cx.insert(std::make_pair(std::make_pair(__ti,(*__x).second),
00447 (*_ccr).second));
00448 }
00449 std::vector<_VDBL_rowid>::const_iterator __y, __f(_rs.end());
00450 _V_r.reserve(_rs.size()+_V_r.size());
00451 for(__y = _rs.begin(); __y != __f; ++__y)
00452 _V_r.push_back(std::make_pair(__ti,*__y));
00453 std::sort(_V_r.begin(), _V_r.end());
00454 }
00455
00459 _VDBL_tableid pop_table()
00460 {
00461 if(_V_th.empty())
00462 return _VDBL_tableid();
00463 _VDBL_tableid ti(*_V_th.begin());
00464 _V_th.erase(_V_th.begin());
00465 _V_tref::iterator _tri(_V_t.find(ti));
00466 if(_tri != _V_t.end())
00467 _V_t.erase(_tri);
00468 std::vector<int> erase_r;
00469 unsigned int j(0);
00470 for(unsigned int i = 0; i < _V_r.size(); ++i)
00471 {
00472 if(_V_r[i].first == ti)
00473 ++j;
00474 else if(j > 0)
00475 _V_r[i-j] = _V_r[i];
00476 }
00477 _V_r.erase(_V_r.end()-j, _V_r.end());
00478 for(_V_colxref::iterator __x = _V_colxref.begin(); __x != _V_colxref.end();
00479 ++__x)
00480 {
00481 if((*__x).first.first == ti)
00482 _V_colxref.erase(__x);
00483 }
00484 return ti;
00485 }
00486
00487 public:
00488 const std::type_info& get_colinfo(const std::string& _C_n,
00489 std::triple<bool,_VDBL_colid,_VDBL_colflags>& _r) const
00490 {
00491 std::map<std::string,_V_colref>::const_iterator __x(_V_colnames.find(_C_n));
00492 if(__x == _V_colnames.end())
00493 {
00494 _r = std::make_triple(false, _VDBL_colid(), _VDBL_colflags());
00495 return typeid(void);
00496 }
00497 return get_master_table()->get_colinfo(_C_n, _r);
00498 }
00499
00500 const std::type_info& get_coltype(const std::string& _C_n) const
00501 {
00502 std::triple<bool,_VDBL_colid,_VDBL_colflags> _r;
00503 return get_colinfo(_C_n, _r);
00504 }
00505
00506 bool insert(const std::vector<_T_colspec>& _row)
00507 {
00508 if(view_type() != V_window)
00509 return false;
00512 _V_rowref _ri;
00513 std::vector<std::pair<const std::string*,const _VDBL_col*> > _v;
00514 _v.reserve(_row.size());
00515 for(std::vector<_T_colspec>::const_iterator _x = _row.begin();
00516 _x != _row.end(); ++_x)
00517 _v.push_back(std::make_pair(&(*_x).first,&(*_x).second));
00518 _ri.first = *_V_th.begin();
00519 _VDBL_table* _tp = get_table(_ri.first);
00520 if(!_tp) return false;
00521 bool ret = _tp->insert(_v, _ri.second);
00522 _V_r.insert(std::upper_bound(_V_r.begin(), _V_r.end(), _ri), _ri);
00523 return ret;
00524 }
00525
00526 bool remove(std::pair<_VDBL_tableid,_VDBL_rowid> _r)
00527 {
00528 if(!_row_visible(_r))
00529 return false;
00530 if(view_type() != V_window)
00531 return false;
00532 _VDBL_table* _tp = get_table(_r.first);
00533 if(!_tp) return false;
00534 return _tp->remove(_r.second);
00535 }
00536
00537 bool has_col(const std::string& _C_n) const
00538 {
00539 std::map<std::string,_V_colref>::const_iterator __x(_V_colnames.find(_C_n));
00540 return __x != _V_colnames.end();
00541 }
00542
00543 std::pair<_VDBL_tableid,_VDBL_colid> get_col_id(const std::string& _C_n) const
00544 {
00545 std::map<std::string,_V_colref>::const_iterator __x(_V_colnames.find(_C_n));
00546 if(__x == _V_colnames.end())
00547 return std::make_pair(_VDBL_tableid(),_VDBL_colid());
00548 return std::make_pair(get_master_table_id(),(*__x).second);
00549 }
00550
00551 const _VDBL_row& get_row(const std::pair<_VDBL_tableid,_VDBL_rowid>& _ri,
00552 bool& error) const
00553 {
00554 if(!_row_visible(_ri))
00555 {
00556 error = true;
00557 return ___empty_row_return;
00558 }
00559 _VDBL_table* _tp = get_table(_ri.first);
00560 if(!_tp)
00561 {
00562 error = true;
00563 return ___empty_row_return;
00564 }
00565 return _tp->get_row(_ri.second, error);
00566 }
00567
00568 const _VDBL_col& get_raw_col(const std::pair<_VDBL_tableid,_VDBL_rowid>& _ri,
00569 const _VDBL_colid& _ci, _VDBL_row const *& _rr,
00570 bool& error) const
00571 {
00572 if(!_row_visible(_ri))
00573 {
00574 error = true;
00575 return ___empty_col_return;
00576 }
00577 _VDBL_table* _tp = get_table(_ri.first);
00578 if(!_tp)
00579 {
00580 error = true;
00581 return ___empty_col_return;
00582 }
00583 const _VDBL_row& _r(_tp->get_row(_ri.second, error));
00584 if(error)
00585 return ___empty_col_return;
00586 _rr = &_r;
00587 const _VDBL_col& _c(_r.get_col(_ci, error));
00588 if(error)
00589 {
00590 std::pair<_VDBL_tableid,_VDBL_colid> _tc = _find_def(_ci);
00591 if(_tc.first == 0)
00592 return ___empty_col_return;
00593 _tp = get_table(_tc.first);
00594 if(!_tp)
00595 return ___empty_col_return;
00596 return _tp->get_def(_ci, error);
00597 }
00598 else
00599 return _c;
00600 }
00601
00606 std::ostream& print_col(std::ostream& o,
00607 const std::pair<_VDBL_tableid,_VDBL_rowid>& _ri,
00608 const _VDBL_colid& _ci, bool& printed) const
00609 {
00610 bool error;
00611 const _VDBL_row* _rr;
00612 vdbl::col c(get_raw_col(_ri, _ci, _rr, error));
00613 if(error)
00614 {
00615 printed = false;
00616 return o;
00617 }
00618 printed = true;
00619 c.setcontext(_V_ctx, _rr);
00620 return o << c;
00621 }
00622
00631 template <class _TR>
00632 bool get_raw_ptr(const std::pair<_VDBL_tableid,_VDBL_rowid>& _ri,
00633 const _VDBL_colid& _ci, _TR const *& r) const
00634 {
00635 bool error;
00636 const _VDBL_row *_rr;
00637 vdbl::col c(get_raw_col(_ri, _ci, _rr, error));
00638 if(error)
00639 return false;
00640 c.setcontext(_V_ctx, _rr);
00641 c.get_ptr(r);
00642 return true;
00643 }
00644
00650 template <class _TR>
00651 bool get(const std::pair<_VDBL_tableid,_VDBL_rowid>& _ri,
00652 const _VDBL_colid& _ci, _TR& r) const
00653 {
00654 bool error;
00655 const _VDBL_row *_rr;
00656 vdbl::col c(get_raw_col(_ri, _ci, _rr, error));
00657 if(error)
00658 return false;
00659 c.setcontext(_V_ctx, _rr);
00660 c.get(r);
00661 return true;
00662 }
00663
00664 const _VDBL_col& get_def(const std::pair<_VDBL_tableid,_VDBL_colid>& _ri,
00665 bool& error) const
00666 { return get_table(_ri.first)->get_def(_ri.second, error); }
00667
00668 default_const_iterator defaults_begin() const
00669 {
00670 _V_cols::const_iterator* _rit = new _V_cols::const_iterator(_V_c.begin());
00671 std::pair<_VDBL_tableid,_VDBL_colid> _tc(0,0);
00672 while(*_rit != _V_c.end())
00673 {
00674 _tc = _find_def(**_rit);
00675 if(_tc.first != 0)
00676 break;
00677 ++*_rit;
00678 }
00679 if(*_rit == _V_c.end())
00680 return default_const_iterator(this,0,0,(void*)_rit);
00681 return default_const_iterator(this,_tc.first,**_rit,(void*)_rit);
00682 }
00683
00684 default_const_iterator defaults_end() const
00685 {
00686 _V_cols::const_iterator* _rit = new _V_cols::const_iterator(_V_c.begin());
00687 return default_const_iterator(this,0,0,(void*)_rit);
00688 }
00689
00690 col_const_iterator cols_begin(const _VDBL_rowid& _r) const
00691 {
00692 _V_cols::const_iterator* _rit = new _V_cols::const_iterator(_V_c.begin());
00693 std::pair<_VDBL_tableid,_VDBL_colid> _tc(0,0);
00694 while(*_rit != _V_c.end())
00695 {
00696 _tc = _find_col(_r,**_rit);
00697 if(_tc.first != 0)
00698 break;
00699 ++*_rit;
00700 }
00701 if(*_rit == _V_c.end())
00702 return col_const_iterator(this,0,_r,0,(void*)_rit);
00703 return col_const_iterator(this,_tc.first,_r,**_rit,(void*)_rit);
00704 }
00705
00706 col_const_iterator cols_end(const _VDBL_rowid& _r) const
00707 {
00708 _V_cols::const_iterator* _rit = new _V_cols::const_iterator(_V_c.begin());
00709 return col_const_iterator(this,0,_r,0,(void*)_rit);
00710 }
00711
00712 row_const_iterator rows_begin() const
00713 {
00714 _V_rows::const_iterator* _rit = new _V_rows::const_iterator(_V_r.begin());
00715 if(*_rit == _V_r.end())
00716 return row_const_iterator(this,0,0,(void*)_rit);
00717 return row_const_iterator(this,(**_rit).first,(**_rit).second,(void*)_rit);
00718 }
00719
00720 row_const_iterator rows_end() const
00721 {
00722 _V_rows::const_iterator* _rit = new _V_rows::const_iterator(_V_r.end());
00723 return row_const_iterator(this,0,0,(void*)_rit);
00724 }
00725 };
00726
00728
00738 class hierarchical_view : public _VDBL_hierarchicalview
00739 {
00740 typedef _VDBL_hierarchicalview _Base;
00741
00742 public:
00743 typedef _V_enum view_enum;
00744
00745 public:
00750 hierarchical_view(const _VDBL_tableid& __ti, _VDBL_table* __t,
00751 const _VDBL_context& __c, _V_enum __e = V_window)
00752 : _VDBL_hierarchicalview(__ti,__t,__c,__e) {}
00753
00757 hierarchical_view(const hierarchical_view& _v) : _VDBL_hierarchicalview(_v) {}
00758
00763 template <class _TR>
00764 bool get(const tableid& _ti, const rowid& _ri, const colid& _ci, _TR& r) const
00765 { return _Base::get(std::make_pair(_ti, _ri), _ci, r); }
00766
00773 template <class _TR>
00774 bool get_raw_ptr(const tableid& _ti, const rowid& _ri, const colid& _ci,
00775 _TR const *& r) const
00776 { return _Base::get_raw_ptr(std::make_pair(_ti, _ri), _ci, r); }
00777
00779
00783 template <class _TR>
00784 bool get(const rowid& _ri, const std::string& _c, _TR& r) const
00785 { std::pair<tableid,colid> _tci(get_col_id(_c));
00786 return _Base::get(std::make_pair(_tci.first, _ri), _tci.second, r); }
00787
00788 template <class _TR>
00789 bool get(const rowid& _ri, const char* _c, _TR& r) const
00790 { return get(_ri, std::string(_c), r); }
00792 };
00793
00794 #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
00795 #pragma reset woff 1209
00796 #endif
00797
00798 __VDBL_END_NAMESPACE
00799
00800 #endif
00801
00802
00803
00804