xo-reactor: prefer xo::bp spelling to xo::ref::brw

This commit is contained in:
Roland Conybeare 2025-07-05 13:54:04 -05:00
commit f9b7ab307a
9 changed files with 22 additions and 24 deletions

View file

@ -30,7 +30,7 @@ namespace xo {
/* visit direct downstream consumers c[i] of this event processor.
* call ep(c[i]) for each such consumer.
*/
virtual void visit_direct_consumers(std::function<void (ref::brw<AbstractEventProcessor> ep)> const & fn) = 0;
virtual void visit_direct_consumers(std::function<void (bp<AbstractEventProcessor> ep)> const & fn) = 0;
/* write representation to stream */
virtual void display(std::ostream & os) const = 0;

View file

@ -60,7 +60,7 @@ namespace xo {
if (reactor) {
if (is_priming) {
/* reactor/simulator takes delivery/sequencing responsibility from here */
reactor->notify_source_primed(ref::brw<ReactorSource>::from_native(this));
reactor->notify_source_primed(bp<ReactorSource>::from_native(this));
}
} else {
/* if no reactor, deliver immediately */
@ -181,7 +181,7 @@ namespace xo {
virtual std::string const & name() const override { return name_; }
virtual void set_name(std::string const & x) override { this->name_ = x; }
virtual void visit_direct_consumers(std::function<void (ref::brw<AbstractEventProcessor> ep)> const & fn) override {
virtual void visit_direct_consumers(std::function<void (bp<AbstractEventProcessor> ep)> const & fn) override {
for (auto x : this->cb_set_)
fn(x.fn_.borrow());
} /*visit_direct_consumers*/

View file

@ -17,9 +17,9 @@ namespace xo {
// ----- inherited from Reactor -----
virtual bool add_source(ref::brw<ReactorSource> src) override;
virtual bool remove_source(ref::brw<ReactorSource> src) override;
virtual void notify_source_primed(ref::brw<ReactorSource> src) override;
virtual bool add_source(bp<ReactorSource> src) override;
virtual bool remove_source(bp<ReactorSource> src) override;
virtual void notify_source_primed(bp<ReactorSource> src) override;
virtual std::uint64_t run_one() override;
private:

View file

@ -67,7 +67,7 @@ namespace xo {
virtual std::string const & name() const override { return this->poly_sink_->name(); }
virtual void set_name(std::string const & x) override { this->poly_sink_->set_name(x); }
virtual void visit_direct_consumers(std::function<void (ref::brw<AbstractEventProcessor> ep)> const & fn) override {
virtual void visit_direct_consumers(std::function<void (bp<AbstractEventProcessor> ep)> const & fn) override {
this->poly_sink_->visit_direct_consumers(fn);
}
virtual void display(std::ostream & os) const override {

View file

@ -25,7 +25,7 @@ namespace xo {
*
* returns true if source added; false if already present
*/
virtual bool add_source(ref::brw<ReactorSource> src) = 0;
virtual bool add_source(bp<ReactorSource> src) = 0;
/* remove source src from this reactor.
* source must previously have been added by
@ -35,12 +35,12 @@ namespace xo {
*
* returns true if source removed; false if not present
*/
virtual bool remove_source(ref::brw<ReactorSource> src) = 0;
virtual bool remove_source(bp<ReactorSource> src) = 0;
/* notification when non-primed source (source with no known events)
* becomes primed (source with at least one event)
*/
virtual void notify_source_primed(ref::brw<ReactorSource> src) = 0;
virtual void notify_source_primed(bp<ReactorSource> src) = 0;
/* dispatch one reactor event, borrowing the calling thread
* amount of work this represents is Source/Sink specific.

View file

@ -101,7 +101,7 @@ namespace xo {
if (reactor) {
if (is_priming) {
/* reactor/simulator takes responsibility for delivering events */
reactor->notify_source_primed(ref::brw<ReactorSource>::from_native(this));
reactor->notify_source_primed(bp<ReactorSource>::from_native(this));
}
} else {
/* special case if no reactor: deliver immediately */
@ -225,7 +225,7 @@ namespace xo {
virtual std::string const & name() const override { return name_; }
virtual void set_name(std::string const & x) override { this->name_ = x; }
virtual void visit_direct_consumers(std::function<void (ref::brw<AbstractEventProcessor> ep)> const & fn) override {
virtual void visit_direct_consumers(std::function<void (bp<AbstractEventProcessor> ep)> const & fn) override {
for(auto x : this->cb_set_)
fn(x.fn_.borrow());
@ -275,7 +275,7 @@ namespace xo {
if (reactor) {
if (is_priming) {
/* reactor/simulator takes responsibility for delivering events */
reactor->notify_source_primed(ref::brw<ReactorSource>::from_native(this));
reactor->notify_source_primed(bp<ReactorSource>::from_native(this));
}
} else {
/* if no reactor, deliver immediately */

View file

@ -141,7 +141,7 @@ namespace xo {
virtual std::string const & name() const override { return name_; }
virtual void set_name(std::string const & x) override { name_ = x; }
virtual void visit_direct_consumers(std::function<void (ref::brw<AbstractEventProcessor>)> const &) override {
virtual void visit_direct_consumers(std::function<void (bp<AbstractEventProcessor>)> const &) override {
/* *this is not an event source */
} /*visit_direct_consumers*/

View file

@ -6,7 +6,6 @@
#include <map>
namespace xo {
using ref::brw;
using xo::tostr;
using std::uint32_t;
@ -16,7 +15,7 @@ namespace xo {
* add to *m;
*/
void
map_network_helper(brw<AbstractEventProcessor> x,
map_network_helper(bp<AbstractEventProcessor> x,
uint32_t * tsort_ix,
std::unordered_map<AbstractEventProcessor*, uint32_t> * m)
{
@ -24,7 +23,7 @@ namespace xo {
return;
auto fn = [tsort_ix, m]
(brw<AbstractEventProcessor> ep)
(bp<AbstractEventProcessor> ep)
{
map_network_helper(ep, tsort_ix, m);
};

View file

@ -3,14 +3,13 @@
#include "PollingReactor.hpp"
namespace xo {
using ref::brw;
using std::size_t;
using std::uint64_t;
using std::int64_t;
namespace reactor {
bool
PollingReactor::add_source(brw<ReactorSource> src)
PollingReactor::add_source(bp<ReactorSource> src)
{
/* make sure src does not already appear in .source_v[] */
for(ReactorSourcePtr const & x : this->source_v_) {
@ -28,7 +27,7 @@ namespace xo {
} /*add_source*/
bool
PollingReactor::remove_source(brw<ReactorSource> src)
PollingReactor::remove_source(bp<ReactorSource> src)
{
auto ix = std::find(this->source_v_.begin(),
this->source_v_.end(),
@ -46,7 +45,7 @@ namespace xo {
} /*remove_source*/
void
PollingReactor::notify_source_primed(brw<ReactorSource>) {
PollingReactor::notify_source_primed(bp<ReactorSource>) {
/* nothing to do here -- all sources always checked by polling loop */
} /*notify_source_primed*/
@ -57,7 +56,7 @@ namespace xo {
/* search sources [ix .. z) */
for(size_t ix = start_ix; ix < z; ++ix) {
brw<ReactorSource> src = this->source_v_[ix];
bp<ReactorSource> src = this->source_v_[ix];
if(src->is_nonempty())
return ix;
@ -65,7 +64,7 @@ namespace xo {
/* search source [0 .. ix) */
for(size_t ix = 0, n = std::min(start_ix, z); ix < n; ++ix) {
brw<ReactorSource> src = this->source_v_[ix];
bp<ReactorSource> src = this->source_v_[ix];
if(src->is_nonempty())
return ix;
@ -86,7 +85,7 @@ namespace xo {
uint64_t retval = 0;
if(ix >= 0) {
brw<ReactorSource> src = this->source_v_[ix];
bp<ReactorSource> src = this->source_v_[ix];
log && log(xtag("src.name", src->name()));