0

我已经用包装器对象覆盖了 state_machine 对象以隐藏 asynchronous_state_machine 初始化。

    class MyObject : public sc::asynchronous_state_machine< MyObject, MyObjectStateIdle, Scheduler, Allocator >;

    MyObjectShell(constructor data){
        Scheduler scheduler( true );
        mProcessor = scheduler.create_processor< MyObject >(constructor data);
        scheduler.initiate_processor( mProcessor );
        mThread = std::move(Thread(boost::bind(
               &sc::fifo_scheduler<>::operator(), &scheduler1, 0 )));
    }

    const MyObject* GetMyObject() const { /* What to place here to return MyObject, That I created via "scheduler.create_processor< MyObject >" */ }

    const MyObject_state_enum GetState() const { /* What to place here to return MyObject's state*/ }

MyObject 是我的 async_state_machine

但是我仍然需要从 stateMachine 之外访问 MyObject。我如何从 mProcessor 或其他任何地方获取它?或者我只能通过 scheduler.queue_event( mProcessor , parameters_); 与 state_machine 交谈。?

4

0 回答 0