[Orxonox-commit 2567] r7272 - code/branches/consolecommands3/src/libraries/core/command
landauf at orxonox.net
landauf at orxonox.net
Mon Aug 30 22:09:08 CEST 2010
Author: landauf
Date: 2010-08-30 22:09:08 +0200 (Mon, 30 Aug 2010)
New Revision: 7272
Modified:
code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.cc
code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.h
Log:
using object stack and function stack together works now
Modified: code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.cc
===================================================================
--- code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.cc 2010-08-30 18:07:38 UTC (rev 7271)
+++ code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.cc 2010-08-30 20:09:08 UTC (rev 7272)
@@ -162,6 +162,7 @@
if (!executor || !executor->getFunctor() || bForce || this->headersMatch(executor))
{
this->executor_ = executor;
+ this->objectStack_.clear();
return true;
}
else
@@ -179,6 +180,7 @@
this->executor_->setFunctor(functor);
else if (functor)
this->executor_ = createExecutor(functor);
+ this->objectStack_.clear();
return true;
}
@@ -195,6 +197,7 @@
command.executor_ = this->executor_;
if (command.executor_)
command.functor_ = this->executor_->getFunctor();
+ command.objectStack_ = this->objectStack_;
if (this->setFunction(executor, bForce))
this->commandStack_.push(command);
@@ -206,6 +209,7 @@
command.executor_ = this->executor_;
if (command.executor_)
command.functor_ = this->executor_->getFunctor();
+ command.objectStack_ = this->objectStack_;
if (this->setFunction(functor, bForce))
this->commandStack_.push(command);
@@ -231,12 +235,14 @@
this->executor_ = command.executor_;
if (command.executor_)
this->executor_->setFunctor(command.functor_);
+ this->objectStack_ = command.objectStack_;
}
void ConsoleCommand::resetFunction()
{
if (this->executor_)
this->executor_->setFunctor(0);
+ this->objectStack_.clear();
}
const ExecutorPtr& ConsoleCommand::getExecutor() const
@@ -266,7 +272,7 @@
{
void* oldobject = this->getObject();
if (this->setObject(object))
- this->objectStack_.push(oldobject);
+ this->objectStack_.push_back(oldobject);
}
void ConsoleCommand::popObject()
@@ -274,8 +280,8 @@
void* newobject = 0;
if (!this->objectStack_.empty())
{
- newobject = this->objectStack_.top();
- this->objectStack_.pop();
+ newobject = this->objectStack_.back();
+ this->objectStack_.pop_back();
}
this->setObject(newobject);
}
Modified: code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.h
===================================================================
--- code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.h 2010-08-30 18:07:38 UTC (rev 7271)
+++ code/branches/consolecommands3/src/libraries/core/command/ConsoleCommand.h 2010-08-30 20:09:08 UTC (rev 7272)
@@ -32,6 +32,7 @@
#include "core/CorePrereqs.h"
#include <stack>
+#include <vector>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/facilities/expand.hpp>
@@ -97,6 +98,7 @@
{
ExecutorPtr executor_;
FunctorPtr functor_;
+ std::vector<void*> objectStack_;
};
public:
@@ -316,7 +318,7 @@
ExecutorPtr executor_;
std::stack<Command> commandStack_;
- std::stack<void*> objectStack_;
+ std::vector<void*> objectStack_;
ArgumentCompleter* argumentCompleter_[5];
More information about the Orxonox-commit
mailing list