DNA Calib 1.1
Project brief
FileStreamImpl.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
9
10#include <pma/TypeDefs.h>
11
12#ifdef _MSC_VER
13 #pragma warning(push)
14 #pragma warning(disable : 4365 4987)
15#endif
16#include <cstddef>
17#include <cstdint>
18#include <fstream>
19#include <ios>
20#ifdef _MSC_VER
21 #pragma warning(pop)
22#endif
23
24namespace trio {
25
26class FileStreamImpl : public FileStream {
27 public:
28 FileStreamImpl(const char* path_, AccessMode accessMode_, OpenMode openMode_, MemoryResource* memRes_);
29
30 void open() override;
31 void close() override;
32 std::uint64_t tell() override;
33 void seek(std::uint64_t position) override;
34 std::uint64_t size() override;
35 std::size_t read(char* destination, std::size_t size) override;
36 std::size_t read(Writable* destination, std::size_t size) override;
37 std::size_t write(const char* source, std::size_t size) override;
38 std::size_t write(Readable* source, std::size_t size) override;
39
41
42 private:
43 std::fstream file;
47 std::uint64_t fileSize;
50};
51
52} // namespace trio
MemoryResource is an abstract class that allows the implementation of polymorphic allocators.
Definition: MemoryResource.h:17
Definition: FileStreamImpl.h:26
NativeString filePath
Definition: FileStreamImpl.h:44
MemoryResource * memRes
Definition: FileStreamImpl.h:48
std::fstream file
Definition: FileStreamImpl.h:43
std::size_t write(const char *source, std::size_t size) override
Writes bytes from the given buffer to the stream.
Definition: FileStreamImpl.cpp:153
std::uint64_t tell() override
Get the current position in the stream.
Definition: FileStreamImpl.cpp:99
OpenMode fileOpenMode
Definition: FileStreamImpl.h:46
MemoryResource * getMemoryResource()
Definition: FileStreamImpl.cpp:204
void close() override
Close access to the stream.
Definition: FileStreamImpl.cpp:95
void seek(std::uint64_t position) override
Set the current position in the stream.
Definition: FileStreamImpl.cpp:103
std::uint64_t fileSize
Definition: FileStreamImpl.h:47
std::uint64_t size() override
Obtain size of stream in bytes.
Definition: FileStreamImpl.cpp:200
std::size_t read(char *destination, std::size_t size) override
Read bytes from stream into the given buffer.
Definition: FileStreamImpl.cpp:116
FileStreamImpl(const char *path_, AccessMode accessMode_, OpenMode openMode_, MemoryResource *memRes_)
Definition: FileStreamImpl.cpp:61
StreamStatus status
Definition: FileStreamImpl.h:49
void open() override
Open access to the stream.
Definition: FileStreamImpl.cpp:69
AccessMode fileAccessMode
Definition: FileStreamImpl.h:45
Standard file stream.
Definition: FileStream.h:13
Definition: Concepts.h:14
Definition: StreamStatus.h:11
Definition: Concepts.h:42
Definition: Concepts.h:10
AccessMode
Definition: Parameters.h:7
OpenMode
Definition: Parameters.h:13
pma::String< NativeCharacter > NativeString
Definition: NativeString.h:76