Virtual Testbed
Ship dynamics simulator for extreme conditions
convert.hh
1 #ifndef VTESTBED_ASSETS_CONVERT_HH
2 #define VTESTBED_ASSETS_CONVERT_HH
3 
4 #include <any>
5 
6 #include <vtestbed/assets/format.hh>
7 #include <vtestbed/assets/options.hh>
8 
9 namespace vtb {
10 
11  namespace assets {
12 
13  template <class T> T import_asset(Options options);
14  std::any import_asset(Options options);
15  template <class To, class From> To convert(const From& from, Options options);
16  template <class T> T convert(std::any from, Options options);
17  std::any convert(std::any from, Options options);
18  template <class T> void export_asset(const T& asset, Options options);
19  void export_asset(std::any asset, Options options);
20 
21  template <class To, class From> To inline convert(std::any from, Options options) {
22  return convert<To,From>(std::any_cast<From>(from), std::move(options));
23  }
24  template <class T> inline void export_asset(std::any asset, Options options) {
25  return export_asset<T>(std::any_cast<T>(asset), std::move(options));
26  }
27 
28  }
29 
30 }
31 
32 #endif // vim:filetype=cpp
Main namespace.
Definition: convert.hh:9