Merge pull request 'doc: Adjust code layout and rendering display.' (#1) from kinoshitakenta/event_transformer:main into main

Reviewed-on: http://192.168.29.157:3000/bkinnightskytw/event_transformer/pulls/1
This commit is contained in:
bkinnightskytw 2024-04-30 15:33:27 +08:00
commit dddcb83f25
1 changed files with 7 additions and 9 deletions

View File

@ -8,9 +8,7 @@ Current implementation require you to define(override) all the event specific di
> >
> However, it seems dynamic reflection is necessary for implementation, but C++ have no this feature therefore impossible to achieve. > However, it seems dynamic reflection is necessary for implementation, but C++ have no this feature therefore impossible to achieve.
## basic usage ```cpp
```c++
#include <event_transformer.h> #include <event_transformer.h>
#include <so_5/all.hpp> #include <so_5/all.hpp>
@ -18,8 +16,10 @@ struct AEvent
{ {
double speed; // parameter of event double speed; // parameter of event
}; };
struct BEvent struct BEvent
{}; {};
/** /**
* @brief * @brief
* as an interface for fake module process * as an interface for fake module process
@ -37,8 +37,7 @@ class So5_fake_module_process_ev : virtual public Fake_module_process_ev
so_5::mbox_t target; so_5::mbox_t target;
public: public:
So5_fake_module_process_ev(so_5::mbox_t target_) So5_fake_module_process_ev(so_5::mbox_t target_) : target(target_)
: target(target_)
{ {
} }
@ -55,12 +54,11 @@ public:
} }
}; };
void void fake_module_process(Fake_module_process_ev* evt_li_ptr)
fake_module_process(Fake_module_process_ev* evt_li_ptr)
{ {
//... // ...
dispatch(evt_li_ptr, a_ev); dispatch(evt_li_ptr, a_ev);
//... // ...
} }
``` ```