forked from microsoft/AirSim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugin refactoring to sync with AirLib
- Loading branch information
Showing
54 changed files
with
623 additions
and
876 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
#ifndef air_ApiProvider_hpp | ||
#define air_ApiProvider_hpp | ||
|
||
#include "VehicleApiBase.hpp" | ||
#include "VehicleSimApiBase.hpp" | ||
#include "WorldSimApiBase.hpp" | ||
#include <map> | ||
|
||
|
||
namespace msr { namespace airlib { | ||
|
||
class ApiProvider { | ||
public: | ||
ApiProvider(WorldSimApiBase * world_sim_api) | ||
: world_sim_api_(world_sim_api) | ||
{ | ||
} | ||
|
||
//vehicle API | ||
virtual VehicleApiBase* getVehicleApi(const std::string& vehicle_name = "") | ||
{ | ||
return Utils::findOrDefault(vehicle_apis_, vehicle_name, | ||
static_cast<VehicleApiBase*>(nullptr)); | ||
} | ||
|
||
//world simulation API | ||
virtual WorldSimApiBase* getWorldSimApi() | ||
{ | ||
return world_sim_api_; | ||
} | ||
|
||
//vehicle simulation API | ||
virtual VehicleSimApiBase* getVehicleSimApi(const std::string& vehicle_name = "") | ||
{ | ||
return Utils::findOrDefault(vehicle_sim_apis_, vehicle_name, | ||
static_cast<VehicleSimApiBase*>(nullptr)); | ||
} | ||
|
||
size_t getVehicleCount() const | ||
{ | ||
return vehicle_apis_.size(); | ||
} | ||
void insert_or_assign(const std::string& vehicle_name, VehicleApiBase* vehicle_api, VehicleSimApiBase* vehicle_sim_api) | ||
{ | ||
vehicle_apis_[vehicle_name] = vehicle_api; | ||
vehicle_sim_apis_[vehicle_name] = vehicle_sim_api; | ||
} | ||
|
||
|
||
private: | ||
WorldSimApiBase* world_sim_api_; | ||
std::map<std::string, VehicleApiBase*> vehicle_apis_; | ||
std::map<std::string, VehicleSimApiBase*> vehicle_sim_apis_; | ||
|
||
}; | ||
|
||
}} //namespace | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.