DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
okssystem
include
okssystem
MapFile.hpp
Go to the documentation of this file.
1
// DUNE DAQ modification notice:
2
// This file has been modified from the original ATLAS system source for the DUNE DAQ project.
3
// Fork baseline commit: system-00-00-20 (2020-09-25).
4
// Renamed since fork: yes (from system/MapFile.h to include/okssystem/MapFile.hpp).
5
6
/*
7
* MapFile.h
8
* OksSystem
9
*
10
* Created by Matthias Wiesmann on 07.01.05.
11
* Copyright 2005 CERN. All rights reserved.
12
*
13
*/
14
15
#ifndef OKSSYSTEM_MAP_FILE
16
#define OKSSYSTEM_MAP_FILE
17
18
#include "
okssystem/File.hpp
"
19
20
namespace
OksSystem
{
21
22
class
Descriptor
;
23
30
31
class
MapFile
:
public
File
32
{
33
34
public
:
35
MapFile
(
const
std::string& file,
36
size_t
size
,
37
size_t
offset
,
38
bool
read_mode,
39
bool
write_mode,
40
mode_t
permissions
= 0666);
41
~MapFile
();
42
43
void
zero
()
const
;
44
void
map
();
45
void
unmap
();
46
bool
is_mapped
()
const
;
47
bool
is_loaded
()
const
throw
();
48
void
*
address
()
const
throw
();
49
size_t
memory_size
()
const
throw
();
50
OksSystem::Descriptor
*
fd
()
const
51
throw
();
52
53
protected
:
54
void
open_fd
();
55
void
close_fd
();
56
void
map_mem
();
57
void
unmap_mem
();
58
59
void
*
m_map_address
;
60
size_t
m_map_size
;
61
size_t
m_map_offset
;
62
Descriptor
*
m_map_descriptor
;
63
mode_t
m_map_permission
;
64
bool
m_map_read
;
65
bool
m_map_write
;
66
bool
m_is_mapped
;
67
68
private
:
69
static
const
char
*
const
MAP_LOAD_MSG
;
70
static
const
char
*
const
MAP_NOT_LOAD_MSG
;
71
static
const
char
*
const
PAGE_SIZE_MSG
;
72
static
const
char
*
const
READ_OR_WRITE_MSG
;
73
static
const
char
*
const
MAP_NOT_WRITE_MSG
;
74
75
};
// MapFile
76
77
}
// ers
78
79
#endif
File.hpp
OksSystem::Descriptor
File descriptor / Socket wrapper.
Definition
Descriptor.hpp:35
OksSystem::File::permissions
mode_t permissions() const
permissions for the file */
Definition
File.cpp:558
OksSystem::File::File
File(const std::string &name)
Definition
File.cpp:327
OksSystem::File::size
size_t size() const
size of file */
Definition
File.cpp:593
OksSystem::MapFile::unmap_mem
void unmap_mem()
unmaps the file into memory
Definition
MapFile.cpp:118
OksSystem::MapFile::MAP_NOT_LOAD_MSG
static const char *const MAP_NOT_LOAD_MSG
message pattern - map is not loaded
Definition
MapFile.hpp:70
OksSystem::MapFile::m_map_address
void * m_map_address
the address of the map in memory
Definition
MapFile.hpp:59
OksSystem::MapFile::zero
void zero() const
builds a zeroed file with correct length
Definition
MapFile.cpp:135
OksSystem::MapFile::m_map_offset
size_t m_map_offset
offset in the file of the map
Definition
MapFile.hpp:61
OksSystem::MapFile::m_map_size
size_t m_map_size
the size of the map
Definition
MapFile.hpp:60
OksSystem::MapFile::MapFile
MapFile(const std::string &file, size_t size, size_t offset, bool read_mode, bool write_mode, mode_t permissions=0666)
Definition
MapFile.cpp:35
OksSystem::MapFile::is_mapped
bool is_mapped() const
is the file mopped im memory
Definition
MapFile.cpp:206
OksSystem::MapFile::m_map_write
bool m_map_write
is the map writable
Definition
MapFile.hpp:65
OksSystem::MapFile::unmap
void unmap()
unmaps the file
Definition
MapFile.cpp:170
OksSystem::MapFile::MAP_LOAD_MSG
static const char *const MAP_LOAD_MSG
message pattern - map is loaded
Definition
MapFile.hpp:69
OksSystem::MapFile::READ_OR_WRITE_MSG
static const char *const READ_OR_WRITE_MSG
message pattern - map mode is neither read nor write
Definition
MapFile.hpp:72
OksSystem::MapFile::m_map_descriptor
Descriptor * m_map_descriptor
internal file descriptor
Definition
MapFile.hpp:62
OksSystem::MapFile::m_is_mapped
bool m_is_mapped
is the file mapped in memory
Definition
MapFile.hpp:66
OksSystem::MapFile::is_loaded
bool is_loaded() const
is the map loaded in memory
Definition
MapFile.cpp:177
OksSystem::MapFile::PAGE_SIZE_MSG
static const char *const PAGE_SIZE_MSG
message pattern - illegal page size
Definition
MapFile.hpp:71
OksSystem::MapFile::fd
OksSystem::Descriptor * fd() const
the file descriptor. This method returns a valid pointer only if called after map().
Definition
MapFile.cpp:212
OksSystem::MapFile::open_fd
void open_fd()
opens the file descriptor for the map
Definition
MapFile.cpp:68
OksSystem::MapFile::close_fd
void close_fd()
closes the file descriptor for the map
Definition
MapFile.cpp:79
OksSystem::MapFile::memory_size
size_t memory_size() const
the size of the map
Definition
MapFile.cpp:198
OksSystem::MapFile::map_mem
void map_mem()
maps the file into memory
Definition
MapFile.cpp:92
OksSystem::MapFile::m_map_read
bool m_map_read
is the map readable
Definition
MapFile.hpp:64
OksSystem::MapFile::map
void map()
maps the file in memory
Definition
MapFile.cpp:157
OksSystem::MapFile::m_map_permission
mode_t m_map_permission
permissions associated with the file
Definition
MapFile.hpp:63
OksSystem::MapFile::MAP_NOT_WRITE_MSG
static const char *const MAP_NOT_WRITE_MSG
message pattern - map is not writable
Definition
MapFile.hpp:73
OksSystem::MapFile::address
void * address() const
the address of the memory mapped file
Definition
MapFile.cpp:188
offset
double offset
Definition
conversions-impl.hh:28
OksSystem
Definition
Descriptor.hpp:22
Generated on
for DUNE-DAQ by
1.18.0