src.ctf.fs: make ctf_fs_file_create return a unique_ptr
[babeltrace.git] / src / plugins / ctf / fs-src / file.hpp
CommitLineData
e98a2d6e 1/*
0235b0db 2 * SPDX-License-Identifier: MIT
e98a2d6e 3 *
0235b0db 4 * Copyright (C) 2016 Philippe Proulx <pproulx@efficios.com>
e98a2d6e
PP
5 */
6
0235b0db
MJ
7#ifndef CTF_FS_FILE_H
8#define CTF_FS_FILE_H
9
5ff12b25
SM
10#include <memory>
11
c7e1be4b 12#include <babeltrace2/babeltrace.h>
e98a2d6e 13
97601f8e 14#include "cpp-common/bt2c/logging.hpp"
0f5c5d5c 15
5ff12b25
SM
16struct ctf_fs_file_deleter
17{
18 void operator()(struct ctf_fs_file *file) noexcept;
19};
20
97601f8e
SM
21struct ctf_fs_file
22{
5ff12b25
SM
23 using UP = std::unique_ptr<ctf_fs_file, ctf_fs_file_deleter>;
24
97601f8e
SM
25 explicit ctf_fs_file(const bt2c::Logger& parentLogger) :
26 logger {parentLogger, "PLUGIN/SRC.CTF.FS/FILE"}
27 {
28 }
0f5c5d5c 29
97601f8e
SM
30 bt2c::Logger logger;
31
32 /* Owned by this */
33 GString *path = nullptr;
34
35 /* Owned by this */
36 FILE *fp = nullptr;
37
38 off_t size = 0;
39};
0f5c5d5c 40
e98a2d6e
PP
41void ctf_fs_file_destroy(struct ctf_fs_file *file);
42
5ff12b25 43ctf_fs_file::UP ctf_fs_file_create(const bt2c::Logger& parentLogger);
e98a2d6e 44
55314f2a 45int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode);
e98a2d6e
PP
46
47#endif /* CTF_FS_FILE_H */
This page took 0.094945 seconds and 4 git commands to generate.