当前位置: 首页>>代码示例>>C++>>正文


C++ Activity类代码示例

本文整理汇总了C++中Activity的典型用法代码示例。如果您正苦于以下问题:C++ Activity类的具体用法?C++ Activity怎么用?C++ Activity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Activity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: externalTransition

        void externalTransition(
            const vle::devs::ExternalEventList& events,
            const vle::devs::Time& time)
        {
            vle::devs::ExternalEventList::const_iterator it = events.begin();

            while (it != events.end()) {
                if ((*it)->onPort("start")) {
                    if (mPhase == INIT) {
                        mActivities.starting(time);
                        if (mActivities.startingActivities().empty()) {
                            mPhase = WAIT;
                        } else {
                            mPhase = SEND;
                        }
                    }
                } else if ((*it)->onPort("done")) {
                    Activity* a = Activity::build(Activity::get(*it));

                    TraceModel(vle::fmt(" [%1%:%2%] at %3% -> %4% DONE") %
                               getModel().getParentName() % getModelName() %
                               time % a->name());

                    mDoneActivities.push_back(a);
                }
                ++it;
            }
            if (mSigma > 0) {
                mSigma -= (time - mLastTime);
                mLastTime = time;
            }
        }
开发者ID:devs-labs,项目名称:rcpsp,代码行数:32,代码来源:ActivityScheduler.cpp

示例2: rubricMapListIterator

/**
 * Method: GenerateGradeFile(QString _activityID)
 *
 * Description:
 *      Obtains the grades for all students in a course that is tied to the _activityID, obtains the grades for those
 *      students for that activity, and then stores each student grade file line in the returned QList<QString>
 *      (formatted for writing to a file using the CSVProcessor).
 *
 * Attributes:
 *      QString _activityID - the id of the activity to get grades for
 *
 * Author: Joshua Campbell
 *
 * Version: 1
 */
QList<QString> RubricItemGrade::GenerateGradeFile(QString _activityID) {
    Activity activityModel;
    QMap<QString, QString> activityMap = activityModel.GetActivityByID(_activityID);
    activityModel.SetParameters(activityMap);
    QList<QMap<QString, QString> > rubricMapList = activityModel.getRubric();
    QListIterator<QMap<QString, QString> > rubricMapListIterator(rubricMapList);
    Student s;
    QList<QString> studentList = s.getEnrolledStudentIDs(activityMap["courseID"]);
    QList<QString> gradeOutput;
    for (size_t i = 0; i < studentList.count(); i++) {
        std::ostringstream oss;
        oss << studentList[i].toStdString();
        while(rubricMapListIterator.hasNext()) {
            QMap<QString, QString> tempMap = rubricMapListIterator.next();
            QList<QMap<QString, QString> > itemGrades = GetGradesByItemID(tempMap["rubricItemID"]);
            QListIterator<QMap<QString, QString> > itemGradesIterator(itemGrades);
            while (itemGradesIterator.hasNext()) {
                QMap<QString, QString> tempItemGrade = itemGradesIterator.next();
                if (tempItemGrade["studentID"] == studentList[i]) {
                    oss << "," << tempItemGrade["mark"].toStdString();
                }
            }
        }
        oss << "\n";
        gradeOutput.push_back(oss.str().c_str());
    }
    return gradeOutput;
}
开发者ID:kptnkrnch,项目名称:CMPT-275---Final-Project,代码行数:43,代码来源:rubricitemgrade_model.cpp

示例3: QWidget

NoRubricActivitySelectionScreen::NoRubricActivitySelectionScreen(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::NoRubricActivitySelectionScreen)
{
    ui->setupUi(this);

    //QString currentCourseID = session->getCourseID();

    //DBAccess dba;
    Activity activityModel;

    rubriclessActivities = activityModel.getRubriclessByCourseID(session->getCourseID());


    //my ugly sql query to get activities without rubrics
    //QString sqlString = "SELECT DISTINCT activityID FROM Activity A, Rubric R WHERE R.courseID ='";
    //sqlString.append(currentCourseID);
    //sqlString.append("' AND A.activityID NOT IN(SELECT DISTINCT activityID FROM Rubric WHERE courseID = '");
    //sqlString.append(currentCourseID);
    //sqlString.append("')");

    //DEBUG(DEBUG_INFO, sqlString);

    //dba.__query(sqlString);
    //QSqlQuery rubriclessResults(sqlString);

    //DEBUG(DEBUG_INFO, rubriclessResults.value(0).toString());

    //add to the widget list the results
    int count = rubriclessActivities.count();
    for(int k=0; k<count; k++){
        ui->RubriclessActivityListWidget->addItem(rubriclessActivities[k]["activityName"]);
    }

}
开发者ID:kptnkrnch,项目名称:CMPT-275---Final-Project,代码行数:35,代码来源:norubricactivityselectionscreen.cpp

示例4: findActivity

