CARLA
LibCarla/source/test/client/OpenDrive.cpp
Go to the documentation of this file.
1 // Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #include "OpenDrive.h"
8 
9 #ifndef LIBCARLA_TEST_CONTENT_FOLDER
10 # error Please define LIBCARLA_TEST_CONTENT_FOLDER.
11 #endif
12 
13 #include <carla/FileSystem.h>
14 
15 #include <fstream>
16 #include <streambuf>
17 
18 namespace util {
19 
20  std::vector<std::string> OpenDrive::GetAvailableFiles() {
22  LIBCARLA_TEST_CONTENT_FOLDER "/OpenDrive/",
23  "*.xodr");
24  }
25 
26  std::string OpenDrive::Load(const std::string &filename) {
27  const std::string opendrive_folder = LIBCARLA_TEST_CONTENT_FOLDER "/OpenDrive/";
28  std::ifstream file(opendrive_folder + filename);
29  return std::string{std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()};
30  }
31 
32 } // namespace util
static std::string Load(const std::string &filename)
static std::vector< std::string > GetAvailableFiles()
static std::vector< std::string > ListFolder(const std::string &folder_path, const std::string &wildcard_pattern)
List (not recursively) regular files at folder_path matching wildcard_pattern.
Definition: FileSystem.cpp:33