Skip to content

Commit

Permalink
do the clang-formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
lovettchris committed May 14, 2021
1 parent 7fe46fe commit 0edf734
Show file tree
Hide file tree
Showing 410 changed files with 58,013 additions and 49,105 deletions.
120 changes: 61 additions & 59 deletions AirLib/include/api/ApiProvider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,72 +10,74 @@
#include <map>
#include "common/common_utils/UniqueValueMap.hpp"

namespace msr
{
namespace airlib
{

namespace msr { namespace airlib {

class ApiProvider {
public:
ApiProvider(WorldSimApiBase * world_sim_api)
: world_sim_api_(world_sim_api)
{
}
virtual ~ApiProvider() = default;


//vehicle API
virtual VehicleApiBase* getVehicleApi(const std::string& vehicle_name)
class ApiProvider
{
return vehicle_apis_.findOrDefault(vehicle_name, nullptr);
}
public:
ApiProvider(WorldSimApiBase* world_sim_api)
: world_sim_api_(world_sim_api)
{
}
virtual ~ApiProvider() = default;

//world simulation API
virtual WorldSimApiBase* getWorldSimApi()
{
return world_sim_api_;
}
//vehicle API
virtual VehicleApiBase* getVehicleApi(const std::string& vehicle_name)
{
return vehicle_apis_.findOrDefault(vehicle_name, nullptr);
}

//vehicle simulation API
virtual VehicleSimApiBase* getVehicleSimApi(const std::string& vehicle_name) const
{
return vehicle_sim_apis_.findOrDefault(vehicle_name, nullptr);
}
//world simulation API
virtual WorldSimApiBase* getWorldSimApi()
{
return world_sim_api_;
}

size_t getVehicleCount() const
{
return vehicle_apis_.valsSize();
}
void insert_or_assign(const std::string& vehicle_name, VehicleApiBase* vehicle_api,
VehicleSimApiBase* vehicle_sim_api)
{
vehicle_apis_.insert_or_assign(vehicle_name, vehicle_api);
vehicle_sim_apis_.insert_or_assign(vehicle_name, vehicle_sim_api);
}
const common_utils::UniqueValueMap<std::string, VehicleApiBase*>& getVehicleApis()
{
return vehicle_apis_;
}
const common_utils::UniqueValueMap<std::string, VehicleSimApiBase*>& getVehicleSimApis()
{
return vehicle_sim_apis_;
}
bool hasDefaultVehicle() const
{
return !(vehicle_apis_.findOrDefault("", nullptr) == nullptr &&
vehicle_sim_apis_.findOrDefault("", nullptr) == nullptr);
}
//vehicle simulation API
virtual VehicleSimApiBase* getVehicleSimApi(const std::string& vehicle_name) const
{
return vehicle_sim_apis_.findOrDefault(vehicle_name, nullptr);
}

void makeDefaultVehicle(const std::string& vehicle_name)
{
vehicle_apis_.insert_or_assign("", vehicle_apis_.at(vehicle_name));
vehicle_sim_apis_.insert_or_assign("", vehicle_sim_apis_.at(vehicle_name));
}
size_t getVehicleCount() const
{
return vehicle_apis_.valsSize();
}
void insert_or_assign(const std::string& vehicle_name, VehicleApiBase* vehicle_api,
VehicleSimApiBase* vehicle_sim_api)
{
vehicle_apis_.insert_or_assign(vehicle_name, vehicle_api);
vehicle_sim_apis_.insert_or_assign(vehicle_name, vehicle_sim_api);
}
const common_utils::UniqueValueMap<std::string, VehicleApiBase*>& getVehicleApis()
{
return vehicle_apis_;
}
const common_utils::UniqueValueMap<std::string, VehicleSimApiBase*>& getVehicleSimApis()
{
return vehicle_sim_apis_;
}
bool hasDefaultVehicle() const
{
return !(vehicle_apis_.findOrDefault("", nullptr) == nullptr &&
vehicle_sim_apis_.findOrDefault("", nullptr) == nullptr);
}

private:
WorldSimApiBase* world_sim_api_;
void makeDefaultVehicle(const std::string& vehicle_name)
{
vehicle_apis_.insert_or_assign("", vehicle_apis_.at(vehicle_name));
vehicle_sim_apis_.insert_or_assign("", vehicle_sim_apis_.at(vehicle_name));
}

common_utils::UniqueValueMap<std::string, VehicleApiBase*> vehicle_apis_;
common_utils::UniqueValueMap<std::string, VehicleSimApiBase*> vehicle_sim_apis_;
};
private:
WorldSimApiBase* world_sim_api_;

}} //namespace
common_utils::UniqueValueMap<std::string, VehicleApiBase*> vehicle_apis_;
common_utils::UniqueValueMap<std::string, VehicleSimApiBase*> vehicle_sim_apis_;
};
}
} //namespace
#endif
22 changes: 13 additions & 9 deletions AirLib/include/api/ApiServerBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
#include <functional>
#include "common/Common.hpp"

namespace msr { namespace airlib {
namespace msr
{
namespace airlib
{

class ApiServerBase {
public:
virtual void start(bool block, std::size_t thread_count) = 0;
virtual void stop() = 0;
class ApiServerBase
{
public:
virtual void start(bool block, std::size_t thread_count) = 0;
virtual void stop() = 0;

virtual ~ApiServerBase() = default;
};

}} //namespace
virtual ~ApiServerBase() = default;
};
}
} //namespace
#endif
Loading

0 comments on commit 0edf734

Please sign in to comment.