39#ifndef FLOW_DOXYGEN_ONLY
40# ifdef FLOW_DOXYGEN_ONLY
174#ifdef FLOW_SOME_DEFINE
175# if FLOW_SOME_OTHER_DEFINE
176# include "conditionally_included_file.hpp"
184#if FLOW_YET_ANOTHER_DEFINE
185 do_something_conditionally_compiled();
193#if defined(FLOW_THING) && ((!defined(FLOW_OTHER_THING)) || defined(FLOW_THIRD_THING))
225 static const unsigned int S_COOL_CONSTANT_BEING_DOCUMENTED_WITH_A_ONE_LINE_DOC_HEADER;
258identifier_version1_or_v2;
259acronyms_are_just_words_eg_url;
260wordsmooshing_abbrevs_like_uint_are_ok_if_very_well_known;
263class First_letter_of_a_class_is_capital_while_rest_always_lower_case;
264struct Same_format_for_struct;
265union Same_format_for_union;
266enum Same_format_for_old_enum;
267enum class Same_format_for_new_enum;
268using Typedefs_thereof_as_well = ;
271using ptr_diff_t =
signed long long;
276template<
typename Param_type>
277using Parameterized_alias
283#define MACROS_ARE_IN_CAPS
284#define FUNC_MACROS_ARE_2()
287 static const int STATIC_CONSTANT = ;
288 const float LOCAL_NON_STATIC_CONSTANT = 2.3;
290 const auto& blah_ref = *blah_ptr_arg;
295 S_ENUM_VALUES_ARE_CONSTANTS_TOO,
296 S_ENUM_VALUES_ARE_CONSTANTS_3 = 3
306static Cool_class s_singleton_instance;
307static const std::string S_STRING_VAR;
316extern int no_prefix_because_not_a_member_nor_static;
317extern int NO_PREFIX_BECAUSE_NOT_A_MEMBER_NOR_STATIC;
318int no_prefix_because_not_a_member_nor_static;
319int NO_PREFIX_BECAUSE_NOT_A_MEMBER_NOR_STATIC;
323 const Some_class& m_data_member_is_a_ref;
324 Some_enum m_enum_data_member;
325 static const Some_type S_CONSTANT_MEMBER;
326 static constexpr int S_CONSTANT_MEMBER = 32;
327 static Some_type s_variable_member;
330 int no_prefix_because_not_a_member;
331 const int NO_PREFIX_BECAUSE_NOT_A_MEMBER = 2;
332 constexpr int NO_PREFIX_BECAUSE_NOT_A_MEMBER = 3;
366#include "own_headers_included_first.hpp"
367#include <boost/higher_level_angly_headers_go_next.hpp>
379using Cool_type = boost::any;
400 friend class Server_socket;
405 using Ptr = boost::shared_ptr<Cool_class>;
408 struct Inner_class_of_cool;
420 Cool_class(
const Cool_class& src);
427 Cool_class(Cool_class&&) =
delete;
430 virtual ~Cool_class();
442 Cool_class& operator=(
const Cool_class& src)
460 template<
typename Some_type>
461 Some_type cool_template_method();
475 static const float S_PI;
480 Inner_class_of_cool* m_cool_ptr;
501struct Cool_class::Inner_class_of_cool
517Cool_class operator+(Cool_class c1, Cool_class c2);
531template<
typename Ostream>
532Ostream&
operator<<(Ostream& os, Cool_class c);
537extern const float S_EXPONENT;
542extern Cool_class s_singleton_instance;
557template<
typename Ostream>
563template<
typename Some_type>
564Some_type Cool_class::cool_template_method()
573#include "[...]/order.hpp"
615namespace flow::submodule
633void Cool_class::cool_method(
int a,
int b)
656 a = b = (m_other_flag || (m_flag
657 && (((-a) * rnd()) > 3)))
658 ? (m_val1.m_sub_val + cool_func1())
659 : (m_val2_ptr->m_sub_val + cool_func2);
665 float& c = m_floatie;
672 char const *
const str;
674 const char *
const str;
679 FLOW_LOG_WARNING(
"In logging/diagnostics/etc. place [" << a <<
"] around variables. "
680 "Like comments, use sentence-like things, start with capital, end with period/etc. and 1-2 spaces "
681 "unless end of the message. Optional but highly encouraged.");
685 "Async_file_logger [" <<
this <<
"] @ [" << m_log_path <<
"]: do_log() just tried to log msg when file stream "
686 "was in good state, but now file stream is in bad state, probably because the write failed. "
687 "Giving up on that log message. Will retry file stream for next message.");
693 "Some message with stuff in it.");
695 (Sev::S_WARNING,
"Some message with stuff in it.");
698 "Some message with stuff in it.");
704 "--- Basic socket state ---\n"
705 "Internal state: [" << m_int_state_str <<
"].\n"
706 "Client or server: [" << (m_is_active_connect ?
"client" :
"server") <<
"].\n"
708 "Reliability mode: [" << (m_sock_opts.m_st_rexmit_on ?
"reliable/rexmit on" :
"unreliable/rexmit off") <<
"].\n"
709 "--- Buffers/queues/lists ----\n"
710 "Receive window (free space): [" << m_rcv_wnd <<
"]\n"
712 " - Receive buffer size: [" << m_rcv_buf_size <<
"]\n"
713 " - reassembly queue total data size: [" << m_rcv_reassembly_q_data_size <<
"] (0 if rexmit off)\n"
714 " " << (m_sock_opts.m_st_rexmit_on ?
"Reassembly queue" :
"Dupe check list") <<
715 " length: [" << m_rcv_packets_with_gaps <<
"].\n"
716 " Last advertised: [" << m_rcv_wnd_last_advertised <<
"].\n";
737 ([
this, timeout_state, on_result, would_block_ret_val, event_set]
745 FLOW_LOG_TRACE(
"[User event loop] "
746 "Timeout fired for async op [" << event_set <<
"]; clean up and report to user.");
748 Error_code dummy_prevents_throw;
749 event_set->async_wait_finish(&dummy_prevents_throw);
758 ([
this, timeout_state, on_result, would_block_ret_val, event_set]
766 func([
this](){ hooray(m_data_member); });
770 func(1, 2, [
this](){ hooray(m_data_member); });
772 func([
this](){
return m_data_member; }, 1, 2);
775 const auto lambda = [
this](){ hooray(m_data_member); };
785void Cool_class::cool_method2(log::Logger* logger,
const flow::Function<
void ()>& on_completion_func)
788 cool_method2(logger, [
this]()
790 hooray(m_data_member);
809 m_data_member1(rnd()),
830 case Xfer_op_result::S_FULLY_XFERRED:
return "FULLY_XFERRED";
831 case Xfer_op_result::S_PARTIALLY_XFERRED:
return "PARTIALLY_XFERRED";
832 case Xfer_op_result::S_ERROR:
return "ERROR";
833 default: assert(
false);
847void Cool_class::some_method()
857 namespace util = flow::log::util;
859 using util::cool_util_method;
862 string x = cool_util_method() + util::some_free_function();
866const boost::unordered_map<Event_set::Event_type, Event_set::Func_ptr>
868 Event_set::S_EV_TYPE_TO_IS_ACTIVE_NODE_MTD
871 { 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 }
1273auto x =
string{
"abc"};
1277struct Complex {
float m_real;
float m_imag; };
1278Complex num{ -2, 2.3 };
1279f(Complex{ -2, 2.3 });
1284vector<int> v{ 10, 1 };
1285vector<int> v(10, 1);
1291f(
static_cast<size_t>(-1));
1295f(
static_cast<unsigned int>(-1));
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.