Exemplo n.º 1
0
bool CChildLimitedDatasetColumnInfo::buildReadAhead(HqlCppTranslator & translator, BuildCtx & ctx, ReadAheadState & state)
{
    try
    {
        OwnedHqlExpr self = container->getRelativeSelf();
        if (sizeField)
        {
            OwnedHqlExpr mappedSize = replaceSelector(sizeField, querySelfReference(), self);
            OwnedHqlExpr replacedSize = quickFullReplaceExpressions(mappedSize, state.requiredValues, state.mappedValues);
            if (containsSelector(replacedSize, queryRootSelf()))
                return false;
            callDeserializerSkipInputSize(translator, ctx, state. helper, replacedSize);
            return true;
        }
        else
        {
            OwnedHqlExpr mappedCount = replaceSelector(countField, querySelfReference(), self);
            OwnedHqlExpr replacedCount = quickFullReplaceExpressions(mappedCount, state.requiredValues, state.mappedValues);
            if (containsSelector(replacedCount, queryRootSelf()))
                return false;
            if (fixedChildSize != UNKNOWN_LENGTH)
            {
                OwnedHqlExpr scaledSize = multiplyValue(replacedCount, fixedChildSize);
                callDeserializerSkipInputSize(translator, ctx, state. helper, scaledSize);
                return true;
            }

            BuildCtx loopctx(ctx);
            CHqlBoundExpr bound;
            translator.buildTempExpr(loopctx, replacedCount, bound);

            OwnedHqlExpr test = createValue(no_postdec, LINK(bound.expr));
            loopctx.addLoop(test, NULL, false);

            StringBuffer prefetcherInstanceName;
            translator.ensureRowPrefetcher(prefetcherInstanceName, ctx, column->queryRecord());
            
            StringBuffer s;
            s.append(prefetcherInstanceName).append("->readAhead(");
            translator.generateExprCpp(s, state.helper).append(");");
            loopctx.addQuoted(s);
            return true;
        }
    }
    catch (IException * e)
    {
        //yuk yuk yuk!!  Couldn't resolve the dataset count/size for some strange reason
        e->Release();
    }
    return false;
}
Exemplo n.º 2
0
static void winMotion (int x, int y)
{
    float t[XYZ];
	
    if(!polygonPicking && !cellPicking && !createVect){ /* not in picking mode */
		if ( activePrim == WORLD){
			mouseMovingFlag = TRUE;
			handleTrackball(x, y);
		}
		
		else{	/* the primitive being handled is NOT the world camera */
			switch(modelMode){
				case TRANS:
					t[X] = t[Y] = t[Z] = 0.0;
					
					/* printf("before %f %f %f\n", t[X], t[Y], t[Z]); */
					if (rotateflag)	pan(x,y,t);
					
					else if (zoomflag)zoom(x,y,t);             
					
					multiplyValue(t, mouseTransSpeed); /* apply some scaling to the mouse */
					/* printf("after %f %f %f\n", t[X], t[Y], t[Z]); */
					vadd(t, Prim[activePrim].trans, Prim[activePrim].trans);
					break;
					
				case ROT:
					/*printf("Entered Rotation Mode!\n"); */
					if (rotateflag){
						if (horizontalFlag){					
							Prim[activePrim].rot[Z] -= (float) (oldMouseX - x)*mouseRotSpeed;
						}else if(verticalFlag){
							Prim[activePrim].rot[Y] -= (float) (oldMouseY - y)*mouseRotSpeed;
						}else{
							Prim[activePrim].rot[Z] -= (float) (oldMouseX - x)*mouseRotSpeed;
							Prim[activePrim].rot[Y] -= (float) (oldMouseY - y)*mouseRotSpeed;
							//Prim[activePrim].rot[X] -= (float) (oldMouseX - x)*mouseRotSpeed;
							//Prim[activePrim].rot[Y] -= (float) (oldMouseY - y)*mouseRotSpeed;
						}
					}
					else if (zoomflag)
						Prim[activePrim].rot[X] -= (float) (oldMouseX - x)*mouseRotSpeed;
				    //Prim[activePrim].rot[X] -= (float) (oldMouseX - x)*mouseRotSpeed;
					break;
					
				case SCALE:			 
					/*printf("Entered Scaling Mode!\n");*/ 
					if (rotateflag){
						//if (horizontalFlag){				
						//Prim[activePrim].scale[X] -= (float) (oldMouseX - x)*mouseRotSpeed;
						
						// }else if(verticalFlag){
						//Prim[activePrim].scale[Y] -= (float) (oldMouseY - y)*mouseRotSpeed;
						
						// }else{
						Prim[activePrim].scale[Z] -= (float) (oldMouseX - x)*mouseScaleSpeed;
						Prim[activePrim].scale[Y] -= (float) (oldMouseX - x)*mouseScaleSpeed;
						//Prim[activePrim].scale[X] -= (float) (oldMouseX - x)*mouseScaleSpeed;
						//Prim[activePrim].scale[Y] += (float) (oldMouseY - y)*mouseScaleSpeed;
						
						//}
					}
					else if (zoomflag){				
						Prim[activePrim].scale[X] -= (float) (oldMouseX - x)*mouseScaleSpeed;
						//Prim[activePrim].scale[Z] -= (float) (oldMouseX - x)*mouseScaleSpeed;
						
					}
					break;
				default:
					break;
			}
		}
		oldMouseX = x;
		oldMouseY = y;
	    
		glutPostRedisplay();
    }
}