本文整理汇总了C++中ActionList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionList::begin方法的具体用法?C++ ActionList::begin怎么用?C++ ActionList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionList
的用法示例。
在下文中一共展示了ActionList::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateActionsState
void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
{
NetworkConstantAction *action = nullptr;
ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
; it != itend ; it=itNext) {
++itNext;
action = static_cast<NetworkConstantAction*>(&*it);
if (action->latency_ > 0) {
if (action->latency_ > delta) {
double_update(&(action->latency_), delta, sg_surf_precision);
} else {
action->latency_ = 0.0;
}
}
action->updateRemains(action->getCost() * delta / action->initialLatency_);
if (action->getMaxDuration() != NO_MAX_DURATION)
action->updateMaxDuration(delta);
if (action->getRemainsNoUpdate() <= 0) {
action->finish();
action->setState(Action::State::done);
} else if ((action->getMaxDuration() != NO_MAX_DURATION)
&& (action->getMaxDuration() <= 0)) {
action->finish();
action->setState(Action::State::done);
}
}
}
示例2: readActionsFile
RobotInterface::ActionList RobotInterface::XMLReader::Private::readActionsTag(TiXmlElement *actionsElem)
{
const std::string &valueStr = actionsElem->ValueStr();
if (valueStr.compare("actions") != 0) {
SYNTAX_ERROR(actionsElem->Row()) << "Expected \"actions\". Found" << valueStr;
}
std::string filename;
if (actionsElem->QueryStringAttribute("file", &filename) == TIXML_SUCCESS) {
// yDebug() << "Found actions file [" << filename << "]";
#ifdef WIN32
std::replace(filename.begin(), filename.end(), '/', '\\');
filename = path + "\\" + filename;
#else // WIN32
filename = path + "/" + filename;
#endif //WIN32
return readActionsFile(filename);
}
std::string robotName;
if (actionsElem->QueryStringAttribute("robot", &robotName) != TIXML_SUCCESS) {
SYNTAX_WARNING(actionsElem->Row()) << "\"actions\" element should contain the \"robot\" attribute";
}
if (robotName != robot.name()) {
SYNTAX_WARNING(actionsElem->Row()) << "Trying to import a file for the wrong robot. Found" << robotName << "instead of" << robot.name();
}
unsigned int build;
#if TINYXML_UNSIGNED_INT_BUG
if (actionsElem->QueryUnsignedAttribute("build", &build()) != TIXML_SUCCESS) {
// No build attribute. Assuming build="0"
SYNTAX_WARNING(actionsElem->Row()) << "\"actions\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
}
#else
int tmp;
if (actionsElem->QueryIntAttribute("build", &tmp) != TIXML_SUCCESS || tmp < 0) {
// No build attribute. Assuming build="0"
SYNTAX_WARNING(actionsElem->Row()) << "\"actions\" element should contain the \"build\" attribute [unsigned int]. Assuming 0";
tmp = 0;
}
build = (unsigned)tmp;
#endif
if (build != robot.build()) {
SYNTAX_WARNING(actionsElem->Row()) << "Import a file for a different robot build. Found" << build << "instead of" << robot.build();
}
ActionList actions;
for (TiXmlElement* childElem = actionsElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
ActionList childActions = readActions(childElem);
for (ActionList::const_iterator it = childActions.begin(); it != childActions.end(); ++it) {
actions.push_back(*it);
}
}
return actions;
}
示例3: apply_actions
void apply_actions(File const & f, ActionList & actions) {
auto it = actions.begin();
auto end = actions.end();
for (;it != end; ++it) {
(*it)(f);
}
}
示例4: getRunningActionSet
void StorageN11Model::updateActionsState(double /*now*/, double delta)
{
StorageAction *action = nullptr;
ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
; it != itend ; it=itNext) {
++itNext;
action = static_cast<StorageAction*>(&*it);
if(action->m_type == WRITE){
// Update the disk usage
// Update the file size
// For each action of type write
double current_progress =
delta * lmm_variable_getvalue(action->getVariable());
long int incr = current_progress;
XBT_DEBUG("%s:\n\t progress = %.2f, current_progress = %.2f, incr = %ld, lrint(1) = %ld, lrint(2) = %ld",
action->p_file->name,
action->progress, current_progress, incr,
lrint(action->progress + current_progress),
lrint(action->progress)+ incr);
/* take care of rounding error accumulation */
if (lrint(action->progress + current_progress) > lrint(action->progress)+ incr)
incr++;
action->progress +=current_progress;
action->p_storage->usedSize_ += incr; // disk usage
action->p_file->current_position+= incr; // current_position
// which becomes the new file size
action->p_file->size = action->p_file->current_position ;
sg_size_t *psize = xbt_new(sg_size_t,1);
*psize = action->p_file->size;
xbt_dict_t content_dict = action->p_storage->content_;
xbt_dict_set(content_dict, action->p_file->name, psize, nullptr);
}
action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta);
if (action->getMaxDuration() > NO_MAX_DURATION)
action->updateMaxDuration(delta);
if(action->getRemainsNoUpdate() > 0 && lmm_get_variable_weight(action->getVariable()) > 0 &&
action->p_storage->usedSize_ == action->p_storage->size_) {
action->finish();
action->setState(Action::State::failed);
} else if (((action->getRemainsNoUpdate() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) ||
((action->getMaxDuration() > NO_MAX_DURATION) && (action->getMaxDuration() <= 0))) {
action->finish();
action->setState(Action::State::done);
}
}
return;
}
示例5: QObject
ToolBarManager::ToolBarManager(QMainWindow *configureableMainWindow,
QWidget *parent,
QMenu *toolBarMenu,
const QDesignerActions *actions,
const QList<QToolBar *> &toolbars,
const QList<QDesignerToolWindow*> &toolWindows) :
QObject(parent),
m_configureableMainWindow(configureableMainWindow),
m_parent(parent),
m_toolBarMenu(toolBarMenu),
m_manager(new QtToolBarManager(this)),
m_configureAction(new QAction(tr("Configure Toolbars..."), this)),
m_toolbars(toolbars)
{
m_configureAction->setMenuRole(QAction::NoRole);
m_configureAction->setObjectName(QLatin1String("__qt_configure_tool_bars_action"));
connect(m_configureAction, SIGNAL(triggered()), this, SLOT(configureToolBars()));
m_manager->setMainWindow(configureableMainWindow);
foreach(QToolBar *tb, m_toolbars) {
const QString title = tb->windowTitle();
m_manager->addToolBar(tb, title);
addActionsToToolBarManager(tb->actions(), title, m_manager);
}
addActionsToToolBarManager(actions->windowActions()->actions(), tr("Window"), m_manager);
addActionsToToolBarManager(actions->helpActions()->actions(), tr("Help"), m_manager);
// Filter out the device profile preview actions which have int data().
ActionList previewActions = actions->styleActions()->actions();
ActionList::iterator it = previewActions.begin();
for ( ; (*it)->isSeparator() || (*it)->data().type() == QVariant::Int; ++it) ;
previewActions.erase(previewActions.begin(), it);
addActionsToToolBarManager(previewActions, tr("Style"), m_manager);
const QString dockTitle = tr("Dock views");
foreach (QDesignerToolWindow *tw, toolWindows) {
if (QAction *action = tw->action())
m_manager->addAction(action, dockTitle);
}
m_manager->addAction(m_configureAction, tr("Toolbars"));
updateToolBarMenu();
}
示例6: pushActionCallback
//ActionCallback World::pushActionCallback(){
void World::pushActionCallback(){
BoundingBox *box = character->getBoundingBox();
EntityList *elist = new EntityList();
int nEntities = currScene->getEntitiesInBox(box, elist);
for(EntityList::iterator i=elist->begin(); i!=elist->end(); i++){
ActionList actionList = (*i)->getActionList();
for(ActionList::iterator j = actionList.begin(); j!=actionList.end(); j++){
if((*j)->type == ACTION_PUSH){
(*j)->react();
}
}
}
}
示例7: pickupActionCallback
void World::pickupActionCallback(){
EntityList *elist = new EntityList();
BoundingBox *box = character->getFeetBoundingBox();
int nEntities = currScene->getEntitiesInBox(box, elist);
for(EntityList::iterator i=elist->begin(); i!=elist->end(); i++){
ActionList actionList = (*i)->getActionList();
for(ActionList::iterator j = actionList.begin(); j!=actionList.end(); j++){
if((*j)->type == ACTION_PICKUP && (*i)->getAttribute(ENTITY_PICKUPABLE)){
(*j)->react();
}
}
}
}
示例8: RemoveCommandFromList
bool CKeyBindings::RemoveCommandFromList(ActionList& al, const std::string& command)
{
bool success = false;
ActionList::iterator it = al.begin();
while (it != al.end()) {
if (it->command == command) {
it = al.erase(it);
success = true;
} else {
++it;
}
}
return success;
}
示例9: next_occuring_event
double NetworkConstantModel::next_occuring_event(double /*now*/)
{
NetworkConstantAction *action = nullptr;
double min = -1.0;
ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itend(actionSet->end())
; it != itend ; ++it) {
action = static_cast<NetworkConstantAction*>(&*it);
if (action->latency_ > 0 && (min < 0 || action->latency_ < min))
min = action->latency_;
}
return min;
}
示例10: updateActionsStateLazy
/*********
* Model *
*********/
void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
{
CpuAction *action;
while ((xbt_heap_size(getActionHeap()) > 0)
&& (double_equals(xbt_heap_maxkey(getActionHeap()), now, sg_surf_precision))) {
action = static_cast<CpuAction*>(xbt_heap_pop(getActionHeap()));
XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
if (TRACE_is_enabled()) {
Cpu *cpu = static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)));
TRACE_surf_host_set_utilization(cpu->getName(), action->getCategory(),
lmm_variable_getvalue(action->getVariable()),
action->getLastUpdate(),
now - action->getLastUpdate());
}
action->finish();
XBT_CDEBUG(surf_kernel, "Action %p finished", action);
/* set the remains to 0 due to precision problems when updating the remaining amount */
action->setRemains(0);
action->setState(SURF_ACTION_DONE);
action->heapRemove(getActionHeap()); //FIXME: strange call since action was already popped
}
if (TRACE_is_enabled()) {
//defining the last timestamp that we can safely dump to trace file
//without losing the event ascending order (considering all CPU's)
double smaller = -1;
ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itend(actionSet->end())
; it != itend ; ++it) {
action = static_cast<CpuAction*>(&*it);
if (smaller < 0) {
smaller = action->getLastUpdate();
continue;
}
if (action->getLastUpdate() < smaller) {
smaller = action->getLastUpdate();
}
}
if (smaller > 0) {
TRACE_last_timestamp_to_dump = smaller;
}
}
return;
}
示例11: next_occuring_event_full
double NetworkModel::next_occuring_event_full(double now)
{
NetworkAction *action = NULL;
ActionList *runningActions = surf_network_model->getRunningActionSet();
double minRes;
minRes = shareResourcesMaxMin(runningActions, surf_network_model->maxminSystem_, surf_network_model->f_networkSolve);
for(ActionList::iterator it(runningActions->begin()), itend(runningActions->end())
; it != itend ; ++it) {
action = static_cast<NetworkAction*>(&*it);
if (action->latency_ > 0) {
minRes = (minRes < 0) ? action->latency_ : std::min(minRes, action->latency_);
}
}
XBT_DEBUG("Min of share resources %f", minRes);
return minRes;
}
示例12: readActions
RobotInterface::Device RobotInterface::XMLReader::Private::readDeviceTag(TiXmlElement *deviceElem)
{
const std::string &valueStr = deviceElem->ValueStr();
if (valueStr.compare("device") != 0) {
SYNTAX_ERROR(deviceElem->Row()) << "Expected \"device\". Found" << valueStr;
}
Device device;
if (deviceElem->QueryStringAttribute("name", &device.name()) != TIXML_SUCCESS) {
SYNTAX_ERROR(deviceElem->Row()) << "\"device\" element should contain the \"name\" attribute";
}
// yDebug() << "Found device [" << device.name() << "]";
if (deviceElem->QueryStringAttribute("type", &device.type()) != TIXML_SUCCESS) {
SYNTAX_ERROR(deviceElem->Row()) << "\"device\" element should contain the \"type\" attribute";
}
device.params().push_back(Param("robotName", robot.portprefix().c_str()));
for (TiXmlElement* childElem = deviceElem->FirstChildElement(); childElem != 0; childElem = childElem->NextSiblingElement()) {
if (childElem->ValueStr().compare("action") == 0 ||
childElem->ValueStr().compare("actions") == 0) {
ActionList childActions = readActions(childElem);
for (ActionList::const_iterator it = childActions.begin(); it != childActions.end(); ++it) {
device.actions().push_back(*it);
}
} else {
ParamList childParams = readParams(childElem);
for (ParamList::const_iterator it = childParams.begin(); it != childParams.end(); ++it) {
device.params().push_back(*it);
}
}
}
// yDebug() << device;
return device;
}
示例13: constructMenu
bool ActionMenu::constructMenu(Entity *entity){
dprintf(("entered Interface::constructActionMenu()\n"));
if(!initialized) return false;
//destroyActionMenu(); // kill any old action menu
release();
ActionList actions = entity->getActionList();
if(actions.size() <= 0){
dprintf((" size <= 0\n"));
return false;
}
width = ACTION_BUTTON_WIDTH;
height = actions.size()*ACTION_BUTTON_HEIGHT;
if(!createOffScreenSurface(image, width, height )) return false;
//if(!createOffScreenSurface(image, ACTION_BUTTON_WIDTH,
//actions.size()*ACTION_BUTTON_HEIGHT)) return false;
if(image== NULL) dprintf((" surface == NULL\n"));
ActionList::iterator i;
int j;
for(j=0, i=actions.begin(); j<actions.size(); i++, j++){
//ActionType type = (*i)->getType();
ActionType type = (*i)->type;
int srcX = ((type%ACTION_BUTTON_FILE_COLUMNS)*(ACTION_BUTTON_WIDTH+1))+1;
int srcY = ((type/ACTION_BUTTON_FILE_ROWS)*(ACTION_BUTTON_HEIGHT+1))+1;
if(!bmp->drawRectTo(0, j*ACTION_BUTTON_HEIGHT, image, srcX, srcY,
ACTION_BUTTON_WIDTH, ACTION_BUTTON_HEIGHT)){
dprintf((" problem drawing action button %d, type: %d\n", j, type));
//destroyActionMenu();
return false;
}
}
actionReciever = entity;
return true;
}
示例14: doActions
void LabEngine::doActions(const ActionList &actionList) {
ActionList::const_iterator action;
for (action = actionList.begin(); action != actionList.end(); ++action) {
updateEvents();
if (_quitLab || shouldQuit())
return;
switch (action->_actionType) {
case kActionPlaySound:
_music->loadSoundEffect(action->_messages[0], false, true);
break;
case kActionPlaySoundNoWait: // only used in scene 7 (street, when teleporting to the surreal maze)
_music->loadSoundEffect(action->_messages[0], false, false);
break;
case kActionPlaySoundLooping:
_music->loadSoundEffect(action->_messages[0], true, false);
break;
case kActionShowDiff:
_graphics->readPict(action->_messages[0], true);
break;
case kActionShowDiffLooping: // used in scene 44 (heart of the labyrinth, minotaur)
_graphics->readPict(action->_messages[0], false);
break;
case kActionLoadDiff:
if (!action->_messages[0].empty())
// Puts a file into memory
_graphics->loadPict(action->_messages[0]);
break;
case kActionLoadBitmap:
error("Unused opcode kActionLoadBitmap has been called");
case kActionShowBitmap:
error("Unused opcode kActionShowBitmap has been called");
case kActionTransition:
_graphics->doTransition((TransitionType)action->_param1, action->_messages[0].c_str());
break;
case kActionNoUpdate:
_noUpdateDiff = true;
_anim->_doBlack = false;
break;
case kActionForceUpdate:
_curFileName = " ";
break;
case kActionShowCurPict: {
Common::String test = getPictName(true);
if (test != _curFileName) {
_curFileName = test;
_graphics->readPict(_curFileName);
}
}
break;
case kActionSetElement:
_conditions->inclElement(action->_param1);
break;
case kActionUnsetElement:
_conditions->exclElement(action->_param1);
break;
case kActionShowMessage:
if (_graphics->_longWinInFront)
_graphics->longDrawMessage(action->_messages[0], true);
else
_graphics->drawMessage(action->_messages[0], true);
break;
case kActionCShowMessage:
if (!_closeDataPtr)
_graphics->drawMessage(action->_messages[0], true);
break;
case kActionShowMessages:
_graphics->drawMessage(action->_messages[_utils->getRandom(action->_param1)], true);
break;
case kActionChangeRoom:
if (action->_param1 & 0x8000) {
// This is a Wyrmkeep Windows trial version, thus stop at this
// point, since we can't check for game payment status
_graphics->readPict(getPictName(true));
GUI::MessageDialog trialMessage("This is the end of the trial version. You can play the full game using the original interpreter from Wyrmkeep");
trialMessage.runModal();
break;
}
_music->checkRoomMusic(_roomNum, action->_param1);
_roomNum = action->_param1;
_direction = action->_param2 - 1;
//.........这里部分代码省略.........
示例15: BuildUniversalActions
void Driver::BuildUniversalActions(const ArgList &Args,
ActionList &Actions) const {
llvm::PrettyStackTraceString CrashInfo("Building actions for universal build");
// Collect the list of architectures. Duplicates are allowed, but
// should only be handled once (in the order seen).
llvm::StringSet<> ArchNames;
llvm::SmallVector<const char *, 4> Archs;
for (ArgList::const_iterator it = Args.begin(), ie = Args.end();
it != ie; ++it) {
Arg *A = *it;
if (A->getOption().getId() == options::OPT_arch) {
const char *Name = A->getValue(Args);
// FIXME: We need to handle canonicalization of the specified
// arch?
A->claim();
if (ArchNames.insert(Name))
Archs.push_back(Name);
}
}
// When there is no explicit arch for this platform, make sure we
// still bind the architecture (to the default) so that -Xarch_ is
// handled correctly.
if (!Archs.size())
Archs.push_back(0);
// FIXME: We killed off some others but these aren't yet detected in
// a functional manner. If we added information to jobs about which
// "auxiliary" files they wrote then we could detect the conflict
// these cause downstream.
if (Archs.size() > 1) {
// No recovery needed, the point of this is just to prevent
// overwriting the same files.
if (const Arg *A = Args.getLastArg(options::OPT_save_temps))
Diag(clang::diag::err_drv_invalid_opt_with_multiple_archs)
<< A->getAsString(Args);
}
ActionList SingleActions;
BuildActions(Args, SingleActions);
// Add in arch binding and lipo (if necessary) for every top level
// action.
for (unsigned i = 0, e = SingleActions.size(); i != e; ++i) {
Action *Act = SingleActions[i];
// Make sure we can lipo this kind of output. If not (and it is an
// actual output) then we disallow, since we can't create an
// output file with the right name without overwriting it. We
// could remove this oddity by just changing the output names to
// include the arch, which would also fix
// -save-temps. Compatibility wins for now.
if (Archs.size() > 1 && !types::canLipoType(Act->getType()))
Diag(clang::diag::err_drv_invalid_output_with_multiple_archs)
<< types::getTypeName(Act->getType());
ActionList Inputs;
for (unsigned i = 0, e = Archs.size(); i != e; ++i)
Inputs.push_back(new BindArchAction(Act, Archs[i]));
// Lipo if necessary, We do it this way because we need to set the
// arch flag so that -Xarch_ gets overwritten.
if (Inputs.size() == 1 || Act->getType() == types::TY_Nothing)
Actions.append(Inputs.begin(), Inputs.end());
else
Actions.push_back(new LipoJobAction(Inputs, Act->getType()));
}
}