anyKode Marilou
ContentsIndexHome
PreviousUpNext
RobotPHX::GetEntitiesList

GetEntitiesList obtains the list of the entities contained in the PHX.

C++
xkode::lib::ObjectsArray<xkode::lib::String> GetEntitiesList(Marilou::Commons::ActiveEntityClasses Filter, bool RecurseInSubPHXs);
Parameters 
Description 
Marilou::Commons::ActiveEntityClasses Filter 
[in] Filter of research 
bool RecurseInSubPHXs 
[in] Indicates if the research is recursive (PHXs children) or not (the current PHX only) 

The research is made from the current PHX and only the entities witch match to the filter are returned. If the research is recursive, the entities inside childs sub PHX(s) are returned. In this case returned entities names are relative to the current PHX.

//MODA C++ native code sample

#include "stdafx.h"
#include "Modacpp.h"
#include "conio.h"

#define MODASERVER "localhost"

//----------------------------------------------------------------------------
void Enum(ModaCPP::RobotPHX *pRobot, Marilou::Commons::ActiveEntityClasses filter)
{
xkode::lib::ObjectsArray<xkode::lib::String> list=pRobot->GetEntitiesList(filter,true);
for(int i=0;i<list.Count();i++)
    {
    _cprintf("\t%s\r\n",list[i].GetData());
    }
}

//----------------------------------------------------------------------------
int main(int argc, TCHAR* argv[])
{
ModaCPP::Connection *connection=new ModaCPP::Connection(true);
if(connection->Connect(MODASERVER))
    {
    _cprintf("Connection ok to moda server\r\n");

    xkode::lib::ObjectsArray<xkode::lib::String> PHXlist=connection->GetRobotPHXsList();
    _cprintf("%d PHX(s) found:\r\n",PHXlist.Count());
    for(int i=0;i<PHXlist.Count();i++)
        {
        _cprintf("\t%s\r\n",PHXlist[i].GetData());
        }
    _cprintf("End of PHX enums\r\n\n");

    if(PHXlist.Count()>=1)
        {
        xkode::lib::String ChoosenRobot=PHXlist[1];
        ModaCPP::RobotPHX *pRobot=connection->QueryRobotPHX(ChoosenRobot);
        if(pRobot)
            {
            _cprintf("Connected to %s\r\n\n",ChoosenRobot.GetData());

            _cprintf("Enum physics entities:\r\n");
            Enum(pRobot,Marilou::Commons::ActiveEntityClasses::PhysicsGeoms);

            _cprintf("Enum devices:\r\n");
            Enum(pRobot,Marilou::Commons::ActiveEntityClasses::CoreDevice);

            _cprintf("Enum all:\r\n");
            Enum(pRobot,Marilou::Commons::ActiveEntityClasses::All);
            }
        else
            {
            _cprintf("Cannot connected to %s\r\n",ChoosenRobot.GetData());
            }
        }
    else
        {
        _cprintf("No PHX in this world ...\r\n");
        }
    }
else
    {
    _cprintf("Unable to connect to moda server\r\n");
    }

connection->Disconnect();
delete connection;
_getch();
return 0;
}
Documentation v4.7 (18/01/2015), Copyright (c) 2015 anyKode. All rights reserved.
What do you think about this topic? Send feedback!