rtdb/kogmo_rtdb_objdata_slot.c
// kogmo_rtdb_obj_readdataslot_relative() makes sure, that no history-wrap occured by re-checking the last known slot
kogmo_rtdb_obj_readdataslot_relative() makes sure, that no history-wrap occured by re-checking the last known slot
kogmo_rtdb_obj_readdataslot_relative () makes sure that no history - wrap occured by re - checking the last known slot
kogmo_rtdb_objsize_t
kogmo_rtdb_obj_readdataslot_relative (kogmo_rtdb_handle_t *db_h,
                                      kogmo_rtdb_obj_slot_t *objslot,
                                      int offset,
                                      void *data_p,
                                      kogmo_rtdb_objsize_t size)
{
  kogmo_rtdb_objsize_t olen,realsize;
  void *objdata_p;
  CHK_DBH("kogmo_rtdb_obj_readdataslot",db_h,0);
  CHK_PTR(objslot);
  CHK_PTR(data_p);
  olen = kogmo_rtdb_obj_readdataslot_ptr (db_h, 1, offset, objslot, &objdata_p);
  if ( olen < 0 )
    {
      DBG("kogmo_rtdb_obj_readdataslot(oid %lli, offset %i) returns %lli", (long long int)objslot->oid, offset, (long long int)olen);                                                 
      kogmo_rtdb_obj_readdataslot_ptr (db_h, 0, 0, objslot, NULL); 
      return olen;
    }
  realsize = olen;
  memcpy(data_p, objdata_p, realsize < size ? realsize : size);
  olen = kogmo_rtdb_obj_readdataslot_ptr (db_h, 1, 0, objslot, NULL);
  if ( olen < 0 )
    {
      DBG("kogmo_rtdb_obj_readdataslot(oid %lli, offset %i) returns %lli", (long long int)objslot->oid, offset, (long long int)olen);                                                 
      kogmo_rtdb_obj_readdataslot_ptr (db_h, 0, 0, objslot, NULL); 
      return olen;
    }
  DBG("kogmo_rtdb_obj_readdataslot_next(oid %lli, offset %i) returns %lli at slot %i", (long long int)objslot->oid, offset, (long long int)realsize, objslot->history_slot);
  return realsize;
}
kogmo_rtdb_objsize_t kogmo_rtdb_obj_readdataslot_relative ( kogmo_rtdb_handle_t * db_h , kogmo_rtdb_obj_slot_t * objslot , int offset , void * data_p , kogmo_rtdb_objsize_t size ) { kogmo_rtdb_objsize_t olen , realsize ; void * objdata_p ; CHK_DBH ( " " , db_h , 0 ) ; CHK_PTR ( objslot ) ; CHK_PTR ( data_p ) ; olen = kogmo_rtdb_obj_readdataslot_ptr ( db_h , 1 , offset , objslot , & objdata_p ) ; if ( olen < 0 ) { DBG ( " " , ( long long int ) objslot -> oid , offset , ( long long int ) olen ) ; kogmo_rtdb_obj_readdataslot_ptr ( db_h , 0 , 0 , objslot , NULL ) ; return olen ; } realsize = olen ; memcpy ( data_p , objdata_p , realsize < size ? realsize : size ) ; olen = kogmo_rtdb_obj_readdataslot_ptr ( db_h , 1 , 0 , objslot , NULL ) ; if ( olen < 0 ) { DBG ( " " , ( long long int ) objslot -> oid , offset , ( long long int ) olen ) ; kogmo_rtdb_obj_readdataslot_ptr ( db_h , 0 , 0 , objslot , NULL ) ; return olen ; } DBG ( " " , ( long long int ) objslot -> oid , offset , ( long long int ) realsize , objslot -> history_slot ) ; return realsize ; }
kogmo_rtdb_obj_readdataslot_relative() makes sure, that no history-wrap occured by re-checking the last known slot
kogmo_rtdb_obj_readdataslot_relative () makes sure that no history - wrap occured by re - checking the last known slot
// re-init // re-init