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
public
:
34
35
MapFile
(
const
std::string &file,
size_t
size
,
size_t
offset
,
bool
read_mode,
bool
write_mode, mode_t
permissions
= 0666) ;
36
~MapFile
();
37
38
void
zero
()
const
;
39
void
map
();
40
void
unmap
();
41
bool
is_mapped
()
const
;
42
bool
is_loaded
()
const
throw
() ;
43
void
*
address
()
const
throw
() ;
44
size_t
memory_size
()
const
throw
() ;
45
OksSystem::Descriptor
*
fd
()
const
throw
() ;
46
47
protected
:
48
49
void
open_fd
();
50
void
close_fd
();
51
void
map_mem
();
52
void
unmap_mem
();
53
54
void
*
m_map_address
;
55
size_t
m_map_size
;
56
size_t
m_map_offset
;
57
Descriptor
*
m_map_descriptor
;
58
mode_t
m_map_permission
;
59
bool
m_map_read
;
60
bool
m_map_write
;
61
bool
m_is_mapped
;
62
63
private
:
64
65
static
const
char
*
const
MAP_LOAD_MSG
;
66
static
const
char
*
const
MAP_NOT_LOAD_MSG
;
67
static
const
char
*
const
PAGE_SIZE_MSG
;
68
static
const
char
*
const
READ_OR_WRITE_MSG
;
69
static
const
char
*
const
MAP_NOT_WRITE_MSG
;
70
71
} ;
// MapFile
72
73
}
// ers
74
75
#endif
File.hpp
OksSystem::Descriptor
File descriptor / Socket wrapper.
Definition
Descriptor.hpp:34
OksSystem::File::permissions
mode_t permissions() const
permissions for the file */
Definition
File.cpp:505
OksSystem::File::File
File(const std::string &name)
Definition
File.cpp:301
OksSystem::File::size
size_t size() const
size of file */
Definition
File.cpp:535
OksSystem::MapFile::unmap_mem
void unmap_mem()
unmaps the file into memory
Definition
MapFile.cpp:110
OksSystem::MapFile::MAP_NOT_LOAD_MSG
static const char *const MAP_NOT_LOAD_MSG
message pattern - map is not loaded
Definition
MapFile.hpp:66
OksSystem::MapFile::m_map_address
void * m_map_address
the address of the map in memory
Definition
MapFile.hpp:54
OksSystem::MapFile::zero
void zero() const
builds a zeroed file with correct length
Definition
MapFile.cpp:125
OksSystem::MapFile::m_map_offset
size_t m_map_offset
offset in the file of the map
Definition
MapFile.hpp:56
OksSystem::MapFile::m_map_size
size_t m_map_size
the size of the map
Definition
MapFile.hpp:55
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:36
OksSystem::MapFile::is_mapped
bool is_mapped() const
is the file mopped im memory
Definition
MapFile.cpp:186
OksSystem::MapFile::~MapFile
~MapFile()
Definition
MapFile.cpp:55
OksSystem::MapFile::m_map_write
bool m_map_write
is the map writable
Definition
MapFile.hpp:60
OksSystem::MapFile::unmap
void unmap()
unmaps the file
Definition
MapFile.cpp:157
OksSystem::MapFile::MAP_LOAD_MSG
static const char *const MAP_LOAD_MSG
message pattern - map is loaded
Definition
MapFile.hpp:65
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:68
OksSystem::MapFile::m_map_descriptor
Descriptor * m_map_descriptor
internal file descriptor
Definition
MapFile.hpp:57
OksSystem::MapFile::m_is_mapped
bool m_is_mapped
is the file mapped in memory
Definition
MapFile.hpp:61
OksSystem::MapFile::is_loaded
bool is_loaded() const
is the map loaded in memory
Definition
MapFile.cpp:162
OksSystem::MapFile::PAGE_SIZE_MSG
static const char *const PAGE_SIZE_MSG
message pattern - illegal page size
Definition
MapFile.hpp:67
OksSystem::MapFile::fd
OksSystem::Descriptor * fd() const
the file descriptor. This method returns a valid pointer only if called after map().
Definition
MapFile.cpp:190
OksSystem::MapFile::open_fd
void open_fd()
opens the file descriptor for the map
Definition
MapFile.cpp:65
OksSystem::MapFile::close_fd
void close_fd()
closes the file descriptor for the map
Definition
MapFile.cpp:75
OksSystem::MapFile::memory_size
size_t memory_size() const
the size of the map
Definition
MapFile.cpp:180
OksSystem::MapFile::map_mem
void map_mem()
maps the file into memory
Definition
MapFile.cpp:86
OksSystem::MapFile::m_map_read
bool m_map_read
is the map readable
Definition
MapFile.hpp:59
OksSystem::MapFile::map
void map()
maps the file in memory
Definition
MapFile.cpp:146
OksSystem::MapFile::m_map_permission
mode_t m_map_permission
permissions associated with the file
Definition
MapFile.hpp:58
OksSystem::MapFile::MAP_NOT_WRITE_MSG
static const char *const MAP_NOT_WRITE_MSG
message pattern - map is not writable
Definition
MapFile.hpp:69
OksSystem::MapFile::address
void * address() const
the address of the memory mapped file
Definition
MapFile.cpp:172
offset
double offset
Definition
conversions-impl.hh:28
OksSystem
Definition
Descriptor.hpp:22
Generated on
for DUNE-DAQ by
1.17.0