本文整理汇总了C++中SPELLipcMessage类的典型用法代码示例。如果您正苦于以下问题:C++ SPELLipcMessage类的具体用法?C++ SPELLipcMessage怎么用?C++ SPELLipcMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SPELLipcMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: run
//=============================================================================
// METHOD: SPELLipcIncomingRequest:run
//=============================================================================
void SPELLipcIncomingRequest::run()
{
std::string senderId = m_message->getSender();
std::string receiverId = m_message->getReceiver();
// If the request has been canceled beforehand
if (m_cancel) return;
SPELLipcMessage* response = m_listener->processRequest(m_message);
if (response && !m_cancel)
{
response->setSender(receiverId);
response->setReceiver(senderId);
// Do not set sequence number if it is already set.
// This happens when forwarding requests.
if (response->getSequence() == -1)
{
response->setSequence( m_message->getSequence() );
}
try
{
if (m_interface->isConnected())
{
SPELLipcOutput& writer = m_interface->getWriter(m_message->getKey());
writer.send(response);
m_interface->endRequest( getThreadId() );
}
}
catch(...) {};
delete response;
}
finish();
delete m_message;
}
开发者ID:seciltabur,项目名称:spell-sat,代码行数:35,代码来源:SPELLipcIncoming.C
示例2: DEBUG
//=============================================================================
// METHOD: SPELLipcMessageMailbox::retrieve
//=============================================================================
SPELLipcMessage SPELLipcMessageMailbox::retrieve( std::string id, unsigned long timeoutMsec )
{
DEBUG(NAME + "Retrieve response with id " + id)
SPELLipcMessageQueue* queue = getQueue(id);
SPELLipcMessage msg = VOID_MESSAGE;
try
{
if (timeoutMsec == 0)
{
msg = queue->pull();
}
else
{
msg = queue->pull(timeoutMsec);
}
remove(id);
}
catch( SPELLqueueTimeout& timeout )
{
//remove(id);
// Re-throw the exception
throw SPELLipcError(NAME + "Response timed out (limit " + ISTR(timeoutMsec) + " msec.)", (SPELLerrorCode) IPC_ERROR_TIMEOUT_ECODE);
}
DEBUG(NAME + "Retrieve message with id " + id + " done: " + msg.getSequenceStr());
return msg;
}
开发者ID:unnch,项目名称:spell-sat,代码行数:30,代码来源:SPELLipcMessageMailbox.C
示例3: STRI
//=============================================================================
// METHOD: SPELLlistenerContext::onNewContext
//=============================================================================
void SPELLlistenerContext::onNewContext( const SPELLipcMessage& msg )
{
ContextInfo* ctxInfo;
std::string ctxName = msg.get(MessageField::FIELD_CTX_NAME);
ctxInfo = &m_openContexts[ctxName];
ctxInfo->m_key = msg.getKey();
ctxInfo->m_port = STRI(msg.get(MessageField::FIELD_CTX_PORT));
ctxInfo->m_status = MessageValue::DATA_CTX_RUNNING;
DEBUG("New context:");
DEBUG("- Name=" + ctxInfo->m_name);
DEBUG("- Key=" + ISTR(ctxInfo->m_key));
DEBUG("- Port=" + ISTR(ctxInfo->m_port));
DEBUG("- Status=" + ctxInfo->m_status);
m_waitForContextStart.set();
// Notify to other clients
SPELLipcMessage notify( msg );
notify.setId( ListenerMessages::MSG_CONTEXT_OP );
notify.setType( MSG_TYPE_ONEWAY );
notify.set( MessageField::FIELD_CTX_STATUS, MessageValue::DATA_CTX_RUNNING );
notify.setSender("LST");
notify.setReceiver("GUI");
m_gui->displace(¬ify);
// Send notification to peer if any, and if alignment is enabled
if (m_peer) m_peer->displace(msg);
}
开发者ID:seciltabur,项目名称:spell-sat,代码行数:34,代码来源:SPELLlistenerContext.C
示例4: sendRequestToClient
//=============================================================================
// METHOD: SPELLclient::
//=============================================================================
SPELLipcMessage SPELLclient::sendRequestToClient( const SPELLipcMessage& msg )
{
TICK_IN;
SPELLipcMessage result = VOID_MESSAGE;
DEBUG( NAME + "Send request to client: " + msg.dataStr() );
result = m_clientIPC.sendRequest( getClientKey(), msg, m_ipcTimeoutGuiRequestMsec );
DEBUG( NAME + "Response for request to client: " + result.dataStr() );
TICK_OUT;
return result;
}
开发者ID:unnch,项目名称:spell-sat,代码行数:13,代码来源:SPELLclient.C
示例5: SPELLipcMessage
//=============================================================================
// METHOD: SPELLipcMessageMailbox::cancelAll()
//=============================================================================
void SPELLipcMessageMailbox::cancelAll()
{
SPELLipcMessageQueueMap::iterator mit;
for( mit = m_queueMap.begin(); mit != m_queueMap.end(); mit++)
{
SPELLipcMessage* dummyResponse = new SPELLipcMessage("dummy");
dummyResponse->setType( MSG_TYPE_RESPONSE );
SPELLipcMessageQueue* queue = (*mit).second;
queue->push(dummyResponse);
}
}
开发者ID:unnch,项目名称:spell-sat,代码行数:14,代码来源:SPELLipcMessageMailbox.C
示例6: ISTR
//=============================================================================
// METHOD: SPELLlistenerContext::startContext
//=============================================================================
SPELLipcMessage SPELLlistenerContext::startContext( const SPELLipcMessage& msg )
{
std::string cmd;
std::string name;
name = msg.get(MessageField::FIELD_CTX_NAME);
cmd = SPELLutils::getSPELL_HOME() + PATH_SEPARATOR + "bin" + PATH_SEPARATOR
+ "SPELL-Context -n " + name + " -s " + ISTR(m_port)
+ " -c " + m_configFile;
DEBUG("Opening context using command: " + cmd);
std::string identifier = "CTX_" + name;
// Will have no effect if the listener is there already
SPELLprocessManager::instance().addListener("CTX_" + name, this);
// Clear process information, in case it is there already
SPELLprocessManager::instance().clearProcess(identifier);
// Register and start the process
SPELLprocessManager::instance().startProcess("CTX_" + name, cmd);
// Notify to other clients
SPELLipcMessage notify( msg );
notify.setId( ListenerMessages::MSG_CONTEXT_OP );
notify.setType( MSG_TYPE_ONEWAY );
notify.set( MessageField::FIELD_CTX_STATUS, MessageValue::DATA_CTX_STARTING );
notify.setSender("LST");
notify.setReceiver("GUI");
m_gui->displace(¬ify);
DEBUG("Wait context " + name + " login");
m_waitForContextStart.clear();
bool timeout = m_waitForContextStart.wait(15*1000);
DEBUG("Wait context " + name + " login done: timeout " + BSTR(timeout));
if (timeout)
{
SPELLipcMessage resp = SPELLipcHelper::createErrorResponse(ContextMessages::RSP_OPEN_CTX, msg);
resp.set( MessageField::FIELD_FATAL, PythonConstants::True);
resp.set( MessageField::FIELD_ERROR, "Cannot open context " + name);
resp.set( MessageField::FIELD_REASON, "Context did not log in in time");
return resp;
}
else
{
LOG_INFO("Context running");
return SPELLipcHelper::createResponse(ContextMessages::RSP_OPEN_CTX, msg);
}
}
开发者ID:seciltabur,项目名称:spell-sat,代码行数:54,代码来源:SPELLlistenerContext.C
示例7: DEBUG
//=============================================================================
// METHOD: SPELLclientIPC::
//=============================================================================
SPELLipcMessage SPELLclientIPC::processRequest( const SPELLipcMessage& msg )
{
int clientKey = msg.getKey();
DEBUG("[CLTRCV] Received request from client: " + msg.getId());
SPELLipcMessage resp = VOID_MESSAGE;
SPELLclientInterestList* list = getClientInterestList(clientKey);
// If the message is a login message, redirect it to the client manager
if (msg.getId() == ContextMessages::REQ_GUI_LOGIN)
{
SPELLclientManager::instance().clientLogin(clientKey, msg.get( MessageField::FIELD_HOST ));
resp = SPELLipcHelper::createResponse(ContextMessages::RSP_GUI_LOGIN, msg);
}
// If the message is a logout message, redirect it to the client manager
else if (msg.getId() == ContextMessages::REQ_GUI_LOGOUT )
{
// No need to close IPC here. When the GUI receives the response,
// it will close the channel by sending EOC. There, IPC layer will
// automatically close the corresponding channel.
SPELLclientManager::instance().clientLogout(clientKey);
resp = SPELLipcHelper::createResponse(ContextMessages::RSP_GUI_LOGOUT, msg);
}
else if (list != NULL)
{
//DEBUG("[CLTRCV] Distribute client request: " + msg.getId());
resp = list->distributeRequest(msg);
//DEBUG("[CLTRCV] Got response for client request: " + msg.getId());
// Executor request additional processing (request attended by executor that need to be processed in context also)
// But only if the response is not an error
if (resp.getType() != MSG_TYPE_ERROR)
{
if (msg.getId() == ExecutorMessages::REQ_SET_CONFIG)
{
SPELLipcMessage cfgChange( msg );
cfgChange.setId( ContextMessages::MSG_EXEC_CONFIG );
cfgChange.setType( MSG_TYPE_ONEWAY );
SPELLclientManager::instance().notifyMonitoringClients(&cfgChange);
}
}
if (resp.isVoid())
{
LOG_ERROR("Unable to get response for client request " + msg.getId());
}
}
else
{
LOG_ERROR("No listeners for client " + ISTR(clientKey) + " to distribute request: " + msg.getId());
}
return resp;
}
开发者ID:unnch,项目名称:spell-sat,代码行数:54,代码来源:SPELLclientIPC.C
示例8: SPELLipcMessage
//=============================================================================
// METHOD: SPELLipcMessageMailbox::cancel()
//=============================================================================
void SPELLipcMessageMailbox::cancel( std::string id )
{
SPELLipcMessageQueueMap::iterator mit;
for( mit = m_queueMap.begin(); mit != m_queueMap.end(); mit++)
{
if (mit->first == id)
{
SPELLipcMessage* dummyResponse = new SPELLipcMessage("dummy");
dummyResponse->setType( MSG_TYPE_RESPONSE );
SPELLipcMessageQueue* queue = mit->second;
queue->push(dummyResponse);
break;
}
}
}
开发者ID:seciltabur,项目名称:spell-sat,代码行数:18,代码来源:SPELLipcMessageMailbox.C
示例9: toSend
//=============================================================================
// METHOD: SPELLexecutorIPC::
//=============================================================================
SPELLipcMessage SPELLexecutorIPC::sendRequest( const std::string& executorId, const SPELLipcMessage& msg, unsigned long timeoutMsec )
{
if (m_connected)
{
SPELLipcMessage toSend(msg);
return m_ipc.sendRequest(toSend,timeoutMsec);
}
else
{
SPELLipcMessage resp = SPELLipcHelper::createErrorResponse("IpcErrorResponse", msg);
resp.set( MessageField::FIELD_ERROR, "Cannot send request" );
resp.set( MessageField::FIELD_REASON, "IPC not connected");
resp.set( MessageField::FIELD_FATAL, PythonConstants::True );
return resp;
}
}
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:19,代码来源:SPELLexecutorIPC.C
示例10: processRequest
SPELLipcMessage* processRequest( SPELLipcMessage* msg )
{
SPELLipcMessage* resp = SPELLipcHelper::createResponse("dummy", msg);
try
{
std::cout << "request received from " << msg->getKey() << ": " << msg->get("NUM") << std::endl;
resp->setId("resp");
resp->setType(MSG_TYPE_RESPONSE);
resp->set("NUM", msg->get("NUM"));
usleep(200000);
}
catch(SPELLcoreException& ex)
{
std::cerr << "PROCESS ERROR: " << ex.what() << std::endl;
}
return resp;
};
开发者ID:seciltabur,项目名称:spell-sat,代码行数:17,代码来源:SPELLipcTestServer.C
示例11: processRequest
//=============================================================================
// METHOD: SPELLlistenerContext::processRequest
//=============================================================================
SPELLipcMessage SPELLlistenerContext::processRequest( const SPELLipcMessage& msg )
{
DEBUG("Got request: " + msg.getId());
// No request from context yet
return VOID_MESSAGE;
}
开发者ID:seciltabur,项目名称:spell-sat,代码行数:11,代码来源:SPELLlistenerContext.C
示例12: processMessage
//=============================================================================
// METHOD: SPELLlistenerContext::processMessage
//=============================================================================
void SPELLlistenerContext::processMessage( const SPELLipcMessage& msg )
{
DEBUG("Got message: " + msg.getId());
if (msg.getId() == ListenerMessages::MSG_CONTEXT_OPEN)
{
this->onNewContext(msg);
}
else if (msg.getId() == ListenerMessages::MSG_CONTEXT_CLOSED)
{
this->onClosedContext(msg);
}
else
{
LOG_ERROR("Unprocessed message: " + msg.getId())
}
}
开发者ID:seciltabur,项目名称:spell-sat,代码行数:20,代码来源:SPELLlistenerContext.C
示例13: attachContext
//=============================================================================
// METHOD: SPELLlistenerContext::attachContext
//=============================================================================
SPELLipcMessage SPELLlistenerContext::attachContext( const SPELLipcMessage& msg )
{
std::string name;
SPELLipcMessage res = SPELLipcHelper::createResponse(ContextMessages::RSP_ATTACH_CTX, msg);
name = msg.get(MessageField::FIELD_CTX_NAME);
this->fillContextInfo(name, res);
return res;
}
开发者ID:seciltabur,项目名称:spell-sat,代码行数:13,代码来源:SPELLlistenerContext.C
示例14: processMessage
//=============================================================================
// METHOD: SPELLclientIPC::
//=============================================================================
void SPELLclientIPC::processMessage( const SPELLipcMessage& msg )
{
// Get the peer key
int clientKey = msg.getKey();
SPELLclientInterestList* list = getClientInterestList(clientKey);
if (list != NULL)
{
list->distributeMessage(msg);
}
}
开发者ID:unnch,项目名称:spell-sat,代码行数:14,代码来源:SPELLclientIPC.C
示例15: processMessage
//=============================================================================
// METHOD: SPELLexecutorIPC::
//=============================================================================
void SPELLexecutorIPC::processMessage( const SPELLipcMessage& msg )
{
TICK_IN;
DEBUG("[EXCIPC] Received message from executor: " + msg.dataStr());
// Certain messages are for monitoring clients only
if ((msg.getId() != MessageId::MSG_ID_PROMPT_START)&&(msg.getId() != MessageId::MSG_ID_PROMPT_END))
{
DEBUG("[EXCIPC] Forward message to controller");
m_controller.processMessageFromExecutor(msg);
}
if (msg.getId() != ExecutorMessages::MSG_NOTIF_EXEC_CLOSE)
{
DEBUG("[EXCIPC] Forward message to monitoring clients");
notifyMessage(msg);
}
DEBUG("[EXCIPC] Message processed");
TICK_OUT;
}
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:23,代码来源:SPELLexecutorIPC.C
示例16: processMessageFromClient
//=============================================================================
// METHOD: SPELLclient::
//=============================================================================
void SPELLclient::processMessageFromClient( const SPELLipcMessage& msg )
{
std::string procId = msg.get( MessageField::FIELD_PROC_ID );
SPELLexecutor* exec = SPELLexecutorManager::instance().getExecutor(procId);
if (exec)
{
if (msg.getId() == ExecutorMessages::ACKNOWLEDGE)
{
if (exec->getControllingClient() != this)
{
return;
}
}
exec->sendMessageToExecutor(msg);
}
else
{
LOG_ERROR("Cannot send message, no suitable executor found");
}
}
开发者ID:unnch,项目名称:spell-sat,代码行数:23,代码来源:SPELLclient.C
示例17: completeMonitoringInfo
//=============================================================================
// METHOD: SPELLclientManager::
//=============================================================================
void SPELLclientManager::completeMonitoringInfo( const std::string& procId, SPELLipcMessage& msg )
{
std::list<std::string> monitoring = getMonitoringClients(procId);
std::list<std::string>::iterator it;
std::string monitoringList = "";
for( it = monitoring.begin(); it != monitoring.end(); it++)
{
if (monitoringList != "") monitoringList += ",";
monitoringList += (*it);
}
msg.set( MessageField::FIELD_GUI_LIST, monitoringList );
}
开发者ID:seciltabur,项目名称:spell-sat,代码行数:15,代码来源:SPELLclientManager.C
示例18: shouldForwardToMonitoring
//=============================================================================
// METHOD: SPELLexecutorIPC::processConnectionError
//=============================================================================
bool SPELLexecutorIPC::shouldForwardToMonitoring( const SPELLipcMessage& msg )
{
std::string requestId = msg.getId();
if (msg.getType() == MSG_TYPE_PROMPT)
{
return false;
}
if ( requestId == ContextMessages::REQ_OPEN_EXEC )
{
return false;
}
else if ( requestId == ContextMessages::REQ_INSTANCE_ID )
{
return false;
}
else if ( requestId == ContextMessages::REQ_EXEC_INFO )
{
return false;
}
else if ( requestId == ContextMessages::REQ_DEL_SHARED_DATA )
{
return false;
}
else if ( requestId == ContextMessages::REQ_SET_SHARED_DATA )
{
return false;
}
else if ( requestId == ContextMessages::REQ_GET_SHARED_DATA )
{
return false;
}
else if ( requestId == ContextMessages::REQ_GET_SHARED_DATA_KEYS )
{
return false;
}
return true;
}
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:41,代码来源:SPELLexecutorIPC.C
示例19: DEBUG
//=============================================================================
// METHOD: SPELLserverCif::openSubprocedure
//=============================================================================
std::string SPELLserverCif::openSubprocedure( const std::string& procId, const std::string& args, bool automatic, bool blocking, bool visible )
{
std::string openModeStr = "{";
DEBUG("[CIF] Open subprocedure options: " + BSTR(automatic) + "," + BSTR(blocking) + "," + BSTR(visible));
openModeStr += (automatic ? (LanguageModifiers::Automatic + ":" + PythonConstants::True) : (LanguageModifiers::Automatic + ":" + PythonConstants::False)) + ",";
openModeStr += (blocking ? (LanguageModifiers::Blocking + ":" + PythonConstants::True) : (LanguageModifiers::Blocking+ ":" + PythonConstants::False)) + ",";
openModeStr += (visible ? (LanguageModifiers::Visible + ":" + PythonConstants::True) : (LanguageModifiers::Visible + ":" + PythonConstants::False)) + "}";
std::string parent = SPELLexecutor::instance().getProcId();
// Request first an available instance number
SPELLipcMessage instanceMsg(ContextMessages::REQ_INSTANCE_ID);
instanceMsg.setType(MSG_TYPE_REQUEST);
instanceMsg.set(MessageField::FIELD_PROC_ID, procId);
SPELLipcMessage* response = sendCTXRequest( &instanceMsg, SPELL_CIF_CTXREQUEST_TIMEOUT_SEC );
std::string subprocId = "";
subprocId = response->get(MessageField::FIELD_INSTANCE_ID);
delete response;
DEBUG("[CIF] Request context to open subprocedure " + subprocId + " in mode " + openModeStr);
SPELLipcMessage openMsg(ContextMessages::REQ_OPEN_EXEC);
openMsg.setType(MSG_TYPE_REQUEST);
openMsg.set(MessageField::FIELD_PROC_ID, parent);
openMsg.set(MessageField::FIELD_SPROC_ID, subprocId);
openMsg.set(MessageField::FIELD_OPEN_MODE, openModeStr);
openMsg.set(MessageField::FIELD_ARGS, args);
response = sendCTXRequest( &openMsg, SPELL_CIF_OPENPROC_TIMEOUT_SEC );
delete response;
/** \todo failure handle */
return subprocId;
}
开发者ID:unnch,项目名称:spell-sat,代码行数:40,代码来源:SPELLserverCif.C
示例20: notifyMonitoringClients
//=============================================================================
// METHOD: SPELLclientManager::
//=============================================================================
void SPELLclientManager::notifyMonitoringClients( const SPELLipcMessage& msg )
{
DEBUG("Notify monitoring clients TRY-IN");
SPELLmonitor m(m_clientLock);
DEBUG("Notify monitoring clients IN");
ClientMap::const_iterator it;
int controllingKey = msg.getKey();
for( it = m_clientMap.begin(); it != m_clientMap.end(); it++ )
{
SPELLclient* client = it->second;
if (it->first == controllingKey) continue;
DEBUG(" - client " + ISTR(it->first));
client->sendMessageToClient(msg);
}
DEBUG("Notify monitoring clients done");
}
开发者ID:seciltabur,项目名称:spell-sat,代码行数:19,代码来源:SPELLclientManager.C
注:本文中的SPELLipcMessage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论