static File* open(const std::string& fullpath, void* userdata);
static File* open(const std::string& fullpath, const_sg_host_t host, void* userdata);
- void close() { delete this; };
+ void close();
/** Retrieves the path to the file */
const char* get_path() const { return fullpath_.c_str(); }
});
}
-File::~File()
-{
- std::vector<int>* desc_table =
- Host::current()->extension<simgrid::s4u::FileDescriptorHostExt>()->file_descriptor_table.get();
- kernel::actor::simcall_answered([this, desc_table] { desc_table->push_back(this->desc_id); });
-}
+File::~File() = default;
File* File::open(const std::string& fullpath, void* userdata)
{
return new File(fullpath, host, userdata);
}
+void File::close()
+{
+ std::vector<int>* desc_table =
+ Host::current()->extension<simgrid::s4u::FileDescriptorHostExt>()->file_descriptor_table.get();
+ kernel::actor::simcall_answered([this, desc_table] { desc_table->push_back(this->desc_id); });
+ delete this;
+}
+
void File::dump() const
{
XBT_INFO("File Descriptor information:\n"