当前位置: 首页>>代码示例>>C++>>正文


C++ LLPluginMessage::getValueLLSD方法代码示例

本文整理汇总了C++中LLPluginMessage::getValueLLSD方法的典型用法代码示例。如果您正苦于以下问题:C++ LLPluginMessage::getValueLLSD方法的具体用法?C++ LLPluginMessage::getValueLLSD怎么用?C++ LLPluginMessage::getValueLLSD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLPluginMessage的用法示例。


在下文中一共展示了LLPluginMessage::getValueLLSD方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: receivePluginMessage

// This function is called when a new message is received from the plugin.
// We get here when calling mPluginManager->update() in the first line of
// AIFilePicker::multiplex_impl.
//
// Note that we can't call finish() or abort() directly in this function,
// as that deletes mPluginManager and we're using the plugin manager
// right now (to receive this message)!
void AIFilePicker::receivePluginMessage(const LLPluginMessage &message)
{
	std::string message_class = message.getClass();

	if (message_class == LLPLUGIN_MESSAGE_CLASS_BASIC)
	{
		std::string message_name = message.getName();
		if (message_name == "canceled")
		{
			LL_DEBUGS("Plugin") << "received message \"canceled\"" << LL_ENDL;
			set_state(AIFilePicker_canceled);
		}
		else if (message_name == "done")
		{
			LL_DEBUGS("Plugin") << "received message \"done\"" << LL_ENDL;
			LLSD filenames = message.getValueLLSD("filenames");
			mFilenames.clear();
			for(LLSD::array_iterator filename = filenames.beginArray(); filename != filenames.endArray(); ++filename)
			{
				mFilenames.push_back(*filename);
			}
			set_state(AIFilePicker_done);
		}
		else
		{
			LL_WARNS("Plugin") << "Unknown " << message_class << " class message: " << message_name << LL_ENDL;
		}
	}
}
开发者ID:cry0,项目名称:SingularityViewer,代码行数:36,代码来源:aifilepicker.cpp

示例2: receivePluginMessage

/* virtual */
void LLPluginProcessChild::receivePluginMessage(const std::string &message)
{
	LL_DEBUGS("Plugin") << "Received from plugin: " << message << LL_ENDL;
	
	if(mBlockingRequest)
	{
		// 
		LL_ERRS("Plugin") << "Can't send a message while already waiting on a blocking request -- aborting!" << LL_ENDL;
	}
	
	// Incoming message from the plugin instance
	bool passMessage = true;

	// FIXME: how should we handle queueing here?
	
	// Intercept certain base messages (responses to ones sent by this class)
	{
		// Decode this message
		LLPluginMessage parsed;
		parsed.parse(message);
		
		if(parsed.hasValue("blocking_request"))
		{
			mBlockingRequest = true;
		}

		std::string message_class = parsed.getClass();
		if(message_class == "base")
		{
			std::string message_name = parsed.getName();
			if(message_name == "init_response")
			{
				// The plugin has finished initializing.
				setState(STATE_RUNNING);

				// Don't pass this message up to the parent
				passMessage = false;
				
				LLPluginMessage new_message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "load_plugin_response");
				LLSD versions = parsed.getValueLLSD("versions");
				new_message.setValueLLSD("versions", versions);
				
				if(parsed.hasValue("plugin_version"))
				{
					std::string plugin_version = parsed.getValue("plugin_version");
					new_message.setValueLLSD("plugin_version", plugin_version);
				}

				// Let the parent know it's loaded and initialized.
				sendMessageToParent(new_message);
			}
			else if(message_name == "shm_remove_response")
			{
				// Don't pass this message up to the parent
				passMessage = false;

				std::string name = parsed.getValue("name");
				sharedMemoryRegionsType::iterator iter = mSharedMemoryRegions.find(name);				
				if(iter != mSharedMemoryRegions.end())
				{
					// detach the shared memory region
					iter->second->detach();
					
					// and remove it from our map
					mSharedMemoryRegions.erase(iter);
					
					// Finally, send the response to the parent.
					LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "shm_remove_response");
					message.setValue("name", name);
					sendMessageToParent(message);
				}
				else
				{
					LL_WARNS("Plugin") << "shm_remove_response for unknown memory segment!" << LL_ENDL;
				}
			}
		}
		else if (message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL)
		{
			bool flush = false;
			std::string message_name = parsed.getName();
			if(message_name == "shutdown")
			{
				// The plugin is finished.
				setState(STATE_UNLOADING);
				flush = true;
			}
			else if (message_name == "flush")
			{
				flush = true;
				passMessage = false;
			}
			if (flush)
			{
				flushMessages();
			}
		}
	}
	
//.........这里部分代码省略.........
开发者ID:Krazy-Bish-Margie,项目名称:SingularityViewer,代码行数:101,代码来源:llpluginprocesschild.cpp

示例3: 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;
//.........这里部分代码省略.........
开发者ID:PlayerDagostino,项目名称:SingularityViewer,代码行数:101,代码来源:llpluginprocessparent.cpp

示例4: receivePluginMessage

/* virtual */ 
void LLPluginProcessChild::receivePluginMessage(const std::string &message)
{
	LL_DEBUGS("Plugin") << "Received from plugin: " << message << LL_ENDL;

	// Incoming message from the plugin instance
	bool passMessage = true;

	// FIXME: how should we handle queueing here?
	
	// Intercept certain base messages (responses to ones sent by this class)
	{
		// Decode this message
		LLPluginMessage parsed;
		parsed.parse(message);
		std::string message_class = parsed.getClass();
		if(message_class == "base")
		{
			std::string message_name = parsed.getName();
			if(message_name == "init_response")
			{
				// The plugin has finished initializing.
				setState(STATE_RUNNING);

				// Don't pass this message up to the parent
				passMessage = false;
				
				LLPluginMessage new_message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "load_plugin_response");
				LLSD versions = parsed.getValueLLSD("versions");
				new_message.setValueLLSD("versions", versions);
				
				if(parsed.hasValue("plugin_version"))
				{
					std::string plugin_version = parsed.getValue("plugin_version");
					new_message.setValueLLSD("plugin_version", plugin_version);
				}

				// Let the parent know it's loaded and initialized.
				sendMessageToParent(new_message);
			}
			else if(message_name == "shm_remove_response")
			{
				// Don't pass this message up to the parent
				passMessage = false;

				std::string name = parsed.getValue("name");
				sharedMemoryRegionsType::iterator iter = mSharedMemoryRegions.find(name);				
				if(iter != mSharedMemoryRegions.end())
				{
					// detach the shared memory region
					iter->second->detach();
					
					// and remove it from our map
					mSharedMemoryRegions.erase(iter);
					
					// Finally, send the response to the parent.
					LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "shm_remove_response");
					message.setValue("name", name);
					sendMessageToParent(message);
				}
				else
				{
					LL_WARNS("Plugin") << "shm_remove_response for unknown memory segment!" << LL_ENDL;
				}
			}
		}
	}
	
	if(passMessage)
	{
		LL_DEBUGS("Plugin") << "Passing through to parent: " << message << LL_ENDL;
		writeMessageRaw(message);
	}
}
开发者ID:Kiera,项目名称:Sausages,代码行数:74,代码来源:llpluginprocesschild.cpp


注:本文中的LLPluginMessage::getValueLLSD方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。