39#ifndef FLOW_DOXYGEN_ONLY
40# ifdef FLOW_DOXYGEN_ONLY
176#ifdef FLOW_SOME_DEFINE
177# if FLOW_SOME_OTHER_DEFINE
178# include "conditionally_included_file.hpp"
186#if FLOW_YET_ANOTHER_DEFINE
187 do_something_conditionally_compiled();
195#if defined(FLOW_THING) && ((!defined(FLOW_OTHER_THING)) || defined(FLOW_THIRD_THING))
227 static const unsigned int S_COOL_CONSTANT_BEING_DOCUMENTED_WITH_A_ONE_LINE_DOC_HEADER;
260identifier_version1_or_v2;
261acronyms_are_just_words_eg_url;
262wordsmooshing_abbrevs_like_uint_are_ok_if_very_well_known;
265class First_letter_of_a_class_is_capital_while_rest_always_lower_case;
266struct Same_format_for_struct;
267union Same_format_for_union;
268enum Same_format_for_old_enum;
269enum class Same_format_for_new_enum;
270using Typedefs_thereof_as_well = ;
273using ptr_diff_t =
signed long long;
278template<
typename Param_type>
279using Parameterized_alias
285#define MACROS_ARE_IN_CAPS
286#define FUNC_MACROS_ARE_2()
289 static const int STATIC_CONSTANT = ;
290 const float LOCAL_NON_STATIC_CONSTANT = 2.3;
292 const auto& blah_ref = *blah_ptr_arg;
297 S_ENUM_VALUES_ARE_CONSTANTS_TOO,
298 S_ENUM_VALUES_ARE_CONSTANTS_3 = 3
307template<
typename Type_ay,
typename Type_bee_t,
bool CONSTANT_AY,
bool CONSTANT_BEE>
311 using Type_bee = Type_bee_t;
313 static constexpr S_CONSTANT_BEE = CONSTANT_BEE;
317template<
typename Type_ay,
typename Type_bee_t,
bool CONSTANT_AY,
bool CONSTANT_BEE>
318void do_cool_thing(Type_bee_t thing,
bool value = CONSTANT_BEE)
320 using Type_bee = Type_bee_t;
321 constexpr auto SHORT_B = CONSTANT_BEE;
339static Cool_class s_singleton_instance;
340static const std::string S_STRING_VAR;
349extern int no_prefix_because_not_a_member_nor_static;
350extern int NO_PREFIX_BECAUSE_NOT_A_MEMBER_NOR_STATIC;
351int no_prefix_because_not_a_member_nor_static;
352int NO_PREFIX_BECAUSE_NOT_A_MEMBER_NOR_STATIC;
356 const Some_class& m_data_member_is_a_ref;
357 Some_enum m_enum_data_member;
358 static const Some_type S_CONSTANT_MEMBER;
359 static constexpr int S_CONSTANT_MEMBER = 32;
360 static Some_type s_variable_member;
363 int no_prefix_because_not_a_member;
364 const int NO_PREFIX_BECAUSE_NOT_A_MEMBER = 2;
365 constexpr int NO_PREFIX_BECAUSE_NOT_A_MEMBER = 3;
399#include "own_headers_included_first.hpp"
400#include <boost/higher_level_angly_headers_go_next.hpp>
412using Cool_type = boost::any;
433 friend class Server_socket;
438 using Ptr = boost::shared_ptr<Cool_class>;
441 struct Inner_class_of_cool;
453 Cool_class(
const Cool_class& src);
460 Cool_class(Cool_class&&) =
delete;
463 virtual ~Cool_class();
475 Cool_class& operator=(
const Cool_class& src)
493 template<
typename Some_type>
494 Some_type cool_template_method();
508 static const float S_PI;
513 Inner_class_of_cool* m_cool_ptr;
533struct Cool_class::Inner_class_of_cool
549Cool_class operator+(Cool_class c1, Cool_class c2);
563template<
typename Ostream>
564Ostream&
operator<<(Ostream& os, Cool_class c);
569extern const float S_EXPONENT;
574extern Cool_class s_singleton_instance;
590template<
typename Ostream>
596template<
typename Some_type>
597Some_type Cool_class::cool_template_method()
606#include "[...]/order.hpp"
648namespace flow::submodule
666void Cool_class::cool_method(
int a,
int b)
689 a = b = (m_other_flag || (m_flag
690 && (((-a) * rnd()) > 3)))
691 ? (m_val1.m_sub_val + cool_func1())
692 : (m_val2_ptr->m_sub_val + cool_func2);
698 float& c = m_floatie;
705 char const *
const str;
707 const char *
const str;
712 FLOW_LOG_WARNING(
"In logging/diagnostics/etc. place [" << a <<
"] around variables. "
713 "Like comments, use sentence-like things, start with capital, end with period/etc. and 1-2 spaces "
714 "unless end of the message. Optional but highly encouraged.");
718 "Async_file_logger [" <<
this <<
"] @ [" << m_log_path <<
"]: do_log() just tried to log msg when file stream "
719 "was in good state, but now file stream is in bad state, probably because the write failed. "
720 "Giving up on that log message. Will retry file stream for next message.");
726 "Some message with stuff in it.");
728 (Sev::S_WARNING,
"Some message with stuff in it.");
731 "Some message with stuff in it.");
737 "--- Basic socket state ---\n"
738 "Internal state: [" << m_int_state_str <<
"].\n"
739 "Client or server: [" << (m_is_active_connect ?
"client" :
"server") <<
"].\n"
741 "Reliability mode: [" << (m_sock_opts.m_st_rexmit_on ?
"reliable/rexmit on" :
"unreliable/rexmit off") <<
"].\n"
742 "--- Buffers/queues/lists ----\n"
743 "Receive window (free space): [" << m_rcv_wnd <<
"]\n"
745 " - Receive buffer size: [" << m_rcv_buf_size <<
"]\n"
746 " - reassembly queue total data size: [" << m_rcv_reassembly_q_data_size <<
"] (0 if rexmit off)\n"
747 " " << (m_sock_opts.m_st_rexmit_on ?
"Reassembly queue" :
"Dupe check list") <<
748 " length: [" << m_rcv_packets_with_gaps <<
"].\n"
749 " Last advertised: [" << m_rcv_wnd_last_advertised <<
"].\n";
770 ([
this, timeout_state, on_result, would_block_ret_val, event_set]
778 FLOW_LOG_TRACE(
"[User event loop] "
779 "Timeout fired for async op [" << event_set <<
"]; clean up and report to user.");
781 Error_code dummy_prevents_throw;
782 event_set->async_wait_finish(&dummy_prevents_throw);
791 ([
this, timeout_state, on_result, would_block_ret_val, event_set]
799 func([
this](){ hooray(m_data_member); });
803 func(1, 2, [
this](){ hooray(m_data_member); });
805 func([
this](){
return m_data_member; }, 1, 2);
808 const auto lambda = [
this](){ hooray(m_data_member); };
818void Cool_class::cool_method2(log::Logger* logger,
const flow::Function<
void ()>& on_completion_func)
821 cool_method2(logger, [
this]()
823 hooray(m_data_member);
842 m_data_member1(rnd()),
863 case Xfer_op_result::S_FULLY_XFERRED:
return "FULLY_XFERRED";
864 case Xfer_op_result::S_PARTIALLY_XFERRED:
return "PARTIALLY_XFERRED";
865 case Xfer_op_result::S_ERROR:
return "ERROR";
866 default: assert(
false);
880void Cool_class::some_method()
890 namespace util = flow::log::util;
892 using util::cool_util_method;
895 string x = cool_util_method() + util::some_free_function();
899const boost::unordered_map<Event_set::Event_type, Event_set::Func_ptr>
901 Event_set::S_EV_TYPE_TO_IS_ACTIVE_NODE_MTD
904 { Event_set::Event_type::S_PEER_SOCKET_READABLE, &Node::sock_is_readable },
905 { Event_set::Event_type::S_PEER_SOCKET_WRITABLE, &Node::sock_is_writable },
906 { Event_set::Event_type::S_SERVER_SOCKET_ACCEPTABLE, &Node::serv_is_acceptable }
1338auto x =
string{
"abc"};
1342struct Complex {
float m_real;
float m_imag; };
1343Complex num{ -2, 2.3 };
1344f(Complex{ -2, 2.3 });
1349vector<int> v{ 10, 1 };
1350vector<int> v(10, 1);
1356f(
static_cast<size_t>(-1));
1360f(
static_cast<unsigned int>(-1));
1366float metric_velocity_kph;
1370const size_t RAM_LIMIT_MI;
1371const uint64_t HARD_DRIVE_CAPACITY_G;
1375const auto count_usec = boost::chrono::microseconds{some_dur}.count();
1391using boost::chrono::microseconds;
1392using boost::chrono::milliseconds;
1393using boost::chrono::seconds;
1394using boost::chrono::round;
1395auto period = microseconds{332} + seconds{2};
1396auto period_msec = round<milliseconds>(period).count();
1397auto period_msec = milliseconds{period}.count();
1398old_api_that_takes_msec(period_msec);
1402microseconds some_period;
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.
Fine_clock::duration Fine_duration
A high-res time duration as computed from two Fine_time_pts.
Fine_clock::time_point Fine_time_pt
A high-res time point as returned by Fine_clock::now() and suitable for precise time math in general.
unsigned char uint8_t
Byte. Best way to represent a byte of binary data. This is 8 bits on all modern systems.