fixed some style issues, added tooling for docs
This commit is contained in:
9
docs/core/error.md
Normal file
9
docs/core/error.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# core/error.h
|
||||
|
||||
## Free functions
|
||||
|
||||
### `std::mutex &error_mutex() noexcept;`
|
||||
### `inline T&& show(std::string_view name, T&& value) noexcept { ... }`
|
||||
### `std::lock_guard<std::mutex> lock(error_mutex());`
|
||||
### `inline T&& eval_and_show(std::string_view expr, T&& value) noexcept { ... }`
|
||||
### `std::lock_guard<std::mutex> lock(error_mutex());`
|
||||
10
docs/core/host.md
Normal file
10
docs/core/host.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# core/host.h
|
||||
|
||||
## class NetworkNic — public interface
|
||||
|
||||
### `Host(Simulator *const sim, NodeId id) noexcept;`
|
||||
### `virtual ~Host() = default;`
|
||||
### `NetworkNic *nic() const noexcept { ... }`
|
||||
### `void attach_nic(NetworkNic* nic) noexcept;`
|
||||
### `void detach_nic(NetworkNic* nic) noexcept;`
|
||||
### `Host(const Host &) = delete;`
|
||||
13
docs/core/logger.md
Normal file
13
docs/core/logger.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# core/logger.h
|
||||
|
||||
## class Logger — public interface
|
||||
|
||||
### `Logger(std::string_view path, bool append) noexcept;`
|
||||
### `~Logger() noexcept;`
|
||||
### `Logger(const Logger &) = delete;`
|
||||
### `Logger(Logger &&) = delete;`
|
||||
### `bool is_open() const noexcept { ... }`
|
||||
### `void write_line(std::string_view line) noexcept;`
|
||||
### `void flush() noexcept;`
|
||||
### `void close() noexcept;`
|
||||
### `std::string_view path() const noexcept { ... }`
|
||||
13
docs/core/node.md
Normal file
13
docs/core/node.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# core/node.h
|
||||
|
||||
## class Node — public interface
|
||||
|
||||
### `Node(Simulator *const sim, NodeId id, NodeType type) noexcept;`
|
||||
### `virtual ~Node() = default;`
|
||||
### `NodeId id() const noexcept;`
|
||||
### `NodeStatus status() const noexcept;`
|
||||
### `NodeType type() const noexcept;`
|
||||
### `void set_status(NodeStatus s) noexcept;`
|
||||
### `void boot(Time boottime_ns);`
|
||||
### `void reboot(Time boottime_ns);`
|
||||
### `Node(const Node &) = delete;`
|
||||
16
docs/core/rng.md
Normal file
16
docs/core/rng.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# core/rng.h
|
||||
|
||||
## class Rng — public interface
|
||||
|
||||
### `: _eng(seed) { ... }`
|
||||
### `void seed(seed_type s) noexcept { ... }`
|
||||
### `_eng.seed(s);`
|
||||
### `double uniform01() { ... }`
|
||||
### `Int uniform_range(Int lo_inclusive, Int hi_exclusive) { ... }`
|
||||
### `Int uniform_range(Int hi_exclusive) { ... }`
|
||||
### `double uniform_range(double lo_inclusive, double hi_exclusive) { ... }`
|
||||
### `std::uint64_t poisson(double lambda) { ... }`
|
||||
### `T choose_weighted(const std::vector<std::pair<double, T>>& items) { ... }`
|
||||
### `return choose_weighted_impl(items.begin(), items.end());`
|
||||
### `T choose_weighted(std::initializer_list<std::pair<double, T>> items) { ... }`
|
||||
### `return choose_weighted_impl(items.begin(), items.end());`
|
||||
27
docs/core/simulator.md
Normal file
27
docs/core/simulator.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# core/simulator.h
|
||||
|
||||
## Free functions
|
||||
|
||||
### `std::numeric_limits<InstanceId>::max();`
|
||||
### `std::numeric_limits<LinkId>::max();`
|
||||
|
||||
## class Rng — public interface
|
||||
|
||||
### `Simulator() = default;`
|
||||
### `static std::pair<InstanceId, Simulator *> create_simulator(InstanceId id);`
|
||||
### `static Simulator *get_simulator(InstanceId id) noexcept;`
|
||||
### `Time now() const noexcept;`
|
||||
### `EventId schedule_at(Time abs_time, F&& f, Args&&... args) { ... }`
|
||||
### `_event_pq.push(std::move(it));`
|
||||
### `EventId schedule_after(Time delay, F&& f, Args&&... args) { ... }`
|
||||
### `bool cancel(EventId id);`
|
||||
### `bool run_next();`
|
||||
### `void run_until(Time end_time);`
|
||||
### `void lock() noexcept;`
|
||||
### `bool is_locked() const noexcept { ... }`
|
||||
### `void flush_after(Time grace) noexcept;`
|
||||
### `Rng* create_rng(std::uint64_t seed);`
|
||||
### `Rng* get_rng() noexcept;`
|
||||
### `Rng const* get_rng() const noexcept;`
|
||||
### `Link* get_link(LinkId id) noexcept;`
|
||||
### `Link const* get_link(LinkId id) const noexcept;`
|
||||
36
docs/core/time.md
Normal file
36
docs/core/time.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# core/time.h
|
||||
|
||||
## Free functions
|
||||
|
||||
### `constexpr Time operator""_ns(unsigned long long v) noexcept { ... }`
|
||||
### `return Time::from_ns(static_cast<Time::rep>(v));`
|
||||
### `constexpr Time operator""_us(unsigned long long v) noexcept { ... }`
|
||||
### `return Time::from_us(static_cast<Time::rep>(v));`
|
||||
### `constexpr Time operator""_ms(unsigned long long v) noexcept { ... }`
|
||||
### `return Time::from_ms(static_cast<Time::rep>(v));`
|
||||
### `constexpr Time operator""_s (unsigned long long v) noexcept { ... }`
|
||||
### `return Time::from_s (static_cast<Time::rep>(v));`
|
||||
|
||||
## class Time — public interface
|
||||
|
||||
### `constexpr Time() : _nsec(0) { ... }`
|
||||
### `explicit constexpr Time(rep ns) : _nsec(ns) { ... }`
|
||||
### `static constexpr Time from_ns(rep ns) noexcept { ... }`
|
||||
### `return Time(ns);`
|
||||
### `static constexpr Time from_us(rep us) noexcept { ... }`
|
||||
### `return Time(us * 1000ULL);`
|
||||
### `static constexpr Time from_ms(rep ms) noexcept { ... }`
|
||||
### `return Time(ms * 1000ULL * 1000ULL);`
|
||||
### `static constexpr Time from_s (rep s ) noexcept { ... }`
|
||||
### `return Time(s * 1000ULL * 1000ULL * 1000ULL);`
|
||||
### `constexpr rep ns() const noexcept { ... }`
|
||||
### `constexpr rep count() const noexcept { ... }`
|
||||
### `static constexpr rep us_to_ns(rep us) noexcept { ... }`
|
||||
### `static constexpr rep ms_to_ns(rep ms) noexcept { ... }`
|
||||
### `return Time(a._nsec + b._nsec);`
|
||||
### `return Time(a._nsec * b._nsec);`
|
||||
### `return safe_sub(a, b);`
|
||||
### `if (a._nsec < b._nsec) { ... }`
|
||||
### `return Time(a._nsec - b._nsec);`
|
||||
### `constexpr Time unsafe_sub(Time t) const noexcept { ... }`
|
||||
### `return Time(this->_nsec - t._nsec);`
|
||||
13
docs/core/timer.md
Normal file
13
docs/core/timer.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# core/timer.h
|
||||
|
||||
## class Timer — public interface
|
||||
|
||||
### `Timer() { ... }`
|
||||
### `init();`
|
||||
### `void init() noexcept { ... }`
|
||||
### `_start = clock::now();`
|
||||
### `Time start() const noexcept { ... }`
|
||||
### `auto tp = _start.time_since_epoch();`
|
||||
### `Time now() const noexcept { ... }`
|
||||
### `auto tp = clock::now().time_since_epoch();`
|
||||
### `Time elapsed() const noexcept { ... }`
|
||||
6
docs/core/types.md
Normal file
6
docs/core/types.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# core/types.h
|
||||
|
||||
## Free functions
|
||||
|
||||
### `inline IPv4Addr ipv4(NodeId n, PortId p) noexcept { ... }`
|
||||
### `return (static_cast<uint32_t>(n) << 16) | static_cast<uint32_t>(p);`
|
||||
Reference in New Issue
Block a user