Esempio n. 1
0
void
BouncerTest::rejectionThresholdIsExclusive()
{
    configureRejectionThreshold(Priority(120));
    _upper->sendDown(createDummyFeedMessage(11 * 1000000, Priority(120)));
    assertMessageNotBounced();
}
Esempio n. 2
0
void
BouncerTest::doNotRejectHigherPrioritizedFeedMessagesThanConfigured()
{
    configureRejectionThreshold(Priority(120));
    _upper->sendDown(createDummyFeedMessage(11 * 1000000, Priority(119)));
    assertMessageNotBounced();
}
int change(char *A) {
	int i, j;
	int Ans[1000], Sign[1000], AIdx = -1, tmp, g;
	int Stack[1000], SIdx = -1;
	for(i = 0, tmp = 0, g = 0; A[i]; i++) {
		if(A[i] >= '0' && A[i] <= '9')
			tmp = tmp*10 + A[i]-'0', g = 1;
		else {
			if(g)
				Ans[++AIdx] = tmp, Sign[AIdx] = 0, tmp = 0, g = 0;
			Stack[++SIdx] = A[i];
			if(A[i] == ')') {
				SIdx--;
				while(SIdx >= 0 && Stack[SIdx] != '(')
					Ans[++AIdx] = Stack[SIdx], Sign[AIdx] = 1, SIdx--;
				SIdx--;
			}
			else
				while(SIdx >= 1 && Priority(Stack[SIdx-1]) >= Priority(Stack[SIdx]) && Stack[SIdx] != '(')
					Ans[++AIdx] = Stack[SIdx-1], Sign[AIdx] = 1, Stack[SIdx-1] = Stack[SIdx], SIdx--;
		}
	}
	if(g)
		Ans[++AIdx] = tmp, Sign[AIdx] = 0, tmp = 0, g = 0;
	while(SIdx >= 0)
		Ans[++AIdx] = Stack[SIdx], Sign[AIdx] = 1, SIdx--;
	for(i = 0; i <= AIdx; i++)
		if(Sign[i] == 1)
			printf("%c", Ans[i]);
		else
			printf("%d", Ans[i]);
	puts("");
}
Esempio n. 4
0
VOID Ins(INS ins, VOID *v)
{
    static bool before = false, after = false, taken = false;

    if (!before)
    {

        INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(beforeCall), IARG_END);
        INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(beforeCheck), IARG_END);
        
        Priority(IPOINT_BEFORE, ins);
        
        before = true;
    }
    
    if (!after && INS_HasFallThrough(ins))
    {
        INS_InsertCall(ins, IPOINT_AFTER, AFUNPTR(afterCall), IARG_END);
        INS_InsertCall(ins, IPOINT_AFTER, AFUNPTR(afterCheck), IARG_END);
        
        Priority(IPOINT_AFTER, ins);

        after = true;
    }

    if (!taken && INS_IsBranchOrCall(ins))
    {
        INS_InsertCall(ins, IPOINT_TAKEN_BRANCH, AFUNPTR(takenCall), IARG_END);
        INS_InsertCall(ins, IPOINT_TAKEN_BRANCH, AFUNPTR(takenCheck), IARG_END);
        
        Priority(IPOINT_TAKEN_BRANCH, ins);

        taken = true;
    }
}
Esempio n. 5
0
void
BouncerTest::rejectLowerPrioritizedFeedMessagesWhenConfigured()
{
    configureRejectionThreshold(Priority(120));
    _upper->sendDown(createDummyFeedMessage(11 * 1000000, Priority(121)));
    assertMessageBouncedWithRejection();
}
Esempio n. 6
0
	bool should_insert (int iVTyp, int iPrio) const
	{
	// 1. höhere Priorität sticht
		if (Priority() != iPrio)	
			return Priority() < iPrio;
	
	// 2. ansonsten VT_Text(4) > VT_Flaeche(2) > VT_Linie(1) > VT_Punkt(0)
		return VisType() < iVTyp;	
	}
