00001 /* 00002 * Copyright 2018 The Cartographer Authors 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef CARTOGRAPHER_CLOUD_MAP_BUILDER_SERVER_INTERFACE_H 00018 #define CARTOGRAPHER_CLOUD_MAP_BUILDER_SERVER_INTERFACE_H 00019 00020 #include <memory> 00021 00022 #include "cartographer/cloud/proto/map_builder_server_options.pb.h" 00023 #include "cartographer/mapping/map_builder_interface.h" 00024 #include "cartographer/metrics/family_factory.h" 00025 00026 namespace cartographer { 00027 namespace cloud { 00028 00029 class MapBuilderServerInterface { 00030 public: 00031 virtual ~MapBuilderServerInterface() {} 00032 00033 // Starts the gRPC server, the 'LocalTrajectoryUploader' and the SLAM thread. 00034 virtual void Start() = 0; 00035 00036 // Waits for the 'MapBuilderServer' to shut down. Note: The server must be 00037 // either shutting down or some other thread must call 'Shutdown()' for 00038 // this function to ever return. 00039 virtual void WaitForShutdown() = 0; 00040 00041 // Waits until all computation is finished (for testing). 00042 virtual void WaitUntilIdle() = 0; 00043 00044 // Shuts down the gRPC server, the 'LocalTrajectoryUploader' and the SLAM 00045 // thread. 00046 virtual void Shutdown() = 0; 00047 }; 00048 00049 // Registers all metrics for the MapBuilderServer. 00050 void RegisterMapBuilderServerMetrics(metrics::FamilyFactory* factory); 00051 00052 // Returns MapBuilderServer with the actual implementation. 00053 std::unique_ptr<MapBuilderServerInterface> CreateMapBuilderServer( 00054 const proto::MapBuilderServerOptions& map_builder_server_options, 00055 std::unique_ptr<mapping::MapBuilderInterface> map_builder); 00056 00057 } // namespace cloud 00058 } // namespace cartographer 00059 00060 #endif // CARTOGRAPHER_CLOUD_MAP_BUILDER_SERVER_INTERFACE_H