1 /** 2 * \file RMF/paths.cpp 3 * \brief Handle read/write of Model data from/to files. 4 * 5 * Copyright 2007-2021 IMP Inventors. All rights reserved. 6 * 7 */ 8 9 #include <boost/filesystem/path.hpp> 10 11 #include "MultipleAvroFileBase.h" 12 #include "RMF/internal/paths.h" 13 #include "AllJSON.h" 14 #include "AvroKeysAndCategories.h" 15 16 RMF_ENABLE_WARNINGS 17 18 namespace RMF { 19 namespace avro_backend { 20 get_category_dynamic_file_path(Category cat) const21std::string MultipleAvroFileBase::get_category_dynamic_file_path(Category cat) 22 const { 23 boost::filesystem::path base = get_file_path(); 24 boost::filesystem::path full = base / (get_name(cat) + ".frames"); 25 return full.string(); 26 } get_category_static_file_path(Category cat) const27std::string MultipleAvroFileBase::get_category_static_file_path(Category cat) 28 const { 29 boost::filesystem::path base = get_file_path(); 30 boost::filesystem::path full = base / (get_name(cat) + ".static"); 31 return full.string(); 32 } get_file_file_path() const33std::string MultipleAvroFileBase::get_file_file_path() const { 34 boost::filesystem::path base = get_file_path(); 35 boost::filesystem::path full = base / "file.rmf2info"; 36 return full.string(); 37 } get_nodes_file_path() const38std::string MultipleAvroFileBase::get_nodes_file_path() const { 39 boost::filesystem::path base = get_file_path(); 40 boost::filesystem::path full = base / "nodes"; 41 return full.string(); 42 } get_static_file_path() const43std::string MultipleAvroFileBase::get_static_file_path() const { 44 boost::filesystem::path base = get_file_path(); 45 boost::filesystem::path full = base / "static_data"; 46 return full.string(); 47 } get_frames_file_path() const48std::string MultipleAvroFileBase::get_frames_file_path() const { 49 boost::filesystem::path base = get_file_path(); 50 boost::filesystem::path full = base / "frames"; 51 return full.string(); 52 } 53 MultipleAvroFileBase(std::string path)54MultipleAvroFileBase::MultipleAvroFileBase(std::string path) 55 : AvroKeysAndCategories(path) { 56 null_static_data_.frame = -1; 57 null_data_.frame = 0; 58 null_frame_data_.name = "static"; 59 null_frame_data_.type = "static"; 60 } 61 set_loaded_frame(FrameID frame)62void MultipleAvroFileBase::set_loaded_frame(FrameID frame) { 63 null_data_.frame = frame.get_index(); 64 AvroKeysAndCategories::set_loaded_frame(frame); 65 } 66 67 } // namespace avro_backend 68 } /* namespace RMF */ 69 70 RMF_DISABLE_WARNINGS 71