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 if (ee) 00026 caller = ee; 00027 else 00028 caller = GlobalEngine::Instance(); 00029 } 00030 00031 bool OperationCallerInterface::setThread(ExecutionThread et, ExecutionEngine* executor) { 00032 met = et; 00033 setOwner(executor); 00034 return true; 00035 } 00036 00037 ExecutionEngine* OperationCallerInterface::getMessageProcessor() const 00038 { 00039 ExecutionEngine* ret = (met == OwnThread ? myengine : GlobalEngine::Instance()); 00040 if (ret == 0 ) 00041 return GlobalEngine::Instance(); // best-effort for Operations not tied to an EE 00042 return ret; 00043 } 00044 00045 00046 // report an error if an exception was thrown while calling exec() 00047 void OperationCallerInterface::reportError() { 00048 // This localOperation was added to a TaskContext or to a Service owned by a TaskContext 00049 if (this->myengine != 0) 00050 this->myengine->setExceptionTask(); 00051 } 00052