Chatsync
bbffde5c0c672a526bdc83637acf66dc20a80fbf
|
#include <filechannel.hpp>
Public Member Functions | |
FileChannel (Hub::Hub *hub, const std::string &config) | |
~FileChannel () | |
std::string | type () const override |
![]() | |
Channel (Hub::Hub *const hub, const std::string &config) | |
virtual | ~Channel () |
virtual std::string const & | name () const |
ChannelDirection | direction () const |
virtual int | connect (const std::string &hostname, const uint32_t port) const |
virtual int | send (const uint32_t fd, const std::string &msg) const |
virtual int | send (const std::string &msg) const |
virtual int | disconnect (const uint32_t fd) const |
virtual int | disconnect () const |
virtual void | tick () |
Protected Member Functions | |
void | incoming (const messaging::message_ptr &&msg) override |
![]() | |
virtual void | pollThread () |
void | startPolling () |
void | stopPolling () |
Private Member Functions | |
int | openPipe (const std::string &filename) |
std::future< void > | activate () override |
const messaging::message_ptr | parse (const char *line) const override |
Private Attributes | |
std::fstream | _file |
Static Private Attributes | |
static const channeling::ChannelCreatorImpl< FileChannel > | creator |
Additional Inherited Members | |
![]() | |
const uint16_t | _id |
![]() | |
std::atomic_bool | _active |
std::unique_ptr< std::thread > | _thread |
std::atomic_bool | _pipeRunning |
int | _fd |
const config::ConfigParser | _config |
const std::string | _name |
const ChannelDirection | _direction |
Hub::Hub *const | _hub |
File channel
May be useful for logging
|
explicit |
fileChannel::FileChannel::~FileChannel | ( | ) |
|
overrideprivatevirtual |
Prepare all prerequisites for polling thread or prepare the output and start working
Opening file descriptors, connecting to network must be done here. After future is valid channel is considered to be ready for work.
activate_error | in case of problems |
Implements channeling::Channel.
|
overrideprotectedvirtual |
Parse line and send it to needed output place in case of Output direction
msg | Incoming message from hub. Passed by value to preserve ownership and ensure existence during processing in all output channels. |
Implements channeling::Channel.
|
private |
Opens input pipe
filename | Pipe name with full path (if needed) |
int | File descriptor |
Channeling::activate_error | when can't open file |
|
overrideprivatevirtual |
Parse a text line and generate a corresponding Message
line | Text line from socket. |
nullptr | If message was technical for protocol. |
message_ptr | If useful payload found. |
Implements channeling::Channel.
|
inlineoverridevirtual |
Return channel "type" — unique string to identify channel in config file
std::string | Type line |
Implements channeling::Channel.
|
private |
File stream to save log
|
staticprivate |