handler* tuple::get_component(int index) { //MESSAGE(cerr, "in tuple():: get_component()"); //debug(cerr, index); //debug(cerr, my_oid()); //debug(cerr, int(storage_ptr)); if (!INRANGE(index, 1, (int) v_sz)) { MESSAGE(cerr, "out of range in tuple::get_component()"); throw( boundaryException(1, v_sz, index) ); } oid_t x = oid_list::operator()(index); //debug(cerr, x); //debug(cerr, x.ccode()); //debug(cerr, x.icode()); handler* y = 0; if ( x.icode() != 0 ) y = new handler(x, storage_ptr); return y; }
cset_handlerPtr info_base::get_set(int i) { if ( !INRANGE(i, 0, num_cset_ptrs-1) ) throw (boundaryException(0, num_cset_ptrs-1, i)); return info_base_set_ptrs[i]; }
oid_t get_nth_mark_id(mark_base* ub, char* key, int n) { oid_list_handler* handle = ub -> get_mark_list(key); if ( handle == 0 ) { throw(stringException("empty mark list")); } int ind = (*handle) -> first(); int i = 0; while (ind) { if ( n == i ) { oid_t id = (*handle) -> operator()(ind); delete handle; return id; } (*handle) -> next(ind); i++; } int count = (*handle)->count(); delete handle; throw(boundaryException(0, count, i)); }
dl_list_handlerPtr info_base::get_list(int i) { if ( !INRANGE(i, 0, num_list_ptrs-1) ) { throw(boundaryException(0, num_list_ptrs-1, i)); } return info_base_list_ptrs[i]; }
data_t* imp_bucket::operator()(long ind) { if ( ind == 0 ) { MESSAGE(cerr, "imp_bucket::operator(): zero index value"); throw(boundaryException(1, MAXINT, ind)); } return (data_t*)ind; }
buffer& buffer::skip(int i) { if ( i + v_aptr > v_eptr ) MESSAGE(cerr, "buffer::skip(): underflow"); throw ( CASTBNDEXCEPT boundaryException( long(v_aptr), long(v_eptr), long(i + v_aptr) )); v_aptr += i; return *this; }
Boolean ostring::update(const char* x, int l, int offset) { if ( offset + l > v_sz ) { MESSAGE(cerr, "update(): char chunk too small"); throw(boundaryException(0, v_sz, offset+l)); } memcpy(v_p+offset, x, l); return true; }
oid_list_handler* dl_list::get_locs(handler& query, int index) { if ( !INRANGE(index, 0, (int) v_num_indices-1) ) throw(boundaryException(0, v_num_indices-1, index)); if ( v_indices[index] == 0 ) throw(stringException("NULL index handler ptr")); return (*v_indices[index]) -> get_loc_list(query); }
buffer& buffer::get(char& y) { if ( v_aptr > v_eptr) { MESSAGE(cerr, "buffer::get(char&): underflow"); throw ( CASTBNDEXCEPT boundaryException( long(v_aptr), long(v_eptr), long(1+v_aptr))); } y = *v_aptr; v_aptr++; return *this; }
buffer& buffer::get(char *x, int sz) { if ( sz + v_aptr > v_eptr ) { MESSAGE(cerr, "buffer::get(): underflow"); throw ( CASTBNDEXCEPT boundaryException( long(v_aptr), long(v_eptr), long(sz + v_aptr) )); } memcpy(x, v_aptr, sz); v_aptr += sz; return *this; }
oid_t dl_list::get_first_oid(const handler& query, int index) { if ( !INRANGE(index, 0, (int) v_num_indices-1) ) { MESSAGE(cerr, "cset::get_first_oid(): invalid index"); throw(boundaryException(0, v_num_indices-1, index)); } if ( v_indices[index] == 0 ) { throw(stringException("cset::get_first_oid(): NULL index ptr")); } return (*v_indices[index]) -> first_of_invlist(query); }
handler* short_list::get_component(int index) { if ( !INRANGE(index, 1, v_sz) ) { MESSAGE(cerr, "out of range in short_list::get_component()"); throw(boundaryException(1, v_sz, index)); } oid_t x = oid_list::operator()(index); handler *y = 0; if ( x.icode() != 0 ) y = new handler(x, storage_ptr); return y; }
buffer& buffer::get(unsigned short& y) { if ( v_aptr + sizeof(y) > v_eptr ) { MESSAGE(cerr, "buffer::get(float &): underflow"); throw ( CASTBNDEXCEPT boundaryException( long(v_aptr), long(v_eptr), long(sizeof(float)+v_aptr))); } get((char*)&y, sizeof(y)); #ifdef PORTABLE_DB if ( v_swap_order == true ) ORDER_SWAP_USHORT(y); #endif return *this; }
buffer& buffer::get(long& y) { //MESSAGE(cerr, "WARNING: buffer::get(long& y) +++++++++++++++++++++++"); if ( v_aptr + sizeof(y) > v_eptr ) { MESSAGE(cerr, "buffer::get(long&): underflow"); throw ( CASTBNDEXCEPT boundaryException( long(v_aptr), long(v_eptr), long(sizeof(long)+v_aptr))); } get((char*)&y, sizeof(y)); #ifdef PORTABLE_DB if ( v_swap_order == true ) ORDER_SWAP_LONG(y); #endif return *this; }
buffer& buffer::put(const char content, Boolean exp_buf) { //return put((char*)&content, sizeof(content)); if ( v_bufsz == content_sz() ) { if ( exp_buf == true ) expand_chunk(v_bufsz + 10); else { MESSAGE( cerr, "buffer::put(const char): overflow"); throw ( CASTBNDEXCEPT boundaryException(content_sz(), v_bufsz, 1) ); } } *v_eptr = content; v_eptr++; return *this; }
buffer& buffer::put(const char* content, int sz, Boolean exp_buf) { if ( sz > v_bufsz - content_sz() ) { if ( exp_buf == true ) expand_chunk(v_bufsz + sz); else { MESSAGE( cerr, "buffer::put(char*, int): overflow"); throw ( CASTBNDEXCEPT boundaryException(content_sz(), v_bufsz, sz) ); } } //memcpy(v_eptr, content, sz); //debug(cerr, int(v_base)); //debug(cerr, int(v_eptr)); for ( int i=0; i<sz; i++ ) { v_eptr[i] = content[i]; //debug(cerr, int(v_eptr[i])); } v_eptr += sz; return *this; }