39#ifndef FLOW_DOXYGEN_ONLY
40# ifdef FLOW_DOXYGEN_ONLY
173#ifdef FLOW_SOME_DEFINE
174# if FLOW_SOME_OTHER_DEFINE
175# include "conditionally_included_file.hpp"
183#if FLOW_YET_ANOTHER_DEFINE
184 do_something_conditionally_compiled();
192#if defined(FLOW_THING) && ((!defined(FLOW_OTHER_THING)) || defined(FLOW_THIRD_THING))
224 static const unsigned int S_COOL_CONSTANT_BEING_DOCUMENTED_WITH_A_ONE_LINE_DOC_HEADER;
257identifier_version1_or_v2;
258acronyms_are_just_words_eg_url;
259wordsmooshing_abbrevs_like_uint_are_ok_if_very_well_known;
262class First_letter_of_a_class_is_capital_while_rest_always_lower_case;
263struct Same_format_for_struct;
264union Same_format_for_union;
265enum Same_format_for_old_enum;
266enum class Same_format_for_new_enum;
267using Typedefs_thereof_as_well = ;
270using ptr_diff_t =
signed long long;
275template<
typename Param_type>
276using Parameterized_alias
282#define MACROS_ARE_IN_CAPS
283#define FUNC_MACROS_ARE_2()
286 static const int STATIC_CONSTANT = ;
287 const float LOCAL_NON_STATIC_CONSTANT = 2.3;
289 const auto& blah_ref = *blah_ptr_arg;
294 S_ENUM_VALUES_ARE_CONSTANTS_TOO,
295 S_ENUM_VALUES_ARE_CONSTANTS_3 = 3
305static Cool_class s_singleton_instance;
306static const std::string S_STRING_VAR;
315extern int no_prefix_because_not_a_member_nor_static;
316extern int NO_PREFIX_BECAUSE_NOT_A_MEMBER_NOR_STATIC;
317int no_prefix_because_not_a_member_nor_static;
318int NO_PREFIX_BECAUSE_NOT_A_MEMBER_NOR_STATIC;
322 const Some_class& m_data_member_is_a_ref;
323 Some_enum m_enum_data_member;
324 static const Some_type S_CONSTANT_MEMBER;
325 static constexpr int S_CONSTANT_MEMBER = 32;
326 static Some_type s_variable_member;
329 int no_prefix_because_not_a_member;
330 const int NO_PREFIX_BECAUSE_NOT_A_MEMBER = 2;
331 constexpr int NO_PREFIX_BECAUSE_NOT_A_MEMBER = 3;
365#include "own_headers_included_first.hpp"
366#include <boost/higher_level_angly_headers_go_next.hpp>
378using Cool_type = boost::any;
399 friend class Server_socket;
404 using Ptr = boost::shared_ptr<Cool_class>;
407 struct Inner_class_of_cool;
419 Cool_class(
const Cool_class& src);
426 Cool_class(Cool_class&&) =
delete;
429 virtual ~Cool_class();
441 Cool_class& operator=(
const Cool_class& src)
459 template<
typename Some_type>
460 Some_type cool_template_method();
474 static const float S_PI;
479 Inner_class_of_cool* m_cool_ptr;
500struct Cool_class::Inner_class_of_cool
516Cool_class operator+(Cool_class c1, Cool_class c2);
530template<
typename Ostream>
531Ostream&
operator<<(Ostream& os, Cool_class c);
536extern const float S_EXPONENT;
541extern Cool_class s_singleton_instance;
556template<
typename Ostream>
562template<
typename Some_type>
563Some_type Cool_class::cool_template_method()
572#include "[...]/order.hpp"
614namespace flow::submodule
632void Cool_class::cool_method(
int a,
int b)
655 a = b = (m_other_flag || (m_flag
656 && (((-a) * rnd()) > 3)))
657 ? (m_val1.m_sub_val + cool_func1())
658 : (m_val2_ptr->m_sub_val + cool_func2);
664 float& c = m_floatie;
671 char const *
const str;
673 const char *
const str;
678 FLOW_LOG_WARNING(
"In logging/diagnostics/etc. place [" << a <<
"] around variables. "
679 "Like comments, use sentence-like things, start with capital, end with period/etc. and 1-2 spaces "
680 "unless end of the message. Optional but highly encouraged.");
684 "Async_file_logger [" <<
this <<
"] @ [" << m_log_path <<
"]: do_log() just tried to log msg when file stream "
685 "was in good state, but now file stream is in bad state, probably because the write failed. "
686 "Giving up on that log message. Will retry file stream for next message.");
692 "Some message with stuff in it.");
694 (Sev::S_WARNING,
"Some message with stuff in it.");
697 "Some message with stuff in it.");
703 "--- Basic socket state ---\n"
704 "Internal state: [" << m_int_state_str <<
"].\n"
705 "Client or server: [" << (m_is_active_connect ?
"client" :
"server") <<
"].\n"
707 "Reliability mode: [" << (m_sock_opts.m_st_rexmit_on ?
"reliable/rexmit on" :
"unreliable/rexmit off") <<
"].\n"
708 "--- Buffers/queues/lists ----\n"
709 "Receive window (free space): [" << m_rcv_wnd <<
"]\n"
711 " - Receive buffer size: [" << m_rcv_buf_size <<
"]\n"
712 " - reassembly queue total data size: [" << m_rcv_reassembly_q_data_size <<
"] (0 if rexmit off)\n"
713 " " << (m_sock_opts.m_st_rexmit_on ?
"Reassembly queue" :
"Dupe check list") <<
714 " length: [" << m_rcv_packets_with_gaps <<
"].\n"
715 " Last advertised: [" << m_rcv_wnd_last_advertised <<
"].\n";
736 ([
this, timeout_state, on_result, would_block_ret_val, event_set]
744 FLOW_LOG_TRACE(
"[User event loop] "
745 "Timeout fired for async op [" << event_set <<
"]; clean up and report to user.");
747 Error_code dummy_prevents_throw;
748 event_set->async_wait_finish(&dummy_prevents_throw);
757 ([
this, timeout_state, on_result, would_block_ret_val, event_set]
765 func([
this](){ hooray(m_data_member); });
769 func(1, 2, [
this](){ hooray(m_data_member); });
771 func([
this](){
return m_data_member; }, 1, 2);
774 const auto lambda = [
this](){ hooray(m_data_member); };
784void Cool_class::cool_method2(log::Logger* logger,
const flow::Function<
void ()>& on_completion_func)
787 cool_method2(logger, [
this]()
789 hooray(m_data_member);
808 m_data_member1(rnd()),
829 case Xfer_op_result::S_FULLY_XFERRED:
return "FULLY_XFERRED";
830 case Xfer_op_result::S_PARTIALLY_XFERRED:
return "PARTIALLY_XFERRED";
831 case Xfer_op_result::S_ERROR:
return "ERROR";
832 default: assert(
false);
846void Cool_class::some_method()
856 namespace util = flow::log::util;
858 using util::cool_util_method;
861 string x = cool_util_method() + util::some_free_function();
865const boost::unordered_map<Event_set::Event_type, Event_set::Func_ptr>
867 Event_set::S_EV_TYPE_TO_IS_ACTIVE_NODE_MTD
870 { Event_set::Event_type::S_PEER_SOCKET_READABLE, &Node::sock_is_readable },
872 { Event_set::Event_type::S_PEER_SOCKET_WRITABLE, &Node::sock_is_writable },
873 { Event_set::Event_type::S_SERVER_SOCKET_ACCEPTABLE, &Node::serv_is_acceptable }
std::ostream & operator<<(std::ostream &os, const Option_set< Value_set > &val)
Serializes (briefly) an Option_set to a standard output stream.
#define FLOW_LOG_WITHOUT_CHECKING(ARG_sev, ARG_stream_fragment)
Identical to FLOW_LOG_WITH_CHECKING() but foregoes the filter (Logger::should_log()) check.
#define FLOW_LOG_WARNING(ARG_stream_fragment)
Logs a WARNING message into flow::log::Logger *get_logger() with flow::log::Component get_log_compone...
Scheduled_task_handle schedule_task_at(log::Logger *logger_ptr, const Fine_time_pt &at, bool single_threaded, Task_engine *task_engine, Scheduled_task_handler &&task_body_moved)
Identical to schedule_task_from_now() except the time is specified in absolute terms.
unsigned char uint8_t
Byte. Best way to represent a byte of binary data. This is 8 bits on all modern systems.