RMF
cloning.py
1## \example cloning.py
2# RMF includes functions to help cloning files an extracting parts. They are
3# also exposed through the [rmf_slice](\ref rmf_slice) application.
4
5import RMF
6
7in_name = RMF.get_example_path("3U7W.rmf")
8out_name = RMF._get_temporary_file_path("3U7W.out.rmfz")
9
10in_file = RMF.open_rmf_file_read_only(in_name)
11out_file = RMF.create_rmf_file(out_name)
12
13print("creating file", out_name)
14
15# copy over info like the creator, this isn't essential
16RMF.clone_file_info(in_file, out_file)
17# copy over the hierarchy
18# This is necessary in order to copy the data
19RMF.clone_hierarchy(in_file, out_file)
20
21# copy all the static data
22RMF.clone_static_frame(in_file, out_file)
23
24# go through and copy each frame
25for f in in_file.get_frames():
26 print("cloning frame", f)
27 in_file.set_current_frame(f)
28 out_file.add_frame(in_file.get_name(f), in_file.get_type(f))
29 RMF.clone_loaded_frame(in_file, out_file)
void clone_loaded_frame(FileConstHandle input, FileHandle output)
void clone_static_frame(FileConstHandle input, FileHandle output)
FileHandle create_rmf_file(std::string path)
Create an RMF from a file system path.
FileConstHandle open_rmf_file_read_only(std::string path)
void clone_hierarchy(FileConstHandle input, FileHandle output)
void clone_file_info(FileConstHandle input, FileHandle output)