コード例 #1
0
ファイル: model.c プロジェクト: SmarterSoftware/VLDB12
HeapTuple ComputeNextTuple(HeapScanDesc scan) {
	DModel * m=&(models[0]);
	int i;
	double y=0;
	double o=0;
	int x;
	int len=0;
	int cnt=0;
	int length=m->len;

	// prepare the cache
	int   a=Prepare(scan);
       	if(a==2) {
		return NULL;
        }
	//if(a==1) return NULL;
	if (grp_fnc=='M') o=DBL_MAX;
	x=scan->index+1;
	for(;;){
		scan->index++;
		if(a==1) {
	//		elog(WARNING," item %d %d",scan->index-length,newpoints );
			//check to use the extra or the points
			if(extra==NULL)
			 y=points[scan->index-length-1];
			else {
			int yy=scan->index-length-1;
			if(yy>=extra->len)
			   y=points[yy-extra->len];
			else
			  y=EvalB(extra,yy);
			}	  	
			
			}
		else {
		if(m_layers==-1)
			y=GetValue(scan->index);
		else	
			y=GetValueL(scan->index);
		}
		if ((grp_fnc=='s')||(grp_fnc=='a')) { o=o+y; cnt++;}
		else if ((grp_fnc=='m') && (o<y)) o =y;
		else if ((grp_fnc=='M') && (o>y)) o=y;
		else if ((grp_fnc=='\0')||(grp_fnc=='n')) o=y;
		len++;
		if((len>=grp_len)&&(grp_len!=-1)) {
			if (grp_fnc=='a') o=o/cnt;
			break;	
		}
		if( m_fend==-1) {
			if ((scan->index>length)&&(grp_len==-1))  return NULL;
			if (scan->index>length) break;
		} 
	}

//	elog(WARNING,"x %d, o%f",x,o);
	if ((grp_len!=-1)||(grp_len!=0)) x=x/grp_len;
	return CreateTuple(scan->rs_rd,x, (int)o);

}
コード例 #2
0
EXPORT_C TUint8 CMTPTypeObjectPropListElement::Uint8L(TInt aElementId) const
	{
	if(EValue != aElementId || EMTPTypeUINT8 != iDataType)
	    User::Leave(KErrArgument);
	TUint8 retValue = 0;
	GetValueL(&retValue, sizeof(TUint8));

	return retValue;
	}
コード例 #3
0
EXPORT_C TUint64 CMTPTypeObjectPropListElement::Uint64L(TInt aElementId) const
	{
	if(EValue != aElementId || EMTPTypeUINT64 != iDataType)
	    {
	    User::Leave(KErrArgument);
	    }
	
	TUint64 retValue;
	GetValueL(&retValue, sizeof(TUint64));	
	return retValue;
	}
コード例 #4
0
EXPORT_C TUint32 CMTPTypeObjectPropListElement::Uint32L(TInt aElementId) const
	{
	switch(aElementId)
		{
		case EObjectHandle:
			return iObjectHandle;
		case EValue:
		    if(EMTPTypeUINT32 != iDataType)
		        {
		          User::Leave(KErrArgument);
		        }
		    TUint32 retValue;
		    GetValueL(&retValue, sizeof(TUint32));
		    return retValue;
		default:
			User::Leave(KErrArgument);	
		}
	return 0;
	}
コード例 #5
0
EXPORT_C TUint16 CMTPTypeObjectPropListElement::Uint16L(TInt aElementId) const
	{
	switch(aElementId)
		{
		case EPropertyCode:
			return iPropertyCode;
		case EDatatype:
			return iDataType;
		case EValue:
            if(EMTPTypeUINT16 != iDataType)
                {
                  User::Leave(KErrArgument);
                }
            
            //Workaround for partial deletion issue observed on Windows XP/Windows7.
            //When send an object from PC to device through Windows explorer, it will
            //include the 'ProtectionStatus' property in the dataset of 'SendObjectPropList' 
            //command. While syncing through Ovi player or Windows Media Player, this property
            //will not be included.
            //When we delete a folder which contains read-only objects,we returns partial 
            //deletion code, because read-only object should not be deleted according to MTP spec.
            //On receiving this,Windows popup a dialog saying 'device stops response', this really
            //give user bad experience, to prevent this, we make this workaround here: when dataprovider
            //query value of 'ProtectionStatus' property,always return EMTPProtectionNoProtection(0x0000).
            if (EMTPObjectPropCodeProtectionStatus == iPropertyCode)
                {
                return EMTPProtectionNoProtection;
                }
            else
                {
                TUint16 retValue;
                GetValueL(&retValue, sizeof(TUint16));
                return retValue;
                }
		default:
			User::Leave(KErrArgument);
		}	
	return 0;
	}