本文整理汇总了C++中LLPluginMessage::getValueS32方法的典型用法代码示例。如果您正苦于以下问题:C++ LLPluginMessage::getValueS32方法的具体用法?C++ LLPluginMessage::getValueS32怎么用?C++ LLPluginMessage::getValueS32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLPluginMessage
的用法示例。
在下文中一共展示了LLPluginMessage::getValueS32方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: receiveMessage
// This is the viewer process (the parent process).
//
// This function is called for messages that have to
// be written to the plugin.
// Note that LLPLUGIN_MESSAGE_CLASS_INTERNAL messages
// are not sent to the plugin, but are handled here.
void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message)
{
std::string message_class = message.getClass();
if(message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL)
{
// internal messages should be handled here
std::string message_name = message.getName();
if(message_name == "hello")
{
if(mState == STATE_CONNECTED)
{
// Plugin host has launched. Tell it which plugin to load.
setState(STATE_HELLO);
}
else
{
LL_WARNS("Plugin") << "received hello message in wrong state -- bailing out" << LL_ENDL;
errorState();
}
}
else if(message_name == "load_plugin_response")
{
if(mState == STATE_LOADING)
{
// Plugin has been loaded.
mPluginVersionString = message.getValue("plugin_version");
LL_INFOS("Plugin") << "plugin version string: " << mPluginVersionString << LL_ENDL;
// Check which message classes/versions the plugin supports.
// TODO: check against current versions
// TODO: kill plugin on major mismatches?
mMessageClassVersions = message.getValueLLSD("versions");
LLSD::map_iterator iter;
for(iter = mMessageClassVersions.beginMap(); iter != mMessageClassVersions.endMap(); iter++)
{
LL_INFOS("Plugin") << "message class: " << iter->first << " -> version: " << iter->second.asString() << LL_ENDL;
}
// Send initial sleep time
setSleepTime(mSleepTime, true);
setState(STATE_RUNNING);
}
else
{
LL_WARNS("Plugin") << "received load_plugin_response message in wrong state -- bailing out" << LL_ENDL;
errorState();
}
}
else if(message_name == "heartbeat")
{
// this resets our timer.
mHeartbeat.setTimerExpirySec(mPluginLockupTimeout);
mCPUUsage = message.getValueReal("cpu_usage");
LL_DEBUGS("PluginHeartbeat") << "cpu usage reported as " << mCPUUsage << LL_ENDL;
}
else if(message_name == "shutdown")
{
LL_INFOS("Plugin") << "received shutdown message" << LL_ENDL;
mReceivedShutdown = true;
mOwner->receivedShutdown();
}
else if(message_name == "shm_add_response")
{
// Nothing to do here.
}
else if(message_name == "shm_remove_response")
{
std::string name = message.getValue("name");
sharedMemoryRegionsType::iterator iter = mSharedMemoryRegions.find(name);
if(iter != mSharedMemoryRegions.end())
{
// destroy the shared memory region
iter->second->destroy();
// and remove it from our map
mSharedMemoryRegions.erase(iter);
}
}
else if(message_name == "log_message")
{
std::string msg=message.getValue("message");
S32 level=message.getValueS32("log_level");
switch(level)
{
case LLPluginMessage::LOG_LEVEL_DEBUG:
LL_DEBUGS("Plugin child")<<msg<<LL_ENDL;
break;
//.........这里部分代码省略.........
示例2: 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);
//.........这里部分代码省略.........
示例3: receivePluginMessage
/* virtual */
void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
{
std::string message_class = message.getClass();
if (message_class == LLPLUGIN_MESSAGE_CLASS_BASIC)
{
LLPluginClassBasic::receivePluginMessage(message);
}
else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA)
{
std::string message_name = message.getName();
if(message_name == "texture_params")
{
mRequestedTextureDepth = message.getValueS32("depth");
mRequestedTextureInternalFormat = message.getValueU32("internalformat");
mRequestedTextureFormat = message.getValueU32("format");
mRequestedTextureType = message.getValueU32("type");
mRequestedTextureSwapBytes = message.getValueBoolean("swap_bytes");
mRequestedTextureCoordsOpenGL = message.getValueBoolean("coords_opengl");
// These two are optional, and will default to 0 if they're not specified.
mDefaultMediaWidth = message.getValueS32("default_width");
mDefaultMediaHeight = message.getValueS32("default_height");
mAllowDownsample = message.getValueBoolean("allow_downsample");
mPadding = message.getValueS32("padding");
setSizeInternal();
mTextureParamsReceived = true;
}
else if(message_name == "updated")
{
if(message.hasValue("left"))
{
LLRect newDirtyRect;
newDirtyRect.mLeft = message.getValueS32("left");
newDirtyRect.mTop = message.getValueS32("top");
newDirtyRect.mRight = message.getValueS32("right");
newDirtyRect.mBottom = message.getValueS32("bottom");
// The plugin is likely to have top and bottom switched, due to vertical flip and OpenGL coordinate confusion.
// If they're backwards, swap them.
if(newDirtyRect.mTop < newDirtyRect.mBottom)
{
S32 temp = newDirtyRect.mTop;
newDirtyRect.mTop = newDirtyRect.mBottom;
newDirtyRect.mBottom = temp;
}
if(mDirtyRect.isEmpty())
{
mDirtyRect = newDirtyRect;
}
else
{
mDirtyRect.unionWith(newDirtyRect);
}
LL_DEBUGS("PluginUpdated") << "adjusted incoming rect is: ("
<< newDirtyRect.mLeft << ", "
<< newDirtyRect.mTop << ", "
<< newDirtyRect.mRight << ", "
<< newDirtyRect.mBottom << "), new dirty rect is: ("
<< mDirtyRect.mLeft << ", "
<< mDirtyRect.mTop << ", "
<< mDirtyRect.mRight << ", "
<< mDirtyRect.mBottom << ")"
<< LL_ENDL;
mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CONTENT_UPDATED);
}
bool time_duration_updated = false;
int previous_percent = mProgressPercent;
if(message.hasValue("current_time"))
{
mCurrentTime = message.getValueReal("current_time");
time_duration_updated = true;
}
if(message.hasValue("duration"))
{
mDuration = message.getValueReal("duration");
time_duration_updated = true;
}
if(message.hasValue("current_rate"))
{
mCurrentRate = message.getValueReal("current_rate");
}
if(message.hasValue("loaded_duration"))
{
mLoadedDuration = message.getValueReal("loaded_duration");
time_duration_updated = true;
}
else
//.........这里部分代码省略.........