00001 #include "OperationCallerInterface.hpp" 00002 #include "../internal/GlobalEngine.hpp" 00003 00004 using namespace RTT; 00005 using namespace base; 00006 using namespace internal; 00007 00008 OperationCallerInterface::OperationCallerInterface() 00009 : myengine(0), caller(0), met(ClientThread) 00010 {} 00011 00012 OperationCallerInterface::OperationCallerInterface(OperationCallerInterface const& orig) 00013 : myengine(orig.myengine), caller(orig.caller), met(orig.met) 00014 {} 00015 00016 OperationCallerInterface::~OperationCallerInterface() 00017 { 00018 } 00019 00020 void OperationCallerInterface::setOwner(ExecutionEngine* ee) { 00021 myengine = ee; 00022 } 00023 00024 void OperationCallerInterface::setCaller(ExecutionEngine* ee) { 00025 caller = ee; 00026 } 00027 00028 bool OperationCallerInterface::setThread(ExecutionThread et, ExecutionEngine* executor) { 00029 met = et; 00030 setOwner(executor); 00031 return true; 00032 } 00033 00034 ExecutionEngine* OperationCallerInterface::getMessageProcessor() const 00035 { 00036 ExecutionEngine* ret = (met == OwnThread ? myengine : GlobalEngine::Instance()); 00037 if (ret == 0 ) 00038 return GlobalEngine::Instance(); // best-effort for Operations not tied to an EE 00039 return ret; 00040 } 00041 00042 00043 // report an error if an exception was thrown while calling exec() 00044 void OperationCallerInterface::reportError() { 00045 // This localOperation was added to a TaskContext or to a Service owned by a TaskContext 00046 if (this->myengine != 0) 00047 this->myengine->setExceptionTask(); 00048 } 00049