source: libs/SamgarWRUTed/tags/1.0/libSamgar/examples/SamgarMigrate.cpp @ 447

Revision 447, 1.7 KB checked in by lmalek, 10 years ago (diff)

tree structure reorganization

Line 
1#include <Samgar.h>
2using namespace std;
3
4list<Samgar::ModuleStruct>::iterator ItMod;
5list<string>      ::iterator ItPlat;
6
7
8int main() {
9
10  int ccc =0;
11  Network yarp;
12  Samgar::SamgarModule Control("Control","Something","Something",Samgar::ModeRun); // Cant have spaces or underscores
13  Control.TurnOnModuleListener(); // this allows it to accept messages
14                                  // about the status of other modules
15                                  // and platforms
16  Control.GetAvailPlatforms();    // send out a msg to the network to
17                                  // get other places that can be
18                                  // migrated to
19  // have to carefull with this command, use it rapidly and it could bring the whole network down
20  while(1) {
21    yarp::os::Time::delay(8); // a small delay
22    //Control.GetAvailPlatforms();
23    // this will list out all the modules available to it
24    printf(" \n \n The available modules are : \n");
25    // the ListOfKnownModules is updated everytime the GUI finds or
26    // loses a module, although there can be a small delay.
27    for ( ItMod=Control.ListOfKnownModules.begin();
28          ItMod != Control.ListOfKnownModules.end();
29          ItMod++ ){
30      string name = ItMod->name;
31      string cat1 = ItMod->catagory;
32      string cat2 = ItMod->subcatagory;
33      string Combi = name + " " + cat1 + " " + cat2 + "\n";
34      printf("%s",Combi.c_str());
35    }
36    printf(" \n \n The available platforms are : \n");
37    for ( ItPlat=Control.ListOfKnownPlatforms.begin();
38          ItPlat != Control.ListOfKnownPlatforms.end();
39          ItPlat++ ) {
40      string name = ItPlat->c_str();// + "\n";
41      name = name +"\n";
42      printf("%s",name.c_str());
43    }
44    Control.SucceedFail(true,888);
45  }
46  return 0;
47}
Note: See TracBrowser for help on using the repository browser.