|
DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
#include <FIFOConnection.hpp>
Public Member Functions | |
| FIFOConnection (const std::string &name) | |
| FIFOConnection (const File &file) | |
| ~FIFOConnection () | |
| void | make (mode_t perm=0622) const |
| std::string | read_message () const |
| void | send_message (const std::string &message) const |
| OksSystem::Descriptor * | open_r (bool block=true) |
| It opens the FIFO in read-only mode. | |
| OksSystem::Descriptor * | open_w (bool block=true) |
| It opens the FIFO in write-only mode. | |
| OksSystem::Descriptor * | open_rw (bool block=true) |
| It opens the FIFO in read and write mode. | |
| void | send (const std::string &message) const |
| It writes a message to a FIFO. | |
| std::string | read () const |
| It reads a single message (string) from a FIFO. | |
| int | fd () const |
| It gets the FIFO file descriptor. | |
| void | close () |
| It closes the FIFO file descriptor. | |
Public Member Functions inherited from OksSystem::File | |
| File (const std::string &name) | |
| File (const char *name) | |
| File (const File &other) | |
| virtual | ~File () |
| operator std::string () const throw () | |
| operator const char * () const throw () | |
| operator bool () const throw () | |
| bool | equals (const File &other) const throw () |
| compare two files */ | |
| operator size_t () const | |
| const std::string & | full_name () const throw () |
| full name for file */ | |
| const char * | c_full_name () const throw () |
| std::string | short_name () const throw () |
| short name for file */ | |
| std::string | parent_name () const throw () |
| path of directory containing file */ | |
| std::string | extension () const throw () |
| extension for file */ | |
| int | depth () const throw () |
| depth of the file */ | |
| OksSystem::File | parent () const |
| parent of the current file */ | |
| OksSystem::File | child (const std::string &name) const |
| named child of the current directory */ | |
| OksSystem::File | temporary (const std::string &prefix) const |
| bool | exists () const throw () |
| does the file exist */ | |
| mode_t | permissions () const |
| permissions for the file */ | |
| std::string | pretty_permissions () const |
| pretty permissions for the file */ | |
| size_t | size () const |
| size of file */ | |
| uid_t | owner_id () const |
| owner id of file */ | |
| User | owner () const |
| owner of the file */ | |
| gid_t | group () const |
| group of file */ | |
| bool | is_regular () const |
| is the file a directory */ | |
| bool | is_directory () const |
| is the file a regular file */ | |
| bool | is_fifo () const |
| is the file a named pipe */ | |
| std::string | file_type () const |
| type of the file */ | |
| file_list_t | directory () const |
| list of file in directory */ | |
| void | unlink () const |
| deletes (unlinks) file */ | |
| void | rmdir () const |
| deletes directory */ | |
| void | remove () const |
| recursively delete files and directories */ | |
| void | rename (const File &other) const |
| rename or moves the file */ | |
| void | permissions (mode_t permissions) const |
| sets the type of the file */ | |
| void | make_dir (mode_t permissions) const |
| creates a directory */ | |
| void | make_path (mode_t permissions) const |
| creates a full path */ | |
| void | make_fifo (mode_t permissions) const |
| creates a FIFO (named pipe) */ | |
| void | ensure_path (mode_t permissions) const |
| creates the parent path */ | |
| std::istream * | input () const |
| returns an input stream from the file*/ | |
| std::ostream * | output (bool append=false) const |
| returns an output stream to the file*/ | |
Static Public Attributes | |
| static const unsigned int | MAX_MESSAGE_LEN = 512 |
Static Public Attributes inherited from OksSystem::File | |
| static const char *const | FILE_FLAG_STR = "-rwxS" |
| column headers for display of permissions */ | |
| static const char *const | FILE_PROTOCOL = "file" |
| string for the file protocol */ | |
Private Attributes | |
| OksSystem::Descriptor * | m_fifo_fd |
| bool | m_is_blocking |
Additional Inherited Members | |
Public Types inherited from OksSystem::File | |
| typedef std::vector< OksSystem::File > | file_list_t |
Static Public Member Functions inherited from OksSystem::File | |
| static std::string | protocol (const std::string &url) throw () |
| extracts the protocol part of an url */ | |
| static std::string | extension (const std::string &url) throw () |
| extracts the extension of a path or an url */ | |
| static std::string | uri (const std::string &url) throw () |
| extracts the local path of an url */ | |
| static std::string | short_name (const std::string &url) throw () |
| extracts the short file name of an url */ | |
| static int | depth (const std::string &path) throw () |
| calculates depth of a path */ | |
| static std::string | first_line (const std::string &text) |
| extracts the first line of a text */ | |
| static File | from_url (const std::string &url) |
| build a file out of an URL */ | |
| static std::string | working_directory () |
| current directory of process */ | |
| static void | working_directory (const File &dir) |
| set working directory of process */ | |
| static std::string | expand_home (const std::string path) |
| resolve home directory */ | |
| static std::string | pretty_permissions (mode_t permissions) |
| pretty prints permissions */ | |
| static std::string | to_string (mode_t permissions) throw () |
| converts permission to string */ | |
| static std::string | pretty_open_flag (int flags) |
| pretty prints open flags */ | |
| static std::string | pretty_size (size_t size, bool cut_small) |
| pretty prints a file size */ | |
Protected Member Functions inherited from OksSystem::File | |
| void | set_name (const std::string &name) |
| sets the name of the file */ | |
| mode_t | get_mode () const |
| get mode associated with file (permission + type) */ | |
Static Protected Member Functions inherited from OksSystem::File | |
| static int | unit (int u) |
| calculates the value of a computer unit of order n (i.e KB,GB, etc */ | |
Protected Attributes inherited from OksSystem::File | |
| std::string | m_full_name |
| full name (path) of the file */ | |
Static Protected Attributes inherited from OksSystem::File | |
| static const char *const | HUMAN_SIZE_STR [] = { "B", "KB", "MB", "GB" } |
| strings for pretty printing file sizes */ | |
| static const char *const | HUMAN_OPEN_STR [] = { "READ", "WRITE", "NOBLOCK", "APPEND", "CREATE", "TRUNCATE","EXCLUSIVE" } |
| strings for pretty printing open flags */ | |
| static const int | KILOBYTE = 1024 |
| number of bytes in a kilobyte */ | |
| static const char *const | FILE_COMMAND_PATH = "/usr/bin/file" |
This class offers some basic tool to communicate simple messages using a filesystem based FIFO (named pipe).
Definition at line 24 of file FIFOConnection.hpp.
| OksSystem::FIFOConnection::FIFOConnection | ( | const std::string & | name | ) |
Constructor, does not actually create the named pipe in the file okssystem. To create it, use the make method
| name | the name (full path) of the named pipe |
Definition at line 24 of file FIFOConnection.cpp.
| OksSystem::FIFOConnection::FIFOConnection | ( | const File & | file | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 31 of file FIFOConnection.cpp.
| OksSystem::FIFOConnection::~FIFOConnection | ( | ) |
Definition at line 36 of file FIFOConnection.cpp.
| void OksSystem::FIFOConnection::close | ( | ) |
| int OksSystem::FIFOConnection::fd | ( | ) | const |
It gets the FIFO file descriptor.
Definition at line 231 of file FIFOConnection.cpp.
| void OksSystem::FIFOConnection::make | ( | mode_t | perm = 0622 | ) | const |
Definition at line 40 of file FIFOConnection.cpp.
| OksSystem::Descriptor * OksSystem::FIFOConnection::open_r | ( | bool | block = true | ) |
It opens the FIFO in read-only mode.
| block | If TRUE the FIFO will be opened in blocking mode. |
Definition at line 126 of file FIFOConnection.cpp.
| OksSystem::Descriptor * OksSystem::FIFOConnection::open_rw | ( | bool | block = true | ) |
It opens the FIFO in read and write mode.
| block | If TRUE the FIFO will be opened in blocking mode. |
Definition at line 187 of file FIFOConnection.cpp.
| OksSystem::Descriptor * OksSystem::FIFOConnection::open_w | ( | bool | block = true | ) |
It opens the FIFO in write-only mode.
| block | If TRUE the FIFO will be opened in blocking mode. |
Definition at line 157 of file FIFOConnection.cpp.
| std::string OksSystem::FIFOConnection::read | ( | ) | const |
It reads a single message (string) from a FIFO.
Definition at line 105 of file FIFOConnection.cpp.
| std::string OksSystem::FIFOConnection::read_message | ( | ) | const |
Blocking read of a single message (string) from a FIFO
Definition at line 49 of file FIFOConnection.cpp.
| void OksSystem::FIFOConnection::send | ( | const std::string & | message | ) | const |
It writes a message to a FIFO.
| message | The message to write into the FIFO. |
Definition at line 88 of file FIFOConnection.cpp.
| void OksSystem::FIFOConnection::send_message | ( | const std::string & | message | ) | const |
Definition at line 67 of file FIFOConnection.cpp.
|
private |
Definition at line 48 of file FIFOConnection.hpp.
|
private |
Definition at line 49 of file FIFOConnection.hpp.
|
static |
Definition at line 27 of file FIFOConnection.hpp.