本文整理汇总了C++中jccl::ConfigElementPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ConfigElementPtr类的具体用法?C++ ConfigElementPtr怎么用?C++ ConfigElementPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigElementPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例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: 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;
}
示例5: 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);
}
示例6: 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"))
);
}
示例7: 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"))
);
}
示例8: config
bool CyberGlove::config(jccl::ConfigElementPtr e)
{
if(! (Input::config(c) && Glove::config(c) ))
{
return false;
}
vprASSERT(mThread == NULL); // This should have been set by Input(c)
mPortName = e->getProperty<std::string>("port");
mBaudRate = e->getProperty<int>("baud");
char* home_dir = e->getProperty("calibration_dir").cstring();
if (home_dir != NULL)
{
mCalDir = new char [strlen(home_dir) + 1];
strcpy(mCalDir,home_dir);
}
std::string glove_pos_proxy = e->getProperty("glove_position"); // Get the name of the pos_proxy
if(glove_pos_proxy == std::string(""))
{
vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CRITICAL_LVL)
<< clrOutNORM(clrRED, "ERROR:") << " Cyberglove has no posProxy."
<< std::endl << vprDEBUG_FLUSH;
return false;
}
// init glove proxy interface
/* XXX: Doesn't appear to be used
int proxy_index = gadget::InputManager::instance()->getProxyIndex(glove_pos_proxy);
if(proxy_index != -1)
{
mGlovePos[0] = gadget::InputManager::instance()->->getPosProxy(proxy_index);
}
else
{
vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CRITICAL_LVL)
<< clrOutNORM(clrRED, "ERROR:")
<< " CyberGlove::CyberGlove: Can't find posProxy."
<< std::endl << std::endl << vprDEBUG_FLUSH;
}
*/
mGlove = new CyberGloveBasic( mCalDir, mPortName, mBaudRate );
return true;
}
示例9: 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;
}
}
示例10: configureProxy
/**
* Check if the device factory or proxy factory can handle the element.
*/
bool InputManager::configureProxy(jccl::ConfigElementPtr element)
{
std::string proxy_name = element->getFullName();
vpr::DebugOutputGuard dbg_output(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL,
std::string("gadget::InputManager::configureProxy: Named: ") + proxy_name + std::string("\n"),
std::string("done configuring proxy\n"));
Proxy* new_proxy;
// Tell the factory to load the proxy
// NOTE: The config for the proxy registers it with the input manager
new_proxy = ProxyFactory::instance()->loadProxy(element);
// Check for success
if(NULL == new_proxy)
{
vprDEBUG(vprDBG_ERROR,vprDBG_CRITICAL_LVL)
<< clrOutNORM(clrRED,"ERROR:")
<< " gadget::InputManager::configureProxy: Proxy construction failed:"
<< proxy_name << std::endl << vprDEBUG_FLUSH;
return false;
}
vprASSERT(proxy_name == new_proxy->getName());
// -- Add to proxy table
if(false == addProxy(new_proxy))
{
return false;
}
return true;
}
示例11: 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;
}
}
示例12: 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;
}
示例13: setDisplaySystemElement
void DisplayManager::setDisplaySystemElement(jccl::ConfigElementPtr elt)
{
if ( elt->getVersion() < 3 )
{
vprDEBUG(vrjDBG_DISP_MGR, vprDBG_WARNING_LVL)
<< clrOutBOLD(clrYELLOW, "WARNING") << ": Display system element '"
<< elt->getName() << "'" << std::endl;
vprDEBUG_NEXTnl(vrjDBG_DISP_MGR, vprDBG_WARNING_LVL)
<< " is out of date.\n";
vprDEBUG_NEXTnl(vrjDBG_DRAW_MGR, vprDBG_WARNING_LVL)
<< " Expected version 3 but found version "
<< elt->getVersion() << ". Pipe\n";
vprDEBUG_NEXTnl(vrjDBG_DRAW_MGR, vprDBG_WARNING_LVL)
<< " configurations will not work.\n" << vprDEBUG_FLUSH;
}
mDisplaySystemElement = elt;
}
示例14: configAdd
/** Add the pending elm to the configuration.
* @pre configCanHandle (elm) == true.
* @return true iff elm was successfully added to configuration.
*/
bool RIMPlugin::configAdd(jccl::ConfigElementPtr elm)
{
vprASSERT(ClusterManager::instance()->recognizeRemoteDeviceConfig(elm));
vprASSERT(ClusterManager::instance()->isClusterActive());
std::string device_name = elm->getName();
vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL)
<< clrOutBOLD(clrCYAN,"[RIMPlugin] ")
<< "Adding device: " << device_name
<< std::endl << vprDEBUG_FLUSH;
vprASSERT(cluster::ClusterManager::instance()->isClusterActive() && "RIM called in non-cluster mode.");
bool master = cluster::ClusterManager::instance()->isMaster();
bool result(false);
// If we are the master, configure the device and tell all slaves to prepare
// virtual devices.
if (master)
{
vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL)
<< clrOutBOLD(clrMAGENTA, "[RemoteInputManager]")
<< "Configuring device on master node: " << device_name
<< std::endl << vprDEBUG_FLUSH;
gadget::InputManager::instance()->configureDevice(elm);
gadget::InputPtr input_device = gadget::InputManager::instance()->getDevice(device_name);
if ( input_device != NULL )
{
result = addDeviceServer(device_name, input_device);
DeviceServerPtr device_server = getDeviceServer(device_name);
vprASSERT(NULL != device_server.get() && "Must have device server.");
const vpr::Uint16 dev_type_id(input_device->getTypeId());
const vpr::GUID& temp_guid(device_server->getId());
DeviceAckPtr device_ack = DeviceAck::create(mHandlerGUID, temp_guid,
device_name, dev_type_id,
true);
vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL)
<< clrOutBOLD(clrMAGENTA, "[RemoteInputManager]")
<< "Sending device ack [" << device_name << "] to all cluster nodes."
<< std::endl << vprDEBUG_FLUSH;
cluster::ClusterManager::instance()->getNetwork()->sendToAll(device_ack);
}
}
else
{
vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_STATUS_LVL)
<< clrOutBOLD(clrMAGENTA, "[RemoteInputManager]")
<< "Configuring device on slave node: " << device_name
<< std::endl << vprDEBUG_FLUSH;
result = true;
}
return result;
}
示例15: config
bool SimAnalog::config(jccl::ConfigElementPtr element)
{
//vprDEBUG(vprDBG_ALL, vprDBG_VERB_LVL)<<"*** SimAnalog::config()\n"<< vprDEBUG_FLUSH;
if (! (Input::config(element) && Analog::config(element) &&
SimInput::config(element)) )
{
return false;
}
std::vector<jccl::ConfigElementPtr> key_inc_list, key_dec_list;
int key_count = element->getNum("increment_keypress");
for ( int i = 0; i < key_count; ++i )
{
key_inc_list.push_back(element->getProperty<jccl::ConfigElementPtr>("increment_keypress", i));
}
key_count = element->getNum("decrement_keypress");
for ( int i = 0; i < key_count; ++i )
{
key_dec_list.push_back(element->getProperty<jccl::ConfigElementPtr>("decrement_keypress", i));
}
mSimKeysUp = readKeyList(key_inc_list);
mSimKeysDown = readKeyList(key_dec_list);
mAnaStep = element->getProperty<float>("delta");
mInitialValue = element->getProperty<float>("initial_value");
// Initialize all the data to the inital_value
size_t num_pairs = mSimKeysUp.size();
mAnaData = std::vector<AnalogData>(num_pairs);
for (size_t i=0; i<num_pairs; ++i)
{
mAnaData[i].setValue(mInitialValue);
}
mAutoReturn = element->getProperty<bool>("auto_return");
return true;
}