NDEVR
API Documentation
ConnectionPipeStream

Simply logs to a given connection. More...

Inheritance diagram for ConnectionPipeStream:
[legend]
Collaboration diagram for ConnectionPipeStream:
[legend]

Classes

class  CommonMessageFormats
 Common formats for sending messages over the pipe using setMessageSendFormat Default progress format is message_line. More...
class  CommonProgressFormats
 Common formats for sending messages over the pipe using setMessageProgressFormat Default progress format is percent. More...

Public Member Functions

 ConnectionPipeStream ()
 Default constructor, no connection instance.
 ConnectionPipeStream (Connection *connection, bool open_connection)
 Sets the connection, if a connection is already set, removes that connection.
 ConnectionPipeStream (const ConnectionInfo &connection)
 Sets the connection, if a connection is already set, removes that connection.
virtual void addMessage (uint04 id, const LogMessage &message) override
 Will send message across the network based on the given format parameters.
bool canSendMessages () const
 Returns true if the connection exists and is ready to send.
void clearConnection ()
 Clears the connection.
bool setConnection (Connection *connection, bool open_connection)
 Sets the connection, if a connection is already set, clears that connection (see clearConnection).
bool setConnection (const ConnectionInfo &connect_info)
 Sets the connection, if a connection is already set, clears that connection (see clearConnection).
void setMessageSendFormat (const String &format)
 Sets the message format where [message] will be replaced with the raw log message, and [time] will be replaced with a time string.
virtual void setProgress (uint04 id, fltp04 progress) override
 Will send progress across the network based on the given format parameters.
void setProgressSendFormat (const String &format)
 Sets the message format where [message] will be replaced with the raw log message, and [time] will be replaced with a time string.
void setTimeSendFormat (const String &format, bool use_local_time)
 Sets the Time format for the time string (See https://ndevr.org/time-patterns/).
Public Member Functions inherited from LogStream
virtual ~LogStream ()
 Destructor.
virtual void addMessages (uint04 id, const Buffer< LogMessage > &messages)
 Adds multiple log messages to this stream at once.
virtual void addProgressSource (const TranslatedString &name, uint04 idx, fltp04 progress)
 Registers a new progress source to be tracked by this stream.
virtual void allowCancel (bool)
 Sets whether this stream allows the user to cancel an in-progress operation.
virtual void allowInput (bool)
 Sets whether this stream allows user input during an operation.
virtual void attach (InfoPipe *stream)
 Attaches this LogStream to the given InfoPipe so it receives log updates.
void clearLinks ()
 Detaches this LogStream from all linked InfoPipe objects and clears the link list.
virtual void detach (InfoPipe *stream)
 Detaches this LogStream from the given InfoPipe, stopping further updates from it.
bool ignoringMessages () const
 Returns whether this stream is currently ignoring messages.
virtual void removeProgressSource (uint04 idx)
 Removes a previously registered progress source from this stream.
void setIgnoreMessages (bool ignore)
 Sets whether this stream should ignore incoming messages.

Additional Inherited Members

Protected Attributes inherited from LogStream
bool m_ignore_message = false
 Whether this stream should ignore incoming messages.
Buffer< InfoPipe * > m_linked_logs
 Collection of InfoPipe objects this stream is listening to.
Dictionary< uint04, ProgressSourcem_progress_sources
 Maps progress source indices to their ProgressSource data.

Detailed Description

Simply logs to a given connection.


Definition at line 11 of file ConnectionPipeStream.h.

Constructor & Destructor Documentation

◆ ConnectionPipeStream() [1/2]

ConnectionPipeStream::ConnectionPipeStream ( Connection * connection,
bool open_connection )

Sets the connection, if a connection is already set, removes that connection.

Warning
Will not take ownership of the connection, meaning destruction or closing of the given connection must occur elsewhere.
Parameters
[in]Theconnection to send logs over.
[in]Whetheror not to automatically open that connection

◆ ConnectionPipeStream() [2/2]

ConnectionPipeStream::ConnectionPipeStream ( const ConnectionInfo & connection)

Sets the connection, if a connection is already set, removes that connection.

Warning
Takes ownership of the connection, meaning destruction or closing of the given connection will occur when disconnect called or on destruction.

Member Function Documentation

◆ addMessage()

virtual void ConnectionPipeStream::addMessage ( uint04 id,
const LogMessage & message )
overridevirtual

Will send message across the network based on the given format parameters.

See setTimeSendFormat See setMessageSendFormat

Implements LogStream.

◆ clearConnection()

void ConnectionPipeStream::clearConnection ( )

Clears the connection.

If class has ownership of the connection, will close and destroy the connection, otherwise simply unsets it.

◆ setConnection() [1/2]

bool ConnectionPipeStream::setConnection ( Connection * connection,
bool open_connection )

Sets the connection, if a connection is already set, clears that connection (see clearConnection).

Warning
Will not take ownership of the connection, meaning destruction or closing of the given connection must occur elsewhere.
Parameters
[in]Theconnection to send logs over.
[in]Whetheror not to automatically open that connection
Returns
true if successfully open or if no open attempt made, false if could not open connection

◆ setConnection() [2/2]

bool ConnectionPipeStream::setConnection ( const ConnectionInfo & connect_info)

Sets the connection, if a connection is already set, clears that connection (see clearConnection).

Automatically opens the connection and takes ownership of it

Warning
Takes ownership of the connection, meaning destruction or closing of the given connection will occur when disconnect called or on destruction.
Parameters
[in]connect_infoThe information to construct a connection.
Returns
true if connection successfully open.

◆ setMessageSendFormat()

void ConnectionPipeStream::setMessageSendFormat ( const String & format)

Sets the message format where [message] will be replaced with the raw log message, and [time] will be replaced with a time string.

See CommonMessageFormats

Parameters
[in]formatThe format of the message Default: [message]\n

◆ setProgressSendFormat()

void ConnectionPipeStream::setProgressSendFormat ( const String & format)

Sets the message format where [message] will be replaced with the raw log message, and [time] will be replaced with a time string.

See CommonMessageFormats

Parameters
[in]formatThe format of the message.

◆ setTimeSendFormat()

void ConnectionPipeStream::setTimeSendFormat ( const String & format,
bool use_local_time )

Sets the Time format for the time string (See https://ndevr.org/time-patterns/).

Parameters
[in]formatThe format of the string, Default: YYYY-MM-DD hh:mm:ss
[in]use_local_timewhether or not to sent the time in UTC time (default) or local

The documentation for this class was generated from the following file: