Use the new convenience constructor eliminating the need to call setup separately.
This commit is contained in:
parent
5de5419e25
commit
13a7eeef74
1 changed files with 8 additions and 12 deletions
|
@ -67,25 +67,21 @@ int main()
|
||||||
SG_DDS participant;
|
SG_DDS participant;
|
||||||
std::map<std::string, SG_DDS_Topic *> topics;
|
std::map<std::string, SG_DDS_Topic *> topics;
|
||||||
|
|
||||||
topics["gui"] = new SG_DDS_Topic();
|
FG_DDS_GUI gui;
|
||||||
topics["fdm"] = new SG_DDS_Topic();
|
topics["gui"] = new SG_DDS_Topic(gui, &FG_DDS_GUI_desc);
|
||||||
topics["ctrls"] = new SG_DDS_Topic();
|
|
||||||
|
|
||||||
topics["gui"]->setup<FG_DDS_GUI>(&FG_DDS_GUI_desc);
|
|
||||||
topics["fdm"]->setup<FG_DDS_FDM>(&FG_DDS_FDM_desc);
|
|
||||||
topics["ctrls"]->setup<FG_DDS_Ctrls>(&FG_DDS_Ctrls_desc);
|
|
||||||
|
|
||||||
participant.add(topics["gui"], SG_IO_IN);
|
participant.add(topics["gui"], SG_IO_IN);
|
||||||
|
|
||||||
|
FG_DDS_FDM fdm;
|
||||||
|
topics["fdm"] = new SG_DDS_Topic(fdm, &FG_DDS_FDM_desc);
|
||||||
participant.add(topics["fdm"], SG_IO_IN);
|
participant.add(topics["fdm"], SG_IO_IN);
|
||||||
|
|
||||||
|
FG_DDS_Ctrls ctrls;
|
||||||
|
topics["ctrls"] = new SG_DDS_Topic(ctrls, &FG_DDS_Ctrls_desc);
|
||||||
participant.add(topics["ctrls"], SG_IO_IN);
|
participant.add(topics["ctrls"], SG_IO_IN);
|
||||||
|
|
||||||
set_mode(1);
|
set_mode(1);
|
||||||
while(participant.wait(0.1f))
|
while(participant.wait(0.1f))
|
||||||
{
|
{
|
||||||
FG_DDS_Ctrls ctrls;
|
|
||||||
FG_DDS_FDM fdm;
|
|
||||||
FG_DDS_GUI gui;
|
|
||||||
|
|
||||||
if (topics["gui"]->read(gui)) {
|
if (topics["gui"]->read(gui)) {
|
||||||
printf("=== [fgfdm_log] Received : ");
|
printf("=== [fgfdm_log] Received : ");
|
||||||
printf("GUI Message:\n");
|
printf("GUI Message:\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue