Exemplo n.º 1
0
////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Copies the data.
///
////////////////////////////////////////////////////////////////////////////////////
void Vehicle::CopyVehicleMap(const Vehicle::Map& src, Vehicle::Map& dest)
{
    Map::const_iterator s;
    DeleteVehicleMap(dest);
    for(s = src.begin();
            s != src.end();
            s++)
    {
        dest[s->first] = (Vehicle *)s->second->Clone();
    }
}
Exemplo n.º 2
0
////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Deletes all data in the list.
///
////////////////////////////////////////////////////////////////////////////////////
void Vehicle::DeleteVehicleMap(Vehicle::Map& list)
{
    Map::iterator s;
    for(s = list.begin();
            s != list.end();
            s++)
    {
        delete s->second;
    }
    list.clear();
}
Exemplo n.º 3
0
////////////////////////////////////////////////////////////////////////////////////
///
///   \brief Prints service status to console.
///
////////////////////////////////////////////////////////////////////////////////////
void SubsystemCommand::PrintStatus() const
{
    Vehicle::Map vehicles;

    GetComponent()->DiscoveryService()->GetVehicles(vehicles);

    Vehicle::Map::const_iterator subsystem;
    for(subsystem = vehicles.begin();
        subsystem != vehicles.end();
        subsystem++)
    {
        std::cout << "========================================================================\n";
        std::cout << "Vehicle [" << subsystem->first << "] - " << subsystem->second->mIdentification << std::endl;
        Subsystem::Configuration::const_iterator node;
        for(node = subsystem->second->mConfiguration.begin();
            node != subsystem->second->mConfiguration.end();
            node++)
        {
            Subsystem::Component::Set::const_iterator component;
            for(component = node->second.begin();
                component != node->second.end();
                component++)
            {
                if(GetComponent()->AccessControlService()->HaveControl(component->mID))
                {
                    std::cout << "    Controlling: " << component->mIdentification << " - " << component->mID.ToString() << std::endl;
                }
                else
                {
                    std::cout << "    " << component->mIdentification << " - " << component->mID.ToString() << std::endl;
                }                
            }
        }
        std::cout << "    ";
        subsystem->second->mPosition.Print();
        double x, y, z;
        x = fabs(subsystem->second->mAttitude.mX) < .001 ? 0.0 : subsystem->second->mAttitude.mX;
        y = fabs(subsystem->second->mAttitude.mY) < .001 ? 0.0 : subsystem->second->mAttitude.mY;
        z = fabs(subsystem->second->mAttitude.mZ) < .001 ? 0.0 : subsystem->second->mAttitude.mZ;
        std::cout << "    A <" << x << ", " << y << ", " << z << ">\n    ";
        x = fabs(subsystem->second->mLinearVelocity.mX) < .001 ? 0.0 : subsystem->second->mLinearVelocity.mX;
        y = fabs(subsystem->second->mLinearVelocity.mY) < .001 ? 0.0 : subsystem->second->mLinearVelocity.mY;
        z = fabs(subsystem->second->mLinearVelocity.mZ) < .001 ? 0.0 : subsystem->second->mLinearVelocity.mZ;
        std::cout << "    V <" << x << ", " << y << ", " << z << ">\n    ";
        std::cout << subsystem->second->mUpdateTime.ToString() << std::endl;
    }  

    Vehicle::DeleteVehicleMap(vehicles);
}