本文整理汇总了C++中Tool::GetInterfaceName方法的典型用法代码示例。如果您正苦于以下问题:C++ Tool::GetInterfaceName方法的具体用法?C++ Tool::GetInterfaceName怎么用?C++ Tool::GetInterfaceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tool
的用法示例。
在下文中一共展示了Tool::GetInterfaceName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindTool
mtsMedtronicStealthlink::Tool * mtsMedtronicStealthlink::AddTool(const std::string & stealthName, const std::string & interfaceName)
{
// First, check if tool has already been added
Tool * tool = FindTool(stealthName);
if (tool) {
if (tool->GetInterfaceName() == interfaceName) {
CMN_LOG_CLASS_RUN_WARNING << "AddTool: tool " << stealthName << " already exists with interface "
<< interfaceName << std::endl;
return tool;
}
// We could support having the same tool in multiple interfaces, but we would need to maintain
// an array of CurrentTools, or loop through the entire Tools list in the Run method (to assign the
// MarkerPosition and TooltipPosition).
CMN_LOG_CLASS_RUN_ERROR << "AddTool: tool " << stealthName << " already exists in interface "
<< tool->GetInterfaceName() << ", could not create new interface "
<< interfaceName << std::endl;
return 0;
}
// Next, check if interface has already been added
mtsInterfaceProvided * provided = GetInterfaceProvided(interfaceName);
if (provided) {
CMN_LOG_CLASS_RUN_ERROR << "AddTool: interface " << interfaceName << " already exists." << std::endl;
return 0;
}
// Create the tool and add it to the list
tool = new Tool (stealthName, interfaceName);
Tools.push_back(tool);
DataMapContainerInsertReturnValue dataMapInsertReturn;
MNavStealthLink::DataItem * newItem = 0;
myGenericObject * newObject = tool;
if (strcmp(interfaceName.c_str(),"Frame") == 0){
MNavStealthLink::Frame * newFrame = new MNavStealthLink::Frame();
newFrame->name = stealthName;
newItem = newFrame;
} else if (strcmp(interfaceName.c_str(),"Tool") == 0 ){
MNavStealthLink::Instrument * newTool = new MNavStealthLink::Instrument();
newTool->name = stealthName;
newItem = newTool;
}else{
//warning not a Frame or Tool assuming Tool
MNavStealthLink::Instrument * newTool = new MNavStealthLink::Instrument();
newTool->name = stealthName;
newItem = newTool;
}
dataMapInsertReturn = myDataMap.insert(DataMapContainerItem(newItem,newObject));
if (dataMapInsertReturn.second){
CMN_LOG_CLASS_RUN_VERBOSE << "AddTool: adding " << stealthName << " to interface " << interfaceName << std::endl;
provided = AddInterfaceProvided(interfaceName);
dataMapInsertReturn.first->second->ConfigureInterfaceProvided(provided);
} else {
CMN_LOG_CLASS_INIT_ERROR << "AddTool: Failed to add tool to the DataMap" << std::endl;
}
return tool;
}