Wildmeshing Toolkit
CachedMultiMesh.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <memory>
4 namespace wmtk {
5 class Mesh;
6 }
7 
8 namespace wmtk::io {
9 
10 
11 // temporary hack for the deadline. In the future meshes need to store their own names if they want
12 // to be accessed by name
14 {
15 public:
17  const std::string& name,
18  std::map<std::string, std::vector<int64_t>> multimesh_names,
19  std::shared_ptr<Mesh> root = nullptr);
21 
22  void load(const std::filesystem::path& path);
23  void load(std::shared_ptr<Mesh> root);
24  void flush();
25  // passed in mesh.uv
26  std::shared_ptr<Mesh> get_from_path(const std::string& name);
27 
28 
29  std::shared_ptr<Mesh> get(const std::string& name);
30  std::shared_ptr<Mesh> get_root();
31 
32  const std::vector<int64_t>& get_id(const std::string& name) const;
33  const std::vector<int64_t>& get_id_from_path(const std::string& name) const;
34 
35  const std::map<std::string, std::vector<int64_t>>& get_multimesh_names() const;
36 
37 
40 
41 private:
42  std::string m_name;
43  std::shared_ptr<Mesh> m_root;
44  // "uv" "position"
45  // "mesh.uv" "mesh.position"
46  std::map<std::string, std::vector<int64_t>> m_multimesh_names;
47 };
48 
49 
50 } // namespace wmtk::io
const std::map< std::string, std::vector< int64_t > > & get_multimesh_names() const
std::map< std::string, std::vector< int64_t > > m_multimesh_names
std::shared_ptr< Mesh > get_from_path(const std::string &name)
std::shared_ptr< Mesh > get(const std::string &name)
void load(const std::filesystem::path &path)
CachedMultiMesh(const std::string &name, std::map< std::string, std::vector< int64_t >> multimesh_names, std::shared_ptr< Mesh > root=nullptr)
CachedMultiMesh & operator=(CachedMultiMesh &&)
const std::vector< int64_t > & get_id(const std::string &name) const
const std::vector< int64_t > & get_id_from_path(const std::string &name) const
std::shared_ptr< Mesh > get_root()
std::shared_ptr< Mesh > m_root
CachedMultiMesh(CachedMultiMesh &&)
Definition: Accessor.hpp:6