libcaf  0.14.0
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
caf::actor_ostream Class Reference

Provides support for thread-safe output operations on character streams. More...

#include <actor_ostream.hpp>

Public Types

using fun_type = actor_ostream &(*)(actor_ostream &)
 

Public Member Functions

 actor_ostream (actor_ostream &&)=default
 
 actor_ostream (const actor_ostream &)=default
 
actor_ostreamoperator= (actor_ostream &&)=default
 
actor_ostreamoperator= (const actor_ostream &)=default
 
 actor_ostream (actor self)
 Creates a stream for self.
 
actor_ostreamwrite (std::string arg)
 Writes arg to the buffer allocated for the calling actor.
 
actor_ostreamflush ()
 Flushes the buffer allocated for the calling actor.
 
actor_ostreamoperator<< (std::string arg)
 Writes arg to the buffer allocated for the calling actor.
 
actor_ostreamoperator<< (const char *arg)
 Writes arg to the buffer allocated for the calling actor.
 
template<class T >
std::enable_if< !std::is_convertible< T, std::string >::value, actor_ostream & >::type operator<< (T &&arg)
 Writes to_string(arg) to the buffer allocated for the calling actor, calling either std::to_string or caf::to_string depending on the argument. More...
 
actor_ostreamoperator<< (actor_ostream::fun_type f)
 Apply f to *this.
 

Static Public Member Functions

static void redirect (const actor &src, std::string file_name, int flags=0)
 Redirects all further output from src to file_name.
 
static void redirect_all (std::string file_name, int flags=0)
 Redirects all further output from any actor that did not redirect its output to file_name. More...
 

Static Public Attributes

static constexpr int append = 0x01
 Open redirection file in append mode.
 

Detailed Description

Provides support for thread-safe output operations on character streams.

The stream operates on a per-actor basis and will print only complete lines or when explicitly forced to flush its buffer. The stream will convert any operation to a message received by a printer actor. This actor is a sequence point that ensures output appears never interleaved.

Member Function Documentation

template<class T >
std::enable_if< ! std::is_convertible<T, std::string>::value, actor_ostream& >::type caf::actor_ostream::operator<< ( T &&  arg)

Writes to_string(arg) to the buffer allocated for the calling actor, calling either std::to_string or caf::to_string depending on the argument.

static void caf::actor_ostream::redirect_all ( std::string  file_name,
int  flags = 0 
)
static

Redirects all further output from any actor that did not redirect its output to file_name.


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