Commit fc458bf3 authored by legoc's avatar legoc
Browse files

Added Instance.getLastState() and Instance.getActualState() functions. Keeps version 0.2.1.

parent 690cc346
......@@ -2,6 +2,7 @@
-----
* Added access to the output stream of an application.
* Added Instance.getLastState() and Instance.getActualState() functions.
0.2.0
-----
......
......@@ -648,9 +648,30 @@ void Instance::cancelWaitFor() {
}
State Instance::now() {
// First implementation used getLastState().
return getActualState();
}
State Instance::getLastState() {
return waitFor(0, "", nullptr, false);
}
State Instance::getActualState() const {
vector<application::Info> infos = m_server->getApplicationInfos();
for (vector<application::Info>::const_iterator i = infos.begin(); i != infos.end(); ++i) {
application::Info const & info = *i;
if (info.getId() == m_id) {
return info.getState();
}
}
return UNKNOWN;
}
bool Instance::getBinaryResult(std::string& result) {
waitFor();
......
......@@ -209,8 +209,22 @@ public:
void cancelWaitFor();
/**
* Deprecated.
* TODO remove in next version.
*/
State now();
/**
* Gets the last state.
*/
State getLastState();
/**
* Returns the actual state and UNKNOWN if the instance does not exist anymore.
*/
State getActualState() const;
bool getBinaryResult(std::string& result);
bool getResult(std::string& result);
bool getResult(std::vector<int32_t>& result);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment