DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Descriptor.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/Descriptor.h to include/okssystem/Descriptor.hpp).
5
6/*
7 * Descriptor.h
8 * Test
9 *
10 * Created by Matthias Wiesmann on 08.02.05.
11 * Copyright 2005 CERN. All rights reserved.
12 *
13 */
14
15#ifndef OKSSYSTEM_DESCRIPTOR
16#define OKSSYSTEM_DESCRIPTOR
17
18#include <string>
19#include <sys/types.h>
20#include <sys/stat.h>
21
22namespace OksSystem {
23
24 class File;
25
33
34 class Descriptor {
35
36 public:
37
38 Descriptor(const File * file, int flags, mode_t perm );
39 ~Descriptor();
40
41 static int flags(bool read_mode, bool write_mode);
42
43 operator int() const throw();
44
45 void close();
46 void close_safe() throw();
47
48 int read(void* buffer, size_t number) const;
49 int write(const void * buffer, size_t number) const;
50
51 int fd() const throw();
52
53 void closeOnExec();
54
55 protected:
56
57 void open(const File * file, int flags, mode_t perm);
58
59 private:
60
61 int m_fd;
62 std::string m_name;
63
64 };// Descriptor
65
66} // OksSystem
67
68#endif
69
Descriptor(const File *file, int flags, mode_t perm)
int read(void *buffer, size_t number) const
int fd() const
file descritptor
static int flags(bool read_mode, bool write_mode)
void open(const File *file, int flags, mode_t perm)
internal open method
void closeOnExec()
It flags the file descriptor to be closed after any call to the exec okssystem function.
void close()
close the descriptor
void close_safe()
close the descriptor no exception
int write(const void *buffer, size_t number) const
std::string m_name
internal file descriptor
Wrapper for file operations.
Definition File.hpp:37