本文整理汇总了C++中MessageView::endStdioRedirect方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageView::endStdioRedirect方法的具体用法?C++ MessageView::endStdioRedirect怎么用?C++ MessageView::endStdioRedirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageView
的用法示例。
在下文中一共展示了MessageView::endStdioRedirect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadModelFile
bool EditableModelItemImpl::loadModelFile(const std::string& filename)
{
BodyPtr newBody;
MessageView* mv = MessageView::instance();
mv->beginStdioRedirect();
bodyLoader.setMessageSink(mv->cout(true));
newBody = bodyLoader.load(filename);
mv->endStdioRedirect();
if(newBody){
newBody->initializeState();
newBody->calcForwardKinematics();
Link* link = newBody->rootLink();
AbstractBodyLoaderPtr loader = bodyLoader.lastActualBodyLoader();
VRMLBodyLoader* vloader = dynamic_cast<VRMLBodyLoader*>(loader.get());
if (vloader) {
// VRMLBodyLoader supports retriveOriginalNode function
setLinkTree(link, vloader);
} else {
// Other loaders dont, so we wrap with inline node
VRMLProtoInstance* proto = new VRMLProtoInstance(new VRMLProto(""));
MFNode* children = new MFNode();
VRMLInlinePtr inl = new VRMLInline();
inl->urls.push_back(filename);
children->push_back(inl);
proto->fields["children"] = *children;
// first, create joint item
JointItemPtr item = new JointItem(link);
item->originalNode = proto;
self->addChildItem(item);
ItemTreeView::instance()->checkItem(item, true);
// next, create link item under the joint item
LinkItemPtr litem = new LinkItem(link);
litem->originalNode = proto;
litem->setName("link");
item->addChildItem(litem);
ItemTreeView::instance()->checkItem(litem, true);
}
for (int i = 0; i < newBody->numDevices(); i++) {
Device* dev = newBody->device(i);
SensorItemPtr sitem = new SensorItem(dev);
Item* parent = self->findItem<Item>(dev->link()->name());
if (parent) {
parent->addChildItem(sitem);
ItemTreeView::instance()->checkItem(sitem, true);
}
}
}
return (newBody);
}
示例2: loadModelFile
bool BodyItemImpl::loadModelFile(const std::string& filename)
{
MessageView* mv = MessageView::instance();
mv->beginStdioRedirect();
bodyLoader.setMessageSink(mv->cout(true));
BodyPtr newBody = bodyLoader.load(filename);
mv->endStdioRedirect();
if(newBody){
body = newBody;
body->setName(self->name());
body->initializeState();
}
initBody(false);
return (newBody);
}