本文整理汇总了C++中jccl::ConfigElementPtr::getID方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigElementPtr::getID方法的具体用法?C++ ConfigElementPtr::getID怎么用?C++ ConfigElementPtr::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jccl::ConfigElementPtr
的用法示例。
在下文中一共展示了ConfigElementPtr::getID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configCanHandle
/**
* Is it a display configuration element?
*
* @return true if we have a display config element; false if we don't.
*/
bool DisplayManager::configCanHandle(jccl::ConfigElementPtr element)
{
return ( (element->getID() == std::string("surfaceDisplay"))
|| (element->getID() == std::string("simDisplay"))
|| (element->getID() == std::string("display_system"))
|| (element->getID() == std::string("display_window"))
);
}
示例2: configCanHandle
// Return true if:
// It is recognized device, proxy, or alias.
bool InputManager::configCanHandle(jccl::ConfigElementPtr element)
{ // NEED TO FIX!!!!
return ( (DeviceFactory::instance()->recognizeDevice(element) &&
!cluster::ClusterManager::instance()->recognizeRemoteDeviceConfig(element)) ||
ProxyFactory::instance()->recognizeProxy(element) ||
recognizeProxyAlias(element) ||
(element->getID() == std::string("display_system")) ||
(element->getID() == std::string("input_manager")) ||
(element->getID() == std::string("gadget_logger"))
);
}
示例3: configAddDisplay
/**
* Adds the element to the configuration.
*
* @pre configCanHandle(element) == true
* @post (display of same name already loaded) ==> old display closed, new one opened<br>
* (display is new) ==> (new display is added)<br>
* Draw Manager is notified of the display change.
*/
bool DisplayManager::configAddDisplay(jccl::ConfigElementPtr element)
{
vprASSERT(configCanHandle(element)); // We must be able to handle it first of all
vprDEBUG_BEGIN(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "------- DisplayManager::configAddDisplay -------\n" << vprDEBUG_FLUSH;
// Find out if we already have a window of this name
// If so, then close it before we open a new one of the same name
// This basically allows re-configuration of a window
DisplayPtr cur_disp = findDisplayNamed(element->getName());
if (cur_disp != NULL) // We have an old display
{
vprDEBUG(vrjDBG_DISP_MGR,vprDBG_CONFIG_LVL) << "Removing old window: " << cur_disp->getName().c_str() << vprDEBUG_FLUSH;
closeDisplay(cur_disp,true); // Close the display and notify the draw manager to close the window
}
// --- Add a display (of the correct type) ---- //
if (element->getID() == std::string("display_window")) // Display window
{
DisplayPtr newDisp = Display::create(); // Create the display
newDisp->config(element);
addDisplay(newDisp,true); // Add it
vprDEBUG(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "Adding display: " << newDisp->getName().c_str() << std::endl << vprDEBUG_FLUSH;
vprDEBUG(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "Display: " << newDisp << std::endl << vprDEBUG_FLUSH;
}
vprDEBUG_END(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "------- DisplayManager::configAddDisplay Done. --------\n" << vprDEBUG_FLUSH;
return true;
}
示例4: depSatisfied
bool ClusterDepChecker::depSatisfied(jccl::ConfigElementPtr element)
{
if (element->getID() == ClusterNetwork::getClusterNodeElementType())
{
// Machine Specific elements should have no dependencies since we are
// simply inserting the child elements into the pending list. This is
// to fix errors like the embedded keyboard window in a DisplayWindow
// would always create a dependancy loop.
debugOutDependencies( element, vprDBG_WARNING_LVL );
return true;
}
/*
else if (cluster::ClusterManager::instance()->recognizeRemoteDeviceConfig(element))
{
// Remote devices should have no dependencies since we are not actually
// configuring anything, we are only creating a data structure that we
// can determine without any other elements.
// Virtual devices should not have any dependencies.
// RemoteDeviceConfig has only two dependencies
// - deivceHost exists in Active List
// - Node exists and is connected
// - Remote Device needs to be configured
bool pass = true;
jccl::ConfigManager* cfg_mgr = jccl::ConfigManager::instance();
// device_host exists in active configuration
std::string device_host = element->getProperty<std::string>( "device_host" );
gadget::NodePtr node = cluster::ClusterManager::instance()->getNetwork()->getNodeByName( device_host );
if (!cfg_mgr->isElementInActiveList(device_host) || NULL == node)
{
pass = false;
}
else if (gadget::Node::DISCONNECTED == node->getStatus())
{
pass = false;
node->setStatus( gadget::Node::PENDING );
}
else if (gadget::Node::PENDING == node->getStatus() ||
gadget::Node::NEWCONNECTION == node->getStatus())
{
// Wait until we are fully connected.
pass = false;
}
return pass;
}
*/
else
{
vprDEBUG(gadgetDBG_RIM, vprDBG_CRITICAL_LVL)
<< "ERROR, Something is seriously wrong, we should never get here\n"
<< vprDEBUG_FLUSH;
return true;
}
}
示例5: configure
void SignalGrabStrategy::configure(jccl::ConfigElementPtr elt)
{
vprASSERT(elt->getID() == getElementType());
const unsigned int req_cfg_version(1);
// Check for correct version of plugin configuration.
if ( elt->getVersion() < req_cfg_version )
{
std::stringstream msg;
msg << "Configuration of SignalGrabStrategy failed. Required config "
<< "element version is " << req_cfg_version << ", but element '"
<< elt->getName() << "' is version " << elt->getVersion();
throw PluginException(msg.str(), VRKIT_LOCATION);
}
const std::string choose_btn_prop("choose_button_nums");
const std::string grab_btn_prop("grab_button_nums");
const std::string release_btn_prop("release_button_nums");
mChooseBtn.configure(elt->getProperty<std::string>(choose_btn_prop),
mWandInterface);
mGrabBtn.configure(elt->getProperty<std::string>(grab_btn_prop),
mWandInterface);
mReleaseBtn.configure(elt->getProperty<std::string>(release_btn_prop),
mWandInterface);
// Determine if grab and release are activated using the same button
// sequence. This indicates that the grab/release operation is a toggle
// and must be handled differently than if the two operations are
// separate.
mGrabReleaseToggle = mGrabBtn == mReleaseBtn;
}
示例6: removeProxyAlias
/**
* Removes a proxy aliases in config database.
* @pre none
* @post (alias not in list) ==> returns = false<br>
* (alias is in list) ==> (alias is removed from list) returns true
*/
bool InputManager::removeProxyAlias(jccl::ConfigElementPtr element)
{
vpr::DebugOutputGuard dbg_output(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL,
std::string("gadget::InputManager::removeProxyAlias\n"),
std::string("...done removing alias.\n"));
vprASSERT(element->getID() == "alias");
std::string alias_name, proxy_name; // The string of the alias, name of proxy to pt to
alias_name = element->getName();
if(mProxyAliases.end() == mProxyAliases.find(alias_name))
{
vprDEBUG(vprDBG_ERROR,vprDBG_CRITICAL_LVL)
<< clrOutNORM(clrRED,"ERROR:")
<< "gadget::InputManager::RemoveProxyAlias: Alias: " << alias_name
<< " cannot find proxy: " << proxy_name.c_str() << std::endl
<< vprDEBUG_FLUSH;
return false;
}
mProxyAliases.erase(alias_name);
vprDEBUG(gadgetDBG_INPUT_MGR,vprDBG_CONFIG_LVL)
<< " alias:" << alias_name.c_str() << " index:"
<< mProxyAliases[proxy_name] << " has been removed." << std::endl
<< vprDEBUG_FLUSH;
return true;
}
示例7: config
bool User::config(jccl::ConfigElementPtr element)
{
vprASSERT(element.get() != NULL);
vprASSERT(element->getID() == "user");
vprDEBUG_BEGIN(vrjDBG_KERNEL, vprDBG_STATE_LVL)
<< "vjUser::config: Creating a new user\n" << vprDEBUG_FLUSH;
// Assign user id
mUserId = mNextUserId++;
// Setup user name
mName = element->getName();
// Initialize the head stuff
std::string head_alias = element->getProperty<std::string>("head_position");
mHead.init(head_alias);
// Initialize interocular distance
mInterocularDist = element->getProperty<float>("interocular_distance");
if(mInterocularDist == 0.0f)
{
vprDEBUG(vrjDBG_KERNEL,vprDBG_CONFIG_LVL) << clrOutNORM(clrRED, "WARNING:") << "User: " << mName << " has interocular distance is set to 0.0f. This is probably not what you wanted.\n" << vprDEBUG_FLUSH;
}
vprDEBUG(vrjDBG_KERNEL,vprDBG_STATE_LVL) << "id: " << mUserId << " Name:" << mName.c_str()
<< " head_positon:" << head_alias.c_str()
<< " interocular_distance:" << mInterocularDist
<< std::endl << vprDEBUG_FLUSH;
return true;
}
示例8: configRemove
/**
* Removes the element from the current configuration.
* @pre configCanHandle(element) == true
*/
bool DisplayManager::configRemove(jccl::ConfigElementPtr element)
{
vprASSERT(configCanHandle(element));
const std::string element_type(element->getID());
if ( (element_type == std::string("surfaceDisplay")) ||
(element_type == std::string("simDisplay")) )
{
vprDEBUG(vprDBG_ALL, vprDBG_CRITICAL_LVL)
<< "Element of type: " << element_type
<< " is no longer supported. Use display_window type instead.\n"
<< vprDEBUG_FLUSH;
return false;
}
else if (element_type == std::string("display_window"))
{
return configRemoveDisplay(element);
}
else if (element_type == std::string("display_system"))
{
// XXX: Put signal here to tell draw manager to lookup new stuff
mDisplaySystemElement.reset(); // Keep track of the display system element
return true; // We successfully configured.
// This tell processPending to remove it to the active config
}
else
{
return false;
}
}
示例9: configure
void MultiObjectGrabStrategy::configure(jccl::ConfigElementPtr elt)
{
vprASSERT(elt->getID() == getElementType());
const unsigned int req_cfg_version(1);
// Check for correct version of plugin configuration.
if ( elt->getVersion() < req_cfg_version )
{
std::stringstream msg;
msg << "Configuration of MultiObjectGrabStrategy failed. Required "
<< "config element version is " << req_cfg_version
<< ", but element '" << elt->getName() << "' is version "
<< elt->getVersion();
throw PluginException(msg.str(), VRKIT_LOCATION);
}
const std::string choose_btn_prop("choose_button_nums");
const std::string grab_btn_prop("grab_button_nums");
const std::string release_btn_prop("release_button_nums");
mChooseBtn.configure(elt->getProperty<std::string>(choose_btn_prop),
mWandInterface);
mGrabBtn.configure(elt->getProperty<std::string>(grab_btn_prop),
mWandInterface);
mReleaseBtn.configure(elt->getProperty<std::string>(release_btn_prop),
mWandInterface);
}
示例10: configRemove
/**
* Removes the element from the current configuration.
*/
bool InputManager::configRemove(jccl::ConfigElementPtr element)
{
vpr::DebugOutputGuard dbg_output(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL,
std::string("InputManager: Removing config...\n"),
std::string("done removing config.\n"));
vprASSERT(configCanHandle(element));
bool ret_val = false; // Flag to return success
// NEED TO FIX!!!!
if (cluster::ClusterManager::instance()->recognizeRemoteDeviceConfig(element))
{
vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CONFIG_LVL)
<< "InputManager can not handle remote devices, we must use Remote Input Manager."
<< vprDEBUG_FLUSH;
ret_val = false;
}
else if(DeviceFactory::instance()->recognizeDevice(element))
{
ret_val = removeDevice(element);
}
else if(recognizeProxyAlias(element))
{
ret_val = removeProxyAlias(element);
}
else if(ProxyFactory::instance()->recognizeProxy(element))
{
ret_val = removeProxy(element);
}
else if(element->getID() == std::string("display_system"))
{
mDisplaySystemElement.reset(); // Keep track of the display system element
ret_val = true; // We successfully configured.
// This tell processPending to remove it to the active config
}
else
{
ret_val = false;
}
if(ret_val)
{
resetAllDevicesAndProxies();
updateAllDevices(); // Update all the input data
updateAllProxies(); // Update all the input data
BaseDeviceInterface::refreshAllInterfaces(); // Refresh all the device interface handles
vprDEBUG(gadgetDBG_INPUT_MGR,vprDBG_VERB_LVL)
<< "InputManager::configRemove(): Updated all data" << std::endl
<< vprDEBUG_FLUSH;
}
return ret_val; // Return the success flag if we added at all
}
示例11: findConstructor
int ProxyFactory::findConstructor(jccl::ConfigElementPtr element)
{
std::string element_type(element->getID());
for(unsigned i=0;i<mConstructors.size();i++)
{
if(mConstructors[i]->getElementType() == element_type)
{
return i;
}
}
return -1;
}
示例12: loadProxy
/**
* Loads the specified proxy.
*/
ProxyPtr ProxyFactory::loadProxy(jccl::ConfigElementPtr element)
{
vprASSERT(recognizeProxy(element));
int index = findConstructor(element);
boost::shared_ptr<ProxyConstructorBase> constructor = mConstructors[index];
vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL)
<< "[gadget::ProxyFactory::loadProxy] Loading proxy: "
<< element->getID() << " with: "
<< typeid(*constructor).name() << std::endl << vprDEBUG_FLUSH;
ProxyPtr new_proxy = constructor->createProxy(element);
return new_proxy;
}
示例13: configureProxyAlias
/**
* Configures proxy aliases in config database.
* @pre none
* @post (alias not already in list) ==> Alias is added to proxyAlias list<br>
* (alias was already is list) ==> Alias is set to point to the new proxy instead
*/
bool InputManager::configureProxyAlias(jccl::ConfigElementPtr element)
{
vpr::DebugOutputGuard dbg_output(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL,
std::string("gadget::InputManager: Configuring proxy alias\n"),
std::string("...done configuring alias.\n"));
vprASSERT(element->getID() == "alias");
std::string alias_name, proxy_name; // The string of the alias, name of proxy to pt to
alias_name = element->getName();
proxy_name = element->getProperty<std::string>("proxy");
addProxyAlias(alias_name, proxy_name);
return true;
}
示例14: configRemoveDisplay
/**
* Removes the element from the current configuration.
*
* @pre configCanHandle(element) == true
* @return success
*/
bool DisplayManager::configRemoveDisplay(jccl::ConfigElementPtr element)
{
vprASSERT(configCanHandle(element)); // We must be able to handle it first of all
vprDEBUG_BEGIN(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "------- DisplayManager::configRemoveDisplay -------\n" << vprDEBUG_FLUSH;
bool success_flag(false);
if (element->getID() == std::string("display_window")) // It is a display
{
DisplayPtr remove_disp = findDisplayNamed(element->getName());
if (remove_disp != NULL)
{
closeDisplay(remove_disp, true); // Remove it
success_flag = true;
}
}
vprDEBUG_END(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "------- DisplayManager::configRemoveDisplay done. --------\n" << vprDEBUG_FLUSH;
return success_flag;
}
示例15: init
GridPtr Grid::init(jccl::ConfigElementPtr cfgElt)
{
vprASSERT(cfgElt->getID() == std::string("grid"));
const unsigned int req_cfg_version(1);
// Check for correct version of plugin configuration.
if ( cfgElt->getVersion() < req_cfg_version )
{
std::ostringstream msg;
msg << "Failed to configure grid '" << cfgElt->getName()
<< "'. Required config element version is " << req_cfg_version
<< ", but this element is version " << cfgElt->getVersion();
throw PluginException(msg.str(), VRKIT_LOCATION);
}
mName = cfgElt->getName();
const std::string size_prop("size");
const std::string granularity_prop("granularity");
const std::string color_prop("color");
const std::string corner_prop("corner");
const std::string corner_pos_prop("corner_position");
const std::string orient_prop("orientation");
const OSG::Real32 width = cfgElt->getProperty<OSG::Real32>(size_prop, 0);
const OSG::Real32 height = cfgElt->getProperty<OSG::Real32>(size_prop, 1);
if ( width <= 0.0f || height <= 0.0f )
{
std::ostringstream msg_stream;
msg_stream << "Invalid grid dimensions " << width << "x" << height;
throw PluginException(msg_stream.str(), VRKIT_LOCATION);
}
const float granularity = cfgElt->getProperty<float>(granularity_prop);
if ( granularity <= 0.0f )
{
std::ostringstream msg_stream;
msg_stream << "Invalid grid cell granularity " << granularity;
throw PluginException(msg_stream.str(), VRKIT_LOCATION);
}
OSG::Real32 red = cfgElt->getProperty<OSG::Real32>(color_prop, 0);
OSG::Real32 green = cfgElt->getProperty<OSG::Real32>(color_prop, 1);
OSG::Real32 blue = cfgElt->getProperty<OSG::Real32>(color_prop, 2);
if ( red < 0.0f || red > 1.0f )
{
std::cerr << "WARNING: Invalid red color value " << red
<< " in config element '" << cfgElt->getName() << "'"
<< std::endl;
red = 0.0f;
}
if ( green < 0.0f || green > 1.0f )
{
std::cerr << "WARNING: Invalid green color value " << green
<< " in config element '" << cfgElt->getName() << "'"
<< std::endl;
green = 0.0f;
}
if ( blue < 0.0f || blue > 1.0f )
{
std::cerr << "WARNING: Invalid blue color value " << blue
<< " in config element '" << cfgElt->getName() << "'"
<< std::endl;
blue = 0.0f;
}
unsigned int corner_val = cfgElt->getProperty<unsigned int>(corner_prop);
Corner corner;
if ( 0 <= corner_val && corner_val <= 3 )
{
corner = static_cast<Corner>(corner_val);
}
else
{
std::ostringstream msg_stream;
msg_stream << "Invalid corner value " << corner_val
<< "; must be one of 0, 1, 2, or 3";
throw PluginException(msg_stream.str(), VRKIT_LOCATION);
}
const OSG::Vec3f corner_pos(
cfgElt->getProperty<float>(corner_pos_prop, 0),
cfgElt->getProperty<float>(corner_pos_prop, 1),
cfgElt->getProperty<float>(corner_pos_prop, 2)
);
OSG::Quaternion rot;
rot.setValue(
gmtl::Math::deg2Rad(cfgElt->getProperty<float>(orient_prop, 0)),
gmtl::Math::deg2Rad(cfgElt->getProperty<float>(orient_prop, 1)),
gmtl::Math::deg2Rad(cfgElt->getProperty<float>(orient_prop, 2))
);
initGeometry(width, height, granularity, corner, corner_pos, rot,
//.........这里部分代码省略.........