示例#1
0
文件: tuple.C 项目: juddy/edcde
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;
}
示例#2
0
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];
}
示例#3
0
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));
}
示例#4
0
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];
}
示例#5
0
文件: imp_bucket.C 项目: juddy/edcde
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;
}
示例#6
0
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;
}
示例#7
0
文件: ostring.C 项目: juddy/edcde
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;
}
示例#8
0
文件: dl_list.C 项目: juddy/edcde
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);
}
示例#9
0
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;
}
示例#10
0
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;
}
示例#11
0
文件: dl_list.C 项目: juddy/edcde
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);
}
示例#12
0
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;
}
示例#13
0
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;
}
示例#14
0
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;
}
示例#15
0
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;
}
示例#16
0
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;
}