Esempio n. 7
0
void
BouncerTest::internalOperationsAreNotRejected()
{
    configureRejectionThreshold(Priority(1));
    document::BucketId bucket(16, 1234);
    api::BucketInfo info(0x1, 0x2, 0x3);
    auto cmd = std::make_shared<api::NotifyBucketChangeCommand>(makeDocumentBucket(bucket), info);
    cmd->setPriority(Priority(2));
    _upper->sendDown(cmd);
    assertMessageNotBounced();
}
Esempio n. 8
0
void
BouncerTest::readOnlyOperationsAreNotRejected()
{
    configureRejectionThreshold(Priority(1));
    // StatBucket is an external operation, but it's not a mutating operation
    // and should therefore not be blocked.
    auto cmd = std::make_shared<api::StatBucketCommand>(
            makeDocumentBucket(document::BucketId(16, 5)), "");
    cmd->setPriority(Priority(2));
    _upper->sendDown(cmd);
    assertMessageNotBounced();
}
Esempio n. 9
0
/**

The CMsvSendExe::AddTaskL method
Finds a CMsvSendExeActive in iOperations that corresponds to aPackage and aMtm.
If not found, then creates a new CMsvSendExeActive, and appends it to iOperations.
Then the message in aPackage is appended to the CMsvSendExeActive.

@internalAll
@param				aPackage	Information about what operation to start
@param				aMtm		The MTM of the message identified in aPackage
*/
void CMsvSendExe::AddTaskL(const TMsvSchedulePackage& aPackage, const TUid& aMtm)
	{
	//Add the task to an object in iOperations

	CMsvSendExeActive* active = NULL;
	TInt count = iOperations.Count();

	while (active == NULL && count--)
		{
		CMsvSendExeActive* tempActive = iOperations[count];

		if (tempActive->Mtm() == aMtm &&
			tempActive->Package().iCommandId == aPackage.iCommandId &&
			tempActive->Package().iParameter == aPackage.iParameter &&
			tempActive->Package().iPollProgress == aPackage.iPollProgress)
			active = tempActive;
		}

	if (active == NULL)
		{
		active = CMsvSendExeActive::NewLC(*iSession, *this, aPackage, aMtm, Priority());
		User::LeaveIfError(iOperations.Append(active));
		CleanupStack::Pop(active);
		}

	active->AppendL(aPackage.iId);
	}
Esempio n. 10
0
void CImmediateMediaEvent::ConstructL(/*TInt aPriority=CActive::EPriorityStandard*/)
	{
	iLogger->Log(_L("Creating event with priority (%d)") , Priority() );
	//iPeriodic=CPeriodic::NewL(aPriority);
	//iPeriodic->Start(iDelay , iInterval , TCallBack(Tick, this));
	CActiveScheduler::Add(this);
	}
Esempio n. 11
0
void Parse(char* token)
{
    char operator;

    if(IsNumber(token[0]))
    {
        printf("%s ", token);
        return;
    }
    
    if(token[0] == ']' )
    {
        PopAllOperators();       
        return;
    }
    
    if( CurrentOperatorPriority() < Priority(token[0]) )
    {
        Push(token[0]);
        return;
    }
    
    PopAllOperators();
    Push(token[0]);
    
}
Esempio n. 12
0
Job::Job(std::string const& s)
    :dad(nullptr), weight(1.0), parent(nullptr) {
    int i(s.find("/"));
    std::string temp(s);
    int day=std::stoi(temp.substr(0,i));
    temp=temp.substr(i+1);
    i = temp.find("/");
    int month=std::stoi(temp.substr(0,i));
    temp=temp.substr(i+1);
    i = temp.find(" ");
    int year=std::stoi(temp.substr(0,i));
    temp=temp.substr(i+1);
    QDate d(year,month,day);
    i = temp.find(":");
    int hour=std::stoi(temp.substr(0,i));
    temp=temp.substr(i+1);
    i = temp.find(" ");
    int minute=std::stoi(temp.substr(0,i));
    temp=temp.substr(i+1);
    QTime t(hour,minute);
    aRendre=QDateTime(d,t);
    i = temp.find(" ");
    priorite=Priority(std::stoi(temp.substr(0,i)));
    name=temp.substr(i+1);
}
// ---------------------------------------------------------------------------
// CUpnpTcpSessionReader::ConstructL
// Two-phased constructor
// constructor that can leave. Used from derived classes.
// ---------------------------------------------------------------------------
//
void CUpnpHttpFileTransferWriter::ConstructL()
    {
    CActiveScheduler::Add( this );   
    iRetryWrite = CUpnpRetryWrite::NewL( iSession, iSocket, this, (TThreadPriority)Priority() );
    
    iSendBuffer.CreateL( iWriteSize );
    }
Esempio n. 14
0
cLogger::cLogger(int CardNum, bool soft)
:cAction("logger",CardNum)
{
  cardNum=CardNum; softCSA=soft;
  catfilt=0; up=false; prescan=pmNone;
  Priority(10);
}
Esempio n. 15
0
/*!
    \since 4.1

    Returns the priority for a running thread.  If the thread is not
    running, this function returns \c InheritPriority.

    \sa Priority, setPriority(), start()
*/
QThread::Priority QThread::priority() const
{
    Q_D(const QThread);
    QMutexLocker locker(&d->mutex);

    // mask off the high bits that are used for flags
    return Priority(d->priority & 0xffff);
}
Esempio n. 16
0
int CurrentOperatorPriority()
{
    char operator;
    if(stackTop <= 0) return -1;
    if(stack[stackTop-1] == '[') return -1;
    
    return Priority(stack[stackTop-1]);   
}
Esempio n. 17
0
void
BouncerTest::onlyRejectFeedMessagesWhenConfigured()
{
    configureRejectionThreshold(RejectionDisabledConfigValue);
    // A message with even the lowest priority should not be rejected.
    _upper->sendDown(createDummyFeedMessage(11 * 1000000, Priority(255)));
    assertMessageNotBounced();
}
TUint CGOomRunPluginConfig::CalculatePluginPriority(const CGOomWindowGroupList& aWindowGroupList)
{
    FUNC_LOG;

    // Call the Priority function on the CActionConfig base class
    // This function will check if any rules match the current system state and then adjust the priority if they do
    // Rules may apply to system plugins or application plugins
    return Priority(aWindowGroupList, aWindowGroupList.GetIndexFromAppId(iTargetAppId));
}
Esempio n. 19
0
/**
 *  2nd Phase of construction.
 *
 *  Creates CSmsTimeout object and the SMS event logger.
 */
void CSmsMessageSend::ConstructL()
{
    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGESEND_CONSTRUCTL_1, "CSmsMessageSend::ConstructL()");

    iSmsEventLogger = CSmsEventLogger::NewL(iSegmentationStore.FileSession(),
                                            Priority());

    ConstructTimeoutL();
} // CSmsMessageSend::ConstructL
Esempio n. 20
0
std::shared_ptr<api::StorageCommand>
BouncerTest::createDummyFeedMessage(api::Timestamp timestamp,
                                    document::BucketSpace bucketSpace)
{
    auto cmd = std::make_shared<api::RemoveCommand>(
            document::Bucket(bucketSpace, document::BucketId(0)),
            document::DocumentId("doc:foo:bar"),
            timestamp);
    cmd->setPriority(Priority(0));
    return cmd;
}
Esempio n. 21
0
Activity_Data::Activity_Data (int traveler, int activity) : 
	Class2_Index (traveler, activity), Static_Scale ()
{
	Purpose (0);
	Priority (0);
	Start_Time (0);
	End_Time (0);
	Duration (0);
	Mode (0);
	Vehicle (0);
	Location (0);
	Passengers (0);
	Constraint (0);
}
Esempio n. 22
0
QString TSPacket::toString() const {
    QString str;
    str.append("TSPacket @0x%1  ").arg(long(&data()[0]),0,16);
    str.append("raw: 0x%1 0x%2 0x%3 0x%4\n").arg(int(data()[0]),0,16).
        arg(int(data()[1]),0,16).arg(int(data()[2]),0,16).arg(int(data()[3]),0,16);
    str.append("                 inSync: %1\n").arg( HasSync());
    str.append("         transportError: %1\n").arg( TransportError());
    str.append("           payloadStart: %1\n").arg( PayloadStart() );
    str.append("               priority: %1\n").arg( Priority() );
    str.append("                    pid: %1\n").arg( PID() );
    str.append("              scrampled: %1\n").arg( ScramplingControl() );
    str.append(" adaptationFieldControl: %1\n").arg( AdaptationFieldControl() );
    str.append("      continuityCounter: %1\n").arg( ContinuityCounter() );
    return str;
}
// ---------------------------------------------------------------------------
// CUpnpTcpSessionWriter::RunL
// From class CActive
// Function called when issued writing is completed. Function checks if there
// are any write requests left to send and if there are then it issues writing.
// If queue is empty then function informs upper layer that writing is completed.
// ---------------------------------------------------------------------------
//
void CUpnpTcpSessionWriter::RunL()
    {
    LOGS2( "%i, CUpnpTcpSessionWriter::RunL(), iStatus %i", 
    		iSession.Id() , iStatus.Int() );
    
    // Active object request complete handler
    if ( iStatus == KErrNone )
        {
        switch( iState )
            {
            // Character has been written to socket
            case EWriting:
                
                if (Priority() == iInitialPriority)       
                    SetPriority( iInitialPriority + 5);       
                else 
                    SetPriority( iInitialPriority); 
                
                // Change state because write request is finished already
                iState = EWaiting;
                if( HasWriteRequestsToSend() )
                    SendNextWriteRequestL();
                else
                    iSession.WritingCompletedL();
                break;
            
            default:
                LOGS2( "%i, PANIC: CUpnpTcpSessionWriter::RunL, %i",
                		iSession.Id() , iState );
                User::Panic( _L("Writer::RunL"), iState );
                break;
            };
        }
    else
        {
			if( iState == EWriting && (iStatus.Int() == KErrNoMemory || iStatus.Int() == KErrNotReady ) )
			{
				iRetryWrite->IssueWriteRetry();
       		}
        else
	        {

				// Error: pass it up to session
				iState = EWaiting;
				iSession.HandleErrorL( iStatus.Int() );
			}
        }
    }
Esempio n. 24
0
void Make_priorityQ(int* A,struct qcell** B,struct qcell** Q)
{
	int count = 0;
	int i = 0;
	int j = 0;

	for(i=0;i<54;i++)
	{
		if(A[i] != 0)
		{
			if(i>=0 && i<=25)
			{
				B[j] = (struct qcell*)malloc(sizeof(struct qcell));
				Q[j] = (struct qcell*)malloc(sizeof(struct qcell));
				B[j]->ch = (char)(i+65);
				B[j]->freq = A[i];
			}
			else if(i>=26 && i<=51)
			{
				B[j] = (struct qcell*)malloc(sizeof(struct qcell));
				Q[j] = (struct qcell*)malloc(sizeof(struct qcell));
				B[j]->ch = (char)(i+97-26);
				B[j]->freq = A[i];
			}
			else
			{
				if(i==52)
				{
					B[j] = (struct qcell*)malloc(sizeof(struct qcell));
					Q[j] = (struct qcell*)malloc(sizeof(struct qcell));
					B[j]->ch = (char)(46);
					B[j]->freq = A[i];
				}
				else
				{
					B[j] = (struct qcell*)malloc(sizeof(struct qcell));
					Q[j] = (struct qcell*)malloc(sizeof(struct qcell));
					B[j]->ch = (char)(32);
					B[j]->freq = A[i];
				}
			}
			j++;
			count++;
		}
	}

	Priority(B,Q,count);
}
EXPORT_C void CMemSpyEngineActiveObject::OutputDataL( CMemSpyEngine& aEngine ) const
    {
    _LIT(KMemSpyEngineAOOutputHex, "0x%08x");
    _LIT(KMemSpyEngineAOOutputDecimal, "%d");
    _LIT(KMemSpyEngineAOOutputDecimalFixed10, "%10d");
    _LIT(KMemSpyEngineAOOutputString, "%S");
    _LIT(KMemSpyEngineAOOutputVTable, "vTable: 0x%08x");
    //
    TPtrC yesNoValue( KNullDesC );
    HBufC* columns = HBufC::NewLC( 1024 );
    TPtr pColumns( columns->Des() );
    //
    pColumns.AppendFormat( KMemSpyEngineAOOutputHex, Address() );
    pColumns.Append( KMemSpyEngineAOOutputComma );
    //
    pColumns.AppendFormat( KMemSpyEngineAOOutputDecimal, Priority() );
    pColumns.Append( KMemSpyEngineAOOutputComma );
    //
    yesNoValue.Set( YesNoValue( IsActive() ) );
    pColumns.AppendFormat( KMemSpyEngineAOOutputString, &yesNoValue );
    pColumns.Append( KMemSpyEngineAOOutputComma );
    //
    yesNoValue.Set( YesNoValue( RequestIsPending() ) );
    pColumns.AppendFormat( KMemSpyEngineAOOutputString, &yesNoValue );
    pColumns.Append( KMemSpyEngineAOOutputComma );
    //
    pColumns.AppendFormat( KMemSpyEngineAOOutputDecimalFixed10, RequestStatusValue() );
    pColumns.Append( KMemSpyEngineAOOutputComma );
    //
    pColumns.AppendFormat( KMemSpyEngineAOOutputDecimal, RequestStatusFlags() );
    pColumns.Append( KMemSpyEngineAOOutputComma );
    //
    pColumns.AppendFormat( KMemSpyEngineAOOutputHex, VTable() );
    pColumns.Append( KMemSpyEngineAOOutputComma );
    //
    pColumns.AppendFormat( KMemSpyEngineAOOutputVTable, VTable() );
    //
    aEngine.Sink().OutputLineL( pColumns );
    CleanupStack::PopAndDestroy( columns );
    }
Esempio n. 26
0
void Translate()  /*将中缀表达式infix转换成后缀表达式postfix*/
{
	int St[MAXSTACK];int top=-1;		/*定义栈及栈指针*/
	int h,h1;
	Kind_type type;
	postlength=-1;
	inlength=-1;
	int endright;	/*取1或0.1:表示一个运算符处理完毕(需考虑优先级)*/
	do
	{
		GetToken(h);
		switch(type=Kind(h))
		{
		case OPERAND:	/*为运算符,直接添加到postfix中*/
			PutToken1(h);
			break;
		case LEFTPAREN:	/*为"(",将其进栈*/
			top++;
			St[top]=h;
			break;
		case RIGHTPAREN:	/*为")",出栈运算符添加到postfix中直到遇到"("*/
			h=St[top];top--;
			while (top>-1 && Kind(h)!=LEFTPAREN)
			{
				PutToken1(h);
				h=St[top];top--;
			}
			break;
		case UNARYOP:		/*为一元或二元运算符*/
		case BINARYOP:
			endright=0;
			do
			{
				if (top==-1)	/*栈空*/
					endright=1;
				else if (Kind(St[top])==LEFTPAREN)
					endright=1;
				else if (Priority(St[top])<Priority(h))
					endright=1;
				else if (Priority(St[top])==Priority(h) && Priority(h)==MAXPRIORITY)
					endright=1;
				else
				{
					h1=h;		/*将当前h放在当前高优先运算符的后面*/
					endright=0;
					h=St[top];top--;
					PutToken1(h);
					h=h1;
				}
			} while (endright==0);
			top++;St[top]=h;
			break;
		case ENDEXPR:
			while (top>-1)
			{
				h=St[top];top--;
				PutToken1(h);
			}
			break;
		}
	} while (type!=ENDEXPR);
	PutToken1(0);	/*在postfix中添加ENDEXPR*/
}
Esempio n. 27
0
cHookManager::cHookManager(int CardNum)
:cAction("hookmanager",CardNum)
{
  cardNum=CardNum;
  Priority(10);
}
Esempio n. 28
0
Thread::PriorityType Priority()
{
	Thread::Id id(taskIdSelf());
	return Priority(&id);
}
Esempio n. 29
0
/**
 *  Creates instances to the classes CSmsTimeout and CSmsStoreRead
 */
void CSmsPhoneEnumeration::ConstructL(CFacadeSmsReassemblyStore& aReassemblyStore,CSmsSegmentationStore& aSegmentationStore,CSmsMonitorDiskSpace& aSmsMonitorDiskSpace)
	{
	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPHONEENUMERATION_CONSTRUCTL_1, "CSmsPhoneEnumeration::ConstructL()");

	iSmsStoreRead = CSmsStoreRead::NewL(iSmsComm, iSmsSettings, iSmsMessaging, aReassemblyStore, aSegmentationStore, Priority(), aSmsMonitorDiskSpace);
	ConstructTimeoutL();
	} // CSmsPhoneEnumeration::ConstructL
Esempio n. 30
0
Thread::Priority Thread::getPriority() const
{
	return Priority(getPriorityImpl());
}