本文整理汇总了C++中TLeafList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ TLeafList::empty方法的具体用法?C++ TLeafList::empty怎么用?C++ TLeafList::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLeafList
的用法示例。
在下文中一共展示了TLeafList::empty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseCustomPredicates
void SparkMonitorLogFileServer::ParseCustomPredicates(sexp_t* sexp)
{
// ( (name param1 param2 ...) (name param1 param2 ...) ... )
if (sexp == 0)
{
return;
}
// get list of registered CustomMonitor objects
TLeafList customList;
ListChildrenSupportingClass<CustomMonitor>(customList);
customList.push_back(GetCore()->Get("/sys/server/simulation/SparkMonitorClient/SoccerMonitor"));
if (customList.empty())
{
return;
}
// parse predicates
PredicateList pList;
sexp = sexp->list;
while (sexp != 0)
{
if (sexp->ty == SEXP_LIST)
{
sexp_t* sPred = sexp->list;
ParseCustomPredicates(sPred,pList);
}
sexp = sexp->next;
}
// pass predicates to all registered CustomMonitor objects
for (
TLeafList::iterator iter = customList.begin();
iter != customList.end();
++iter
)
{
static_pointer_cast<CustomMonitor>((*iter))
->ParseCustomPredicates(pList);
}
}
示例2: ParseCustomPredicates
void SparkMonitorClient::ParseCustomPredicates(sexp_t* sexp)
{
// ( (name param1 param2 ...) (name param1 param2 ...) ... )
if (sexp == 0)
{
return;
}
// get list of registered CustomMonitor objects
TLeafList customList;
ListChildrenSupportingClass<CustomMonitor>(customList);
if (customList.empty())
{
return;
}
// parse predicates
PredicateList pList;
sexp = sexp->list;
while (sexp != 0)
{
if (sexp->ty == SEXP_LIST)
{
sexp_t* sPred = sexp->list;
ParseCustomPredicates(sPred,pList);
}
sexp = sexp->next;
}
// pass predicates to all registered CustomMonitor objects
for (
TLeafList::iterator iter = customList.begin();
iter != customList.end();
++iter
)
{
shared_static_cast<CustomMonitor>((*iter))
->ParseCustomPredicates(pList);
}
}
示例3: ImportScene
bool SceneServer::ImportScene(const string& fileName, boost::shared_ptr<BaseNode> root,
boost::shared_ptr<ParameterList> parameter)
{
string file;
if (! GetFile()->LocateResource(fileName, file))
{
GetLog()->Error() << "(SceneServer) ERROR: cannot locate file '"
<< fileName << "'\n";
return false;
}
if (root.get() == 0)
{
GetLog()->Error()
<< "(SceneServer) ERROR: NULL node given as ImportScene "
<< "root node, fileName was " << fileName << "\n";
}
GetLog()->Debug() << "(SceneServer) ImportScene fileName=" << fileName
<< " root=" << root->GetFullPath() << "\n";
TLeafList importer;
ListChildrenSupportingClass<SceneImporter>(importer);
if (importer.empty())
{
GetLog()->Error()
<< "(SceneServer) Warning: no SceneImporter registered\n";
}
// because the importer will create ODE objects,
// so we have to lock the ODE
boost::recursive_mutex::scoped_lock lock(mMutex);
for (
TLeafList::iterator iter = importer.begin();
iter != importer.end();
++iter
)
{
boost::shared_ptr<SceneImporter> importer =
shared_static_cast<SceneImporter>(*iter);
importer->SetSceneDict(&SceneDict::GetInstance());
GetLog()->Debug()
<< "(SceneServer) trying importer " << importer->GetName() << std::endl;
if (importer->ImportScene(file,root,parameter))
{
GetLog()->Debug()
<< "(SceneServer) imported scene file '"
<< file << " with '"
<< importer->GetName()
<< " at " << root->GetFullPath() << endl;
RemoveTransformPaths(root);
// mark the corresponding scene as modified
boost::shared_ptr<Scene> scene = root->GetScene();
if (scene.get() != 0)
{
scene->SetModified(true);
}
return true;
}
}
GetLog()->Error() << "(SceneServer) ERROR: cannot import scene file '"
<< file << "'\n";
return false;
}
示例4: SelectCamera
void SoccerInput::SelectCamera(int idx)
{
// get list of registered SoccerMonitor objects
TLeafList soccerMonitorList;
mMonitorClient->ListChildrenSupportingClass<SoccerMonitor>(soccerMonitorList);
if (soccerMonitorList.empty())
{
GetLog()->Error()
<< "ERROR: (SoccerInput) Unable to get SoccerMonitor\n";
return;
}
boost::shared_ptr<SoccerMonitor> soccerMonitor =
shared_static_cast<SoccerMonitor>(soccerMonitorList.front());
salt::Vector2f fieldSize = soccerMonitor->GetFieldSize();
switch (idx)
{
case 0:
{
salt::Vector3f pos(-fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(90);
mFPS->SetVAngleDeg(35);
}
break;
case 1:
{
salt::Vector3f pos(-fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(50);
mFPS->SetVAngleDeg(30);
}
break;
case 2:
{
salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(salt::gRadToDeg(-0.625));
mFPS->SetVAngleDeg(40);
}
break;
case 3:
{
salt::Vector3f pos(0, -fieldSize.y()*1.1, fieldSize.x()*0.6);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(0);
mFPS->SetVAngleDeg(45);
}
break;
case 4:
{
salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(salt::gRadToDeg(0.625));
mFPS->SetVAngleDeg(40);
}
break;
case 5:
{
salt::Vector3f pos(fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(-50);
mFPS->SetVAngleDeg(30);
}
break;
case 6:
{
salt::Vector3f pos(fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(-90);
mFPS->SetVAngleDeg(35);
}
break;
}
}
示例5: ProcessInput
void SoccerInput::ProcessInput(const Input& input)
{
// get list of registered SoccerMonitor objects
TLeafList soccerMonitorList;
mMonitorClient->ListChildrenSupportingClass<SoccerMonitor>(soccerMonitorList);
if (soccerMonitorList.empty())
{
GetLog()->Error()
<< "ERROR: (SoccerInput) Unable to get SoccerMonitor\n";
return;
}
shared_ptr<SoccerMonitor> soccerMonitor =
shared_static_cast<SoccerMonitor>(soccerMonitorList.front());
switch (input.mId)
{
default:
return;
case CmdKickOff:
if (input.GetKeyPress())
{
SendCommand("(kickOff Left)");
}
break;
case CmdKickOffRight:
if (input.GetKeyPress())
{
SendCommand("(kickOff Right)");
}
break;
case CmdMoveAgent:
if (input.GetKeyPress())
{
//SendCommand("(agent (team Left)(unum 1)(pos -2.0 1.0 3.5))");
}
break;
case CmdDropBall:
if (input.GetKeyPress())
{
SendCommand("(dropBall)");
}
break;
case CmdShootBall:
if (input.GetKeyPress())
{
//SendCommand("(ball (vel -4.0 0.0 2.0))");
}
break;
case CmdMoveBall:
if (input.GetKeyPress())
{
//SendCommand("(ball (pos -42.0 0.0 0.3))");
}
break;
case CmdCameraLeftGoal:
if (input.GetKeyPress())
{
salt::Vector2f fieldSize = soccerMonitor->GetFieldSize();
salt::Vector3f pos(-fieldSize.x()*0.8, 0.0, fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(90);
mFPS->SetVAngleDeg(35);
}
break;
case CmdCameraLeftCorner:
if (input.GetKeyPress())
{
salt::Vector2f fieldSize = soccerMonitor->GetFieldSize();
salt::Vector3f pos(-fieldSize.x()*0.8, -fieldSize.y(), fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(50);
mFPS->SetVAngleDeg(30);
}
break;
case CmdCameraMiddleLeft:
if (input.GetKeyPress())
{
salt::Vector2f fieldSize = soccerMonitor->GetFieldSize();
salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(salt::gRadToDeg(-0.625));
mFPS->SetVAngleDeg(40);
}
break;
case CmdCameraMiddleRight:
if (input.GetKeyPress())
{
salt::Vector2f fieldSize = soccerMonitor->GetFieldSize();
salt::Vector3f pos(0, -fieldSize.y(), fieldSize.x()*0.4);
mCameraBody->SetPosition(pos);
mFPS->SetHAngleDeg(salt::gRadToDeg(0.625));
mFPS->SetVAngleDeg(40);
}
break;
case CmdCameraMiddle:
if (input.GetKeyPress())
//.........这里部分代码省略.........