DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
Descriptor.hpp
Go to the documentation of this file.
1/*
2 * Descriptor.h
3 * Test
4 *
5 * Created by Matthias Wiesmann on 08.02.05.
6 * Copyright 2005 CERN. All rights reserved.
7 *
8 */
9
10#ifndef OKSSYSTEM_DESCRIPTOR
11#define OKSSYSTEM_DESCRIPTOR
12
13#include <string>
14#include <sys/types.h>
15#include <sys/stat.h>
16
17namespace OksSystem {
18
19 class File;
20
29 class Descriptor {
30
31 public:
32
33 Descriptor(const File * file, int flags, mode_t perm );
34 ~Descriptor();
35
36 static int flags(bool read_mode, bool write_mode);
37
38 operator int() const throw();
39
40 void close();
41 void close_safe() throw();
43 int read(void* buffer, size_t number) const;
44 int write(const void * buffer, size_t number) const;
45
46 int fd() const throw();
48 void closeOnExec();
49
50 protected:
51
52 void open(const File * file, int flags, mode_t perm);
54 private:
55
56 int m_fd;
57 std::string m_name;
59 };// Descriptor
60
61} // OksSystem
62
63#endif
64
File descriptor / Socket wrapper.
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:32