16 #ifndef SURGSIM_DEVICES_MULTIAXIS_WIN32_FILEHANDLE_H
17 #define SURGSIM_DEVICES_MULTIAXIS_WIN32_FILEHANDLE_H
74 bool readBytes(
void* dataBuffer,
unsigned int bytesToRead,
unsigned int* bytesActuallyRead);
78 RawHandleType
get()
const;
126 #endif // SURGSIM_DEVICES_MULTIAXIS_WIN32_FILEHANDLE_H
Definition: DriveElementFromInputBehavior.cpp:27
void setFileOpenFlags(uint64_t flags)
Sets the flags that will be passed to CreateFile when opening the file.
Definition: FileHandle.cpp:145
uint64_t getFileOpenFlags() const
Gets the flags that will be passed to CreateFile when opening the file.
Definition: FileHandle.cpp:151
bool hasDataToRead() const
Checks whether this object has data available to be read.
Definition: FileHandle.cpp:156
void * RawHandleType
Type of the raw handle used by the operating system.
Definition: FileHandle.h:35
bool canWrite() const
Determines if the file handle can be written to.
Definition: FileHandle.cpp:80
~FileHandle()
Destructor.
Definition: FileHandle.cpp:65
A wrapper for an Windows-style HANDLE file descriptor.
Definition: FileHandle.h:30
bool openForReading(const std::string &path)
Attempts to open the file handle for reading only.
Definition: FileHandle.cpp:102
FileHandle & operator=(FileHandle &&other)
Move assignment operator.
Definition: FileHandle.cpp:55
bool canRead() const
Determines if the file handle can be read from.
Definition: FileHandle.cpp:75
uint64_t m_openFlags
Definition: FileHandle.h:120
bool openForWriting(const std::string &path)
Attempts to open the file handle for writing only.
Definition: FileHandle.cpp:113
bool openForReadingAndMaybeWriting(const std::string &path)
Attempts to open the file handle for reading and (if permissions allow it) writing.
Definition: FileHandle.cpp:124
bool m_canRead
Definition: FileHandle.h:118
void reset()
Resets the file handle back to an invalid state.
Definition: FileHandle.cpp:136
bool openForReadingAndWriting(const std::string &path)
Attempts to open the file handle for reading and writing.
Definition: FileHandle.cpp:91
RawHandleType m_handle
Definition: FileHandle.h:117
bool isValid() const
Checks if the file handle is valid, i.e.
Definition: FileHandle.cpp:70
bool readBytes(void *dataBuffer, unsigned int bytesToRead, unsigned int *bytesActuallyRead)
Reads bytes from the file handle.
Definition: FileHandle.cpp:169
FileHandle()
Default constructor.
Definition: FileHandle.cpp:38
bool m_canWrite
Definition: FileHandle.h:119