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 @@ ...@@ -2,6 +2,7 @@
----- -----
* Added access to the output stream of an application. * Added access to the output stream of an application.
* Added Instance.getLastState() and Instance.getActualState() functions.
0.2.0 0.2.0
----- -----
......
...@@ -648,9 +648,30 @@ void Instance::cancelWaitFor() { ...@@ -648,9 +648,30 @@ void Instance::cancelWaitFor() {
} }
State Instance::now() { State Instance::now() {
// First implementation used getLastState().
return getActualState();
}
State Instance::getLastState() {
return waitFor(0, "", nullptr, false); 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) { bool Instance::getBinaryResult(std::string& result) {
waitFor(); waitFor();
......
...@@ -209,8 +209,22 @@ public: ...@@ -209,8 +209,22 @@ public:
void cancelWaitFor(); void cancelWaitFor();
/**
* Deprecated.
* TODO remove in next version.
*/
State now(); 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 getBinaryResult(std::string& result);
bool getResult(std::string& result); bool getResult(std::string& result);
bool getResult(std::vector<int32_t>& 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