Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:50:45+00:00 2026-06-05T01:50:45+00:00

I am newbi to boost msm and boost in general. I would like to

  • 0

I am newbi to boost msm and boost in general.
I would like to somehow encapsulate all the:

  • event structures
  • stateMahine structure containing the transition table structure and the state structures

within a Class.

How can I do that?

// events
struct event1 {};



// front-end: define the FSM structure 
struct my_machine_ : public msm::front::state_machine_def<my_machine_>
{
    // The list of FSM states
    struct State1 : public msm::front::state<> 
    {
        // every (optional) entry/exit methods get the event passed.
        template <class Event,class FSM>
        void on_entry(Event const&,FSM& ) {std::cout << "entering: State1" << std::endl;}
        template <class Event,class FSM>
        void on_exit(Event const&,FSM& ) {std::cout << "leaving: State1" << std::endl;}
    };

    struct State2 : public msm::front::state<> 
    { 
        template <class Event,class FSM>
        void on_entry(Event const& ,FSM&) {std::cout << "entering: State3" << std::endl;}
        template <class Event,class FSM>
        void on_exit(Event const&,FSM& ) {std::cout << "leaving: State3" << std::endl;}


    };

    // the initial state of the player SM. Must be defined
    typedef State1 initial_state;

    typedef my_machine_ p; // makes transition table cleaner

    // Transition table
    struct transition_table : mpl::vector<
        //    Start     Event         Next      Action               Guard
        //  +---------+-------------+---------+---------------------+----------------------+
        Row < State1  , event1      , State2                                               >,
        Row < State2  , event1      , State1                                           >
    > {};

};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:50:48+00:00Added an answer on June 5, 2026 at 1:50 am

    To implement the member of a nested use:

    // header file
    struct Foo {
      struct Nested {
        void mem();
      };
    };
    // cpp file
    void Foo::Nested::mem() {
      // implementation goes here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a newbie in boost.python and i'm getting this error that I would like
Ok.. First of all, I have to say I'm using BOOST with its source
I would like to solve the system of linear equations: Ax = b A
For start I would like to say that I am newbie. I am trying
I would like to return a noncopyable object of type Foo from a function.
I am a newbie to Boost C++ libraries. I was wondering if there are
sorry if this is a newB question, please conider the following code: #include <boost/multi_index_container.hpp>
i am an android newbi. i extend my apologies for a very primitive question.
Hi and thanks for looking at this newbi question. I have looked for anykind
I'm a newbie about boost. I compiled boost libraries with success (under mac os

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.