本文整理汇总了C++中Task::addRequest方法的典型用法代码示例。如果您正苦于以下问题:C++ Task::addRequest方法的具体用法?C++ Task::addRequest怎么用?C++ Task::addRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::addRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: oneTask
void ProjectTester::oneTask()
{
QDate today = QDate::fromString( "2012-02-01", Qt::ISODate );
QDate tomorrow = today.addDays( 1 );
QDate yesterday = today.addDays( -1 );
QTime t1( 9, 0, 0 );
QTime t2 ( 17, 0, 0 );
int length = t1.msecsTo( t2 );
Task *t = m_project->createTask();
t->setName( "T1" );
m_project->addTask( t, m_project );
t->estimate()->setUnit( Duration::Unit_d );
t->estimate()->setExpectedEstimate( 1.0 );
t->estimate()->setType( Estimate::Type_Duration );
ScheduleManager *sm = m_project->createScheduleManager( "Test Plan" );
m_project->addScheduleManager( sm );
QString s = "Calculate forward, Task: Fixed duration ------------------------------";
qDebug()<<s;
{
KPlatoRCPSPlugin rcps( 0, QVariantList() );
rcps.calculate( *m_project, sm, true/*nothread*/ );
}
Debug::printSchedulingLog( *sm, s );
Debug::print( m_project, s );
Debug::print( t, s );
QCOMPARE( t->startTime(), m_project->startTime() );
QCOMPARE( t->endTime(), DateTime(t->startTime().addDays( 1 )) );
s = "Calculate forward, Task: Length --------------------------------------";
qDebug()<<s;
t->estimate()->setCalendar( m_calendar );
{
KPlatoRCPSPlugin rcps( 0, QVariantList() );
rcps.calculate( *m_project, sm, true/*nothread*/ );
}
Debug::print( m_calendar, s );
Debug::print( m_project, s, true );
QCOMPARE( t->startTime(), m_calendar->firstAvailableAfter( m_project->startTime(), m_project->endTime() ) );
QCOMPARE( t->endTime(), DateTime( t->startTime().addMSecs( length ) ) );
s = "Calculate forward, Task: Effort --------------------------------------";
qDebug()<<s;
ResourceGroup *g = new ResourceGroup();
m_project->addResourceGroup( g );
Resource *r = new Resource();
r->setAvailableFrom( QDateTime( yesterday, QTime(), Qt::LocalTime ) );
r->setCalendar( m_calendar );
m_project->addResource( g, r );
ResourceGroupRequest *gr = new ResourceGroupRequest( g );
t->addRequest( gr );
ResourceRequest *rr = new ResourceRequest( r, 100 );
gr->addResourceRequest( rr );
t->estimate()->setType( Estimate::Type_Effort );
{
KPlatoRCPSPlugin rcps( 0, QVariantList() );
rcps.calculate( *m_project, sm, true/*nothread*/ );
}
Debug::print( t, s );
QCOMPARE( t->startTime(), m_calendar->firstAvailableAfter( m_project->startTime(), m_project->endTime() ) );
QCOMPARE( t->endTime(), DateTime( t->startTime().addMSecs( length ) ) );
s = "Calculate forward, Task: MustStartOn --------------------------------------";
qDebug()<<s;
t->setConstraint( Node::MustStartOn );
t->setConstraintStartTime( DateTime( tomorrow, t1 ) );
{
KPlatoRCPSPlugin rcps( 0, QVariantList() );
rcps.calculate( *m_project, sm, true/*nothread*/ );
}
Debug::print( t, s );
QCOMPARE( t->startTime(), t->constraintStartTime() );
QCOMPARE( t->endTime(), t->startTime() + Duration( 0, 8, 0 ) );
s = "Calculate backward, Task: MustStartOn --------------------------------------";
qDebug()<<s;
sm->setSchedulingDirection( true );
{
KPlatoRCPSPlugin rcps( 0, QVariantList() );
//.........这里部分代码省略.........