MeVisLab Toolbox Reference
mlImageFormatFileAccess.h
Go to the documentation of this file.
1
/*************************************************************************************
2
**
3
** Copyright 2016, MeVis Medical Solutions AG
4
**
5
** The user may use this file in accordance with the license agreement provided with
6
** the Software or, alternatively, in accordance with the terms contained in a
7
** written agreement between the user and MeVis Medical Solutions AG.
8
**
9
** For further information use the contact form at https://www.mevislab.de/contact
10
**
11
**************************************************************************************/
12
13
#ifndef ML_IMAGE_FORMAT_FILE_ACCESS_H
14
#define ML_IMAGE_FORMAT_FILE_ACCESS_H
15
16
// Resolve platform dependencies.
17
#include "
MLImageFormatBaseSystem.h
"
18
19
#include <
mlTypeDefs.h
>
20
21
ML_START_NAMESPACE
22
26
class
MLIMAGEFORMATBASE_EXPORT
MLImageFormatAbstractFileHandle
27
{
28
public
:
30
MLImageFormatAbstractFileHandle
() {};
31
33
virtual
~MLImageFormatAbstractFileHandle
() {};
34
37
MLuint8
*
read
(
MLuint
startPosition,
MLuint
numBytes);
38
42
virtual
bool
read
(
MLuint8
* data,
MLuint
startPosition,
MLuint
numBytes) = 0;
43
45
virtual
MLErrorCode
write
(
MLuint
startPos,
const
MLuint8
*data,
size_t
length) = 0;
46
48
virtual
MLint64
getFileSize
() = 0;
49
51
virtual
MLErrorCode
close
() = 0;
52
};
53
55
class
MLIMAGEFORMATBASE_EXPORT
MLImageFormatDiskFileHandle
:
public
MLImageFormatAbstractFileHandle
56
{
57
public
:
59
MLImageFormatDiskFileHandle
(
int
fd);
60
62
~MLImageFormatDiskFileHandle
()
override
;
63
67
bool
read
(
MLuint8
* data,
MLuint
startPosition,
MLuint
numBytes)
override
;
68
70
MLErrorCode
write
(
MLuint
startPos,
const
MLuint8
*data,
size_t
length)
override
;
71
73
MLint64
getFileSize
()
override
;
74
76
MLErrorCode
close
()
override
;
77
78
private
:
79
int
_fd;
80
};
81
82
83
ML_END_NAMESPACE
84
85
#endif
MLImageFormatBaseSystem.h
MLIMAGEFORMATBASE_EXPORT
#define MLIMAGEFORMATBASE_EXPORT
Definition
MLImageFormatBaseSystem.h:19
ml::MLImageFormatAbstractFileHandle::getFileSize
virtual MLint64 getFileSize()=0
Returns the current complete file size.
ml::MLImageFormatAbstractFileHandle::~MLImageFormatAbstractFileHandle
virtual ~MLImageFormatAbstractFileHandle()
Destructor to clean up. Reimplement to close the file.
Definition
mlImageFormatFileAccess.h:33
ml::MLImageFormatAbstractFileHandle::write
virtual MLErrorCode write(MLuint startPos, const MLuint8 *data, size_t length)=0
Writes the given block.
ml::MLImageFormatAbstractFileHandle::close
virtual MLErrorCode close()=0
Closes the file.
ml::MLImageFormatAbstractFileHandle::read
virtual bool read(MLuint8 *data, MLuint startPosition, MLuint numBytes)=0
ml::MLImageFormatAbstractFileHandle::MLImageFormatAbstractFileHandle
MLImageFormatAbstractFileHandle()
Standard constructor.
Definition
mlImageFormatFileAccess.h:30
ml::MLImageFormatAbstractFileHandle::read
MLuint8 * read(MLuint startPosition, MLuint numBytes)
ml::MLImageFormatDiskFileHandle::read
bool read(MLuint8 *data, MLuint startPosition, MLuint numBytes) override
ml::MLImageFormatDiskFileHandle::~MLImageFormatDiskFileHandle
~MLImageFormatDiskFileHandle() override
Destructor to clean up.
ml::MLImageFormatDiskFileHandle::getFileSize
MLint64 getFileSize() override
Returns the current complete file size. If an error occurs, a value <0 is returned.
ml::MLImageFormatDiskFileHandle::MLImageFormatDiskFileHandle
MLImageFormatDiskFileHandle(int fd)
Standard constructor.
ml::MLImageFormatDiskFileHandle::close
MLErrorCode close() override
Closes the file.
ml::MLImageFormatDiskFileHandle::write
MLErrorCode write(MLuint startPos, const MLuint8 *data, size_t length) override
Writes the given block.
MLErrorCode
MLint32 MLErrorCode
Type of an ML Error code.
Definition
mlTypeDefs.h:715
mlTypeDefs.h
MLuint8
unsigned char MLuint8
Definition
mlTypeDefs.h:108
MLuint
MLuint64 MLuint
Definition
mlTypeDefs.h:505
MLint64
INT64 MLint64
Include 64-bit integer support for Windows or Unix.
Definition
mlTypeDefs.h:411
MeVis
Foundation
Sources
MLImageFormatBase
mlImageFormatFileAccess.h
Generated by
1.15.0