本文整理汇总了C++中std::string::setMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ string::setMessage方法的具体用法?C++ string::setMessage怎么用?C++ string::setMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::string
的用法示例。
在下文中一共展示了string::setMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: receiveMessageRaw
// This is the SLPlugin process (the child process).
// This is not part of a DSO.
//
// This function is called when the serialized message 'message' was received from the viewer.
// It parses the message and handles LLPLUGIN_MESSAGE_CLASS_INTERNAL.
// Other message classes are passed on to LLPluginInstance::sendMessage.
void LLPluginProcessChild::receiveMessageRaw(const std::string &message)
{
// Incoming message from the TCP Socket
LL_DEBUGS("Plugin") << "Received from parent: " << message << LL_ENDL;
// Decode this message
LLPluginMessage parsed;
parsed.parse(message);
if(mBlockingRequest)
{
// We're blocking the plugin waiting for a response.
if(parsed.hasValue("blocking_response"))
{
// This is the message we've been waiting for -- fall through and send it immediately.
mBlockingResponseReceived = true;
}
else
{
// Still waiting. Queue this message and don't process it yet.
mMessageQueue.push(message);
return;
}
}
bool passMessage = true;
// FIXME: how should we handle queueing here?
{
std::string message_class = parsed.getClass();
if(message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL)
{
passMessage = false;
std::string message_name = parsed.getName();
if(message_name == "load_plugin")
{
mPluginFile = parsed.getValue("file");
mPluginDir = parsed.getValue("dir");
}
else if(message_name == "shm_add")
{
std::string name = parsed.getValue("name");
size_t size = (size_t)parsed.getValueS32("size");
sharedMemoryRegionsType::iterator iter = mSharedMemoryRegions.find(name);
if(iter != mSharedMemoryRegions.end())
{
// Need to remove the old region first
LL_WARNS("Plugin") << "Adding a duplicate shared memory segment!" << LL_ENDL;
}
else
{
// This is a new region
LLPluginSharedMemory *region = new LLPluginSharedMemory;
if(region->attach(name, size))
{
mSharedMemoryRegions.insert(sharedMemoryRegionsType::value_type(name, region));
std::stringstream addr;
addr << region->getMappedAddress();
// Send the add notification to the plugin
LLPluginMessage message("base", "shm_added");
message.setValue("name", name);
message.setValueS32("size", (S32)size);
message.setValuePointer("address", region->getMappedAddress());
sendMessageToPlugin(message);
// and send the response to the parent
message.setMessage(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "shm_add_response");
message.setValue("name", name);
sendMessageToParent(message);
}
else
{
LL_WARNS("Plugin") << "Couldn't create a shared memory segment!" << LL_ENDL;
delete region;
}
}
}
else if(message_name == "shm_remove")
{
std::string name = parsed.getValue("name");
sharedMemoryRegionsType::iterator iter = mSharedMemoryRegions.find(name);
if(iter != mSharedMemoryRegions.end())
{
// forward the remove request to the plugin -- its response will trigger us to detach the segment.
LLPluginMessage message("base", "shm_remove");
message.setValue("name", name);
//.........这里部分代码省略.........