本文整理汇总了C++中Leaf::GetLog方法的典型用法代码示例。如果您正苦于以下问题:C++ Leaf::GetLog方法的具体用法?C++ Leaf::GetLog怎么用?C++ Leaf::GetLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Leaf
的用法示例。
在下文中一共展示了Leaf::GetLog方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
SoccerBase::GetActiveScene(const Leaf& base,
boost::shared_ptr<Scene>& active_scene)
{
static boost::shared_ptr<SceneServer> sceneServer;
if (sceneServer.get() == 0)
{
if (! GetSceneServer(base,sceneServer))
{
base.GetLog()->Error()
<< "(SoccerBase) ERROR: " << base.GetName()
<< ", could not get SceneServer\n";
return false;
}
}
active_scene = sceneServer->GetActiveScene();
if (active_scene.get() == 0)
{
base.GetLog()->Error()
<< "ERROR: (SoccerBase: " << base.GetName()
<< ", SceneServer reports no active scene\n";
return false;
}
return true;
}
示例2: GetAgentBoundingRect
AABB2 SoccerBase::GetAgentBoundingRect(const Leaf& base)
{
AABB2 boundingRect;
boost::shared_ptr<Space> parent = base.FindParentSupportingClass<Space>().lock();
if (!parent)
{
base.GetLog()->Error()
<< "(GetAgentBoundingBox) ERROR: can't get parent node.\n";
return boundingRect;
}
/* We can't simply use the GetWorldBoundingBox of the space node, becuase
* (at least currently) it'll return a wrong answer. Currently, the space
* object is always at (0,0,0) which is encapsulated in the result of it's
* GetWorldBoundingBox method call.
*/
Leaf::TLeafList baseNodes;
parent->ListChildrenSupportingClass<Collider>(baseNodes,true);
if (baseNodes.empty())
{
base.GetLog()->Error()
<< "(GetAgentBoundingBox) ERROR: space object doesn't have any"
<< " children of type BaseNode.\n";
}
for (Leaf::TLeafList::iterator i = baseNodes.begin(); i!= baseNodes.end(); ++i)
{
boost::shared_ptr<BaseNode> node = shared_static_cast<BaseNode>(*i);
const AABB3 &box = node->GetWorldBoundingBox();
boundingRect.Encapsulate(box.minVec.x(), box.minVec.y());
boundingRect.Encapsulate(box.maxVec.x(), box.maxVec.y());
}
return boundingRect;
}
示例3: GetBody
bool
SoccerBase::GetBody(const Leaf& base, boost::shared_ptr<RigidBody>& body)
{
boost::shared_ptr<Transform> parent;
if (! GetTransformParent(base,parent))
{
base.GetLog()->Error() << "(SoccerBase) ERROR: no transform parent "
<< "found in GetBody()\n";
return false;
}
body = shared_dynamic_cast<RigidBody>(parent->FindChildSupportingClass<RigidBody>());
if (body.get() == 0)
{
base.GetLog()->Error()
<< "ERROR: (SoccerBase: " << base.GetName()
<< ") parent node has no Body child.";
return false;
}
return true;
}
示例4: if
bool
SoccerBase::GetAgentState(const Leaf& base, TTeamIndex idx,
int unum, boost::shared_ptr<AgentState>& agentState)
{
static TAgentStateMap mAgentStateMapLeft;
static TAgentStateMap mAgentStateMapRight;
if (idx == TI_NONE)
return false;
// do we have a cached reference?
if (
idx == TI_LEFT &&
!mAgentStateMapLeft.empty()
)
{
TAgentStateMap::iterator iter = mAgentStateMapLeft.find(unum);
if (iter != mAgentStateMapLeft.end())
{
// is the pointer to the parent (AgentAspect) still valid
// (maybe the agent disconnected)?
if (!(iter->second)->GetParent().lock().get())
{
base.GetLog()->Error() << "(SoccerBase) WARNING: "
<< "AgentState has invalid parent! "
<< "The agent probably disconnected, removing from map."
<< "\n";
mAgentStateMapLeft.erase(iter);
}
else
{
agentState = (*iter).second;
return true;
}
}
}
else if (
idx == TI_RIGHT &&
!mAgentStateMapRight.empty()
)
{
TAgentStateMap::iterator iter = mAgentStateMapRight.find(unum);
if (iter != mAgentStateMapRight.end())
{
// is the pointer to the parent (AgentAspect) still valid
// (maybe the agent disconnected)?
if ((iter->second)->GetParent().lock().get() == 0)
{
base.GetLog()->Error() << "(SoccerBase) WARNING: "
<< "AgentState has invalid parent! "
<< "The agent probably disconnected, removing from map."
<< "\n";
mAgentStateMapRight.erase(iter);
}
else
{
agentState = (*iter).second;
return true;
}
}
}
// we have to get all agent states for this team
TAgentStateList agentStates;
GetAgentStates(base, agentStates, idx);
for (TAgentStateList::iterator iter = agentStates.begin();
iter != agentStates.end();
++iter)
{
if ((*iter)->GetUniformNumber() == unum)
{
agentState = *iter;
if (idx == TI_LEFT)
{
mAgentStateMapLeft[unum] = agentState;
}
else
{
mAgentStateMapRight[unum] = agentState;
}
return true;
}
}
return false;
}