本文整理汇总了C++中misc::ConfigurationFileSection::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigurationFileSection::getName方法的具体用法?C++ ConfigurationFileSection::getName怎么用?C++ ConfigurationFileSection::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc::ConfigurationFileSection
的用法示例。
在下文中一共展示了ConfigurationFileSection::getName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createInputDevice
void InputDeviceAdapterDeviceDaemon::createInputDevice(int deviceIndex,const Misc::ConfigurationFileSection& configFileSection)
{
/* Check if the device client has a virtual device of the same name as this configuration file section: */
for(int vdIndex=0;vdIndex<deviceClient.getNumVirtualDevices();++vdIndex)
{
const VRDeviceDescriptor& vd=deviceClient.getVirtualDevice(vdIndex);
if(vd.name==configFileSection.getName())
{
/* Ensure that the index mapping tables exist: */
createIndexMappings();
/* Create an input device from the virtual input device descriptor: */
int trackType=InputDevice::TRACK_NONE;
if(vd.trackType&VRDeviceDescriptor::TRACK_POS)
trackType|=InputDevice::TRACK_POS;
if(vd.trackType&VRDeviceDescriptor::TRACK_DIR)
trackType|=InputDevice::TRACK_DIR;
if(vd.trackType&VRDeviceDescriptor::TRACK_ORIENT)
trackType|=InputDevice::TRACK_ORIENT;
/* Create new input device as a physical device: */
std::string deviceName=configFileSection.retrieveString("./name",vd.name);
InputDevice* newDevice=inputDeviceManager->createInputDevice(deviceName.c_str(),trackType,vd.numButtons,vd.numValuators,true);
newDevice->setDeviceRay(vd.rayDirection,vd.rayStart);
/* Initialize the new device's glyph from the current configuration file section: */
Glyph& deviceGlyph=inputDeviceManager->getInputGraphManager()->getInputDeviceGlyph(newDevice);
deviceGlyph.configure(configFileSection,"./deviceGlyphType","./deviceGlyphMaterial");
/* Save the new input device: */
inputDevices[deviceIndex]=newDevice;
/* Assign the new device's tracker index: */
trackerIndexMapping[deviceIndex]=vd.trackerIndex;
/* Assign the new device's button indices: */
if(vd.numButtons>0)
{
buttonIndexMapping[deviceIndex]=new int[vd.numButtons];
for(int i=0;i<vd.numButtons;++i)
buttonIndexMapping[deviceIndex][i]=vd.buttonIndices[i];
}
else
buttonIndexMapping[deviceIndex]=0;
/* Store the virtual input device's button names: */
for(int i=0;i<vd.numButtons;++i)
buttonNames.push_back(vd.buttonNames[i]);
/* Assign the new device's valuator indices: */
if(vd.numValuators>0)
{
valuatorIndexMapping[deviceIndex]=new int[vd.numValuators];
for(int i=0;i<vd.numValuators;++i)
valuatorIndexMapping[deviceIndex][i]=vd.valuatorIndices[i];
}
else
valuatorIndexMapping[deviceIndex]=0;
/* Store the virtual input device's valuator names: */
for(int i=0;i<vd.numValuators;++i)
valuatorNames.push_back(vd.valuatorNames[i]);
/* Skip the usual device creation procedure: */
return;
}
}
/* Call base class method to initialize the input device: */
InputDeviceAdapterIndexMap::createInputDevice(deviceIndex,configFileSection);
/* Read the list of button names for this device: */
/* Read the names of all button features: */
typedef std::vector<std::string> StringList;
StringList tempButtonNames=configFileSection.retrieveValue<StringList>("./buttonNames",StringList());
int buttonIndex=0;
for(StringList::iterator bnIt=tempButtonNames.begin();bnIt!=tempButtonNames.end()&&buttonIndex<inputDevices[deviceIndex]->getNumButtons();++bnIt,++buttonIndex)
{
/* Store the button name: */
buttonNames.push_back(*bnIt);
}
for(;buttonIndex<inputDevices[deviceIndex]->getNumButtons();++buttonIndex)
{
char buttonName[40];
snprintf(buttonName,sizeof(buttonName),"Button%d",buttonIndex);
buttonNames.push_back(buttonName);
}
/* Read the names of all valuator features: */
StringList tempValuatorNames=configFileSection.retrieveValue<StringList>("./valuatorNames",StringList());
int valuatorIndex=0;
for(StringList::iterator vnIt=tempValuatorNames.begin();vnIt!=tempValuatorNames.end()&&valuatorIndex<inputDevices[deviceIndex]->getNumValuators();++vnIt,++valuatorIndex)
{
/* Store the valuator name: */
valuatorNames.push_back(*vnIt);
}
for(;valuatorIndex<inputDevices[deviceIndex]->getNumValuators();++valuatorIndex)
{
char valuatorName[40];
snprintf(valuatorName,sizeof(valuatorName),"Valuator%d",valuatorIndex);
//.........这里部分代码省略.........