/**
 * Attach an activity to an interpreter instance
 *
 * @param instance The interpreter instance involved.
 *
 * @return Either an existing activity, or a new activity created for
 *         this thread.
 */
Activity *ActivityManager::attachThread()
{
    // it's possible we already have an activity active for this thread.  That
    // most likely occurs in nested RexxStart() calls.
    Activity *oldActivity = findActivity();
    // we have an activity created for this thread already.  The interpreter instance
    // should already have handled the case of an attach for an already attached thread.
    // so we're going to have a new activity to create, and potentially an existing one to
    // suspend
    // we need to lock the kernel to have access to the memory manager to
    // create this activity.
    lockKernel();
    Activity *activityObject = createCurrentActivity();
    // Do we have a nested interpreter call occurring on the same thread?  We need to
    // mark the old activity as suspended, and chain this to the new activity.
    if (oldActivity != OREF_NULL)
    {
        oldActivity->setSuspended(true);
        // this pushes this down the stack.
        activityObject->setNestedActivity(oldActivity);
    }

    unlockKernel();                /* release kernel semaphore          */

    // now we need to have this activity become the kernel owner.
    activityObject->requestAccess();
    // this will help ensure that the code after the request access call
    // is only executed after access acquired.
    sentinel = true;
    // belt-and-braces.  Make sure the current activity is explicitly set to
    // this activity before leaving.
    currentActivity = activityObject;
    return activityObject;
}
开发者ID:KlemensEngel,项目名称:oorexxforandroid,代码行数:42,代码来源:ActivityManager.cpp

示例5: MojLogTrace

void ActivityManager::RunActivity(Activity& act)
{
	MojLogTrace(s_log);
	MojLogInfo(s_log, _T("Running [Activity %llu]"), act.GetId());

	m_resourceManager->Associate(act.shared_from_this());
	act.RunActivity();
}
开发者ID:martindbenoit,项目名称:activitymanager,代码行数:8,代码来源:ActivityManager.cpp

示例6: createNewActivity

/**
 * Clone off an activity from an existing activity.  Used for
 * message start() are early reply operations.
 *
 * @param parent The currently running activity.  The activity-specific settings are
 *               inherited from the parent.
 *
 * @return A new activity.
 */
Activity *ActivityManager::createNewActivity(Activity *parent)
{
    // create a new activity with the same priority as the parent
    Activity *activity = createNewActivity();
    // copy any needed settings from the parent
    activity->inheritSettings(parent);
    return activity;
}
开发者ID:KlemensEngel,项目名称:oorexxforandroid,代码行数:17,代码来源:ActivityManager.cpp

示例7: yieldCurrentActivity

/**
 * Signal an activation to yield control
 */
void ActivityManager::yieldCurrentActivity()
{
    ResourceSection lock;

    Activity *activity = ActivityManager::currentActivity;
    if (activity != OREF_NULL)
    {
        activity->yield();
    }
}
开发者ID:KlemensEngel,项目名称:oorexxforandroid,代码行数:13,代码来源:ActivityManager.cpp

示例8: while

/**
 * Clear the activty pool of pooled activities.
 */
void ActivityManager::clearActivityPool()
{
    Activity *activity = (Activity *)availableActivities->pull();
    while (activity != OREF_NULL)
    {
        // terminate this thread
        activity->terminatePoolActivity();
        activity = (Activity *)availableActivities->pull();
    }
}
开发者ID:KlemensEngel,项目名称:oorexxforandroid,代码行数:13,代码来源:ActivityManager.cpp

示例9: indexOfActivityId

void ActivityTableModel::durationChanged()
{
  Activity *activity = static_cast<Activity *>(QObject::sender());

  int row = indexOfActivityId(activity->id());
  if (row >= 0) {
    QModelIndex modelIndex = index(row, 6);
    emit dataChanged(modelIndex, modelIndex);
  }
}
开发者ID:anjinkristou,项目名称:hourglass-qt,代码行数:10,代码来源:activitytablemodel.cpp

示例10: parseError

void PromotionActivityGetResponse::parseNormalResponse() {
  parseError();
  if (responseParser->hasName("activitys")) {
  QList<Parser *> listParser = responseParser->getListObjectParser("activitys");
  Parser *parser;
  foreach (parser, listParser) {
    Activity tmp;
    tmp.setParser(parser);
    tmp.parseResponse();
    activitys.append(tmp);
  }
开发者ID:jdwx-new,项目名称:TaobaoCppQtSDK,代码行数:11,代码来源:PromotionActivityGetResponse.cpp

示例11: stopCurrentActivities

void MainWindow::startActivityLike(QSharedPointer<Activity> activity)
{
  Activity *newActivity = Activity::startLike(activity.data());
  if (newActivity != NULL) {
    stopCurrentActivities();
    newActivity->save();

    QSharedPointer<Activity> ptr = m_recordManager->addRecord(newActivity);
    emit activityCreated(ptr);
    refreshCompleterModels();
  }
}
开发者ID:anjinkristou,项目名称:hourglass-qt,代码行数:12,代码来源:mainwindow.cpp

示例12:

bool ActivityManager::ActivityNameComp::operator()(
	const Activity& act1, const Activity& act2) const
{
	const std::string& act1Name = act1.GetName();
	const std::string& act2Name = act2.GetName();

	if (act1Name != act2Name) {
		return act1Name < act2Name;
	} else {
		return act1.GetCreator() < act2.GetCreator();
	}
}
开发者ID:martindbenoit,项目名称:activitymanager,代码行数:12,代码来源:ActivityManager.cpp

示例13: AfxGetWorkPath

BOOL CCommonApp::InitActivity( LPCWSTR param1 )
{
	//throw std::exception("The method or operation is not implemented.");
	BOOL ret = FALSE;
	wstring path;
	AfxGetWorkPath(path);
	path += param1;

	TiXmlDocument	xmlDoc;
	ret = xmlDoc.LoadFile(StrHelp::WStringToString(path).c_str());
	if (!ret)
	{
		OutputDebugString(L"LoadFile error! \r\n");
		return FALSE;
	}

	TiXmlElement *root = xmlDoc.RootElement();
	if (strcmp(root->Value(), "manifest") != 0)
	{
		return FALSE;
	}
	
	TiXmlElement * element = root->FirstChildElement();
   
	string startAction;
	string startActiviy;
	while(element)
	{
		if (strcmp(element->Value(), "activity") != 0)
		{
			return FALSE;
		}
		TiXmlElement * action = element->FirstChildElement();
		if (action)
		{
			startAction = action->Attribute("name");
			startActiviy = element->Attribute("name");
			break;
		}
		element = element->NextSiblingElement();

	}
	if (startAction == "MAIN")
	{
		Activity * pAct = GXCreateControl::CreateAcitviyByType(startActiviy.c_str());
		AfxSetActiviy(pAct);
		pAct->onCreate();
		return TRUE;
	}
	
	return ret=FALSE;
}
开发者ID:Yinqingwen,项目名称:DemoWCE6_10.19B,代码行数:52,代码来源:CommonApp.cpp

示例14: if

void MainWindow::on_goToActivity_activated(const QString &arg1)
{
    MyRect * r = MyRect::m_selectedRect;

    if(!ui->goToActivity->currentIndex())
    {
        cout << "Setting MyRect with " << r->id() << " 0" << endl;
        r->setId(0);
        r->setGameType(GameType::NONE);
        ui->actPieceWidg->setHidden(true);
        r->setActPieceFilepath(QString("None"));
        if(!ui->graphicsView->actsAreInScene())
            ui->chooseRewardBadge->setEnabled(false);
        return;
    }
    QString actType = ui->goToActivity->currentText().section(QChar('-'), 0, 0);
    actType = actType.remove(QChar(' '));
    QString str = ui->goToActivity->currentText().section(QChar('-'), 1, 1);
    if(ui->graphicsView->rewardBadgeId())
        ui->actPieceWidg->setHidden(false);

    if(!r->id())
    {
        r->setActPieceFilepath(m_fileManager.errorImgFilepath());
        ui->actPieceImg->setPixmap(QPixmap(r->actPieceFilepath()).scaled(50, 50,
                                                                         Qt::KeepAspectRatioByExpanding,
                                                                         Qt::FastTransformation));
    }
    if(actType == QString("Pairing"))
    {
        r->setId(m_pairActs->id(str.remove(0, 1)));
        r->setGameType(GameType::PAIR);
    }
    else if(actType == QString("Matching"))
    {
        r->setId(m_matchActs->id(str.remove(0, 1)));
        r->setGameType(GameType::MATCHING);
        cout << "set matching" << endl;
    }
    if(r->id())
    {
        string actFileName = MyRect::m_selectedRect->actFileName().toStdString();
         Activity *act = new Activity(actFileName, NULL);
        act->load();
        ui->actPieceImg->setPixmap(QPixmap(QString::fromStdWString(act->m_badge_piece.m_image)).scaled(50, 50,
                                                                         Qt::KeepAspectRatioByExpanding,
                                                                         Qt::FastTransformation));
        r->setActPieceFilepath(QString::fromStdWString(act->m_badge_piece.m_image));
    }
    if(ui->graphicsView->actsAreInScene())
        ui->chooseRewardBadge->setEnabled(true);
}
开发者ID:spbond,项目名称:language-game,代码行数:52,代码来源:mainwindow.cpp

示例15: completeActivity

void completeActivity(std::string id, bool complete)
{
    Pdb db;
    Activity act = db.getActivity(id);
    
    if(act.getId() == 0)
    {
        //No activity found
        std::cerr << "No activity found for id: " << id << std::endl;
        exit(1);
    }
    
    act.complete(complete);
    act.persist();
}
开发者ID:p1r0,项目名称:pomodoro,代码行数:15,代码来源:main.cpp


注:本文中的Activity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。