w_rc_t table_man_t<T>::fetch_table(ss_m* db, lock_mode_t /* alm */) { assert (db); assert (_ptable); bool eof = false; int counter = -1; table_row_t* tuple = get_tuple(); rep_row_t areprow(ts()); rep_row_t areprow_key(ts()); areprow.set(_ptable->maxsize()); areprow_key.set(_ptable->maxsize()); tuple->_rep = &areprow; tuple->_rep_key = &areprow_key; W_DO(db->begin_xct()); // 1. scan the table table_scan_iter_impl<T> t_scan(this); while(!eof) { W_DO(t_scan.next(eof, *tuple)); counter++; } TRACE( TRACE_ALWAYS, "%s:%d pages\n", _ptable->name(), counter); // 2. scan the indexes for (auto index : _ptable->get_indexes()) { index_scan_iter_impl<T> i_scan(index, this); eof = false; counter = -1; while(!eof) { W_DO(i_scan.next(eof, *tuple)); counter++; } TRACE( TRACE_ALWAYS, "\t%s:%d pages\n", index->name().c_str(), counter); } W_DO(db->commit_xct()); give_tuple(tuple); return RCOK; }
IC void i_section (int Sect, BOOL bMiddle) { // Find the start/end Y pixel coord, set the starting pts for scan line ends int startY, endY; float *startp1, *startp2; float E1[3], E2[3]; if (Sect == BOTTOM) { startY = iCeil(currentA[1]); endY = iFloor(currentB[1])-1; startp1 = startp2 = currentA; if (bMiddle) endY ++; // check 'endY' for out-of-triangle int test = iFloor(currentC[1]); if (endY >=test) endY --; // Find the edge differences E1[0] = currentB[0]-currentA[0]; E2[0] = currentC[0]-currentA[0]; E1[1] = currentB[1]-currentA[1]; E2[1] = currentC[1]-currentA[1]; E1[2] = currentB[2]-currentA[2]; E2[2] = currentC[2]-currentA[2]; } else { startY = iCeil(currentB[1]); endY = iFloor(currentC[1]); startp1 = currentA; startp2 = currentB; if (bMiddle) startY --; // check 'startY' for out-of-triangle int test = iCeil(currentA[1]); if (startY < test) startY ++; // Find the edge differences E1[0] = currentC[0]-currentA[0]; E2[0] = currentC[0]-currentB[0]; E1[1] = currentC[1]-currentA[1]; E2[1] = currentC[1]-currentB[1]; E1[2] = currentC[2]-currentA[2]; E2[2] = currentC[2]-currentB[2]; } Vclamp(startY,0,occ_dim); Vclamp(endY, 0,occ_dim); if (startY >= endY) return; // Compute the inverse slopes of the lines, ie rate of change of X by Y float mE1 = E1[0]/E1[1]; float mE2 = E2[0]/E2[1]; // Initial Y offset for left and right (due to pixel rounding) float e1_init_dY = float(startY) - startp1[1], e2_init_dY = float(startY) - startp2[1]; float t,leftX, leftZ, rightX, rightZ, left_dX, right_dX, left_dZ, right_dZ; // find initial values, step values if ( ((mE1<mE2)&&(Sect==BOTTOM)) || ((mE1>mE2)&&(Sect==TOP)) ) { // E1 is on the Left // Initial Starting values for left (from E1) t = e1_init_dY/E1[1]; // Initial fraction of offset leftX = startp1[0] + E1[0]*t; left_dX = mE1; leftZ = startp1[2] + E1[2]*t; left_dZ = E1[2]/E1[1]; // Initial Ending values for right (from E2) t = e2_init_dY/E2[1]; // Initial fraction of offset rightX = startp2[0] + E2[0]*t; right_dX = mE2; rightZ = startp2[2] + E2[2]*t; right_dZ = E2[2]/E2[1]; } else { // E2 is on left // Initial Starting values for left (from E2) t = e2_init_dY/E2[1]; // Initial fraction of offset leftX = startp2[0] + E2[0]*t; left_dX = mE2; leftZ = startp2[2] + E2[2]*t; left_dZ = E2[2]/E2[1]; // Initial Ending values for right (from E1) t = e1_init_dY/E1[1]; // Initial fraction of offset rightX = startp1[0] + E1[0]*t; right_dX = mE1; rightZ = startp1[2] + E1[2]*t; right_dZ = E1[2]/E1[1]; } // Now scan all lines in this section float lhx = left_dX/2; leftX += lhx; // half pixel float rhx = right_dX/2; rightX += rhx; // half pixel for (; startY<=endY; startY++) { i_scan (startY, leftX, lhx, rightX, rhx, leftZ, rightZ); leftX += left_dX; rightX += right_dX; leftZ += left_dZ; rightZ += right_dZ; } }