src.ctf.fs: make ctf_fs_file_create return a unique_ptr
[babeltrace.git] / src / plugins / ctf / fs-src / file.hpp
index 59fdd48792711f462fea2f5678ddda5ebe2d3923..607c1a944e28f4a207887968b9b61a914bdad2db 100644 (file)
@@ -7,18 +7,41 @@
 #ifndef CTF_FS_FILE_H
 #define CTF_FS_FILE_H
 
-#include <stdio.h>
-#include <glib.h>
-#include "common/macros.h"
-#include "fs.hpp"
+#include <memory>
+
+#include <babeltrace2/babeltrace.h>
+
+#include "cpp-common/bt2c/logging.hpp"
+
+struct ctf_fs_file_deleter
+{
+    void operator()(struct ctf_fs_file *file) noexcept;
+};
+
+struct ctf_fs_file
+{
+    using UP = std::unique_ptr<ctf_fs_file, ctf_fs_file_deleter>;
+
+    explicit ctf_fs_file(const bt2c::Logger& parentLogger) :
+        logger {parentLogger, "PLUGIN/SRC.CTF.FS/FILE"}
+    {
+    }
+
+    bt2c::Logger logger;
+
+    /* Owned by this */
+    GString *path = nullptr;
+
+    /* Owned by this */
+    FILE *fp = nullptr;
+
+    off_t size = 0;
+};
 
-BT_HIDDEN
 void ctf_fs_file_destroy(struct ctf_fs_file *file);
 
-BT_HIDDEN
-struct ctf_fs_file *ctf_fs_file_create(bt_logging_level log_level, bt_self_component *self_comp);
+ctf_fs_file::UP ctf_fs_file_create(const bt2c::Logger& parentLogger);
 
-BT_HIDDEN
 int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode);
 
 #endif /* CTF_FS_FILE_H */
This page took 0.023385 seconds and 4 git commands to generate.