source: UH/SAMGAR/SAMGAR LIB/Trunk/TesterFiles/SamgarMigrate.cpp @ 187

Revision 187, 1.7 KB checked in by KDucasse, 10 years ago (diff)
Line 
1#include <SamgarMainClass.h>
2using namespace std;
3
4list<ModuleStruct>::iterator ItMod;
5list<string>      ::iterator ItPlat;
6
7
8int main() {
9
10int ccc =0;
11Network yarp;
12SamgarModule MyFirstTest("Module2","behaviour","happy",run); // Cant have spaces or underscores
13MyFirstTest.AddPortS("num100");
14MyFirstTest.AddPortS("num200");
15MyFirstTest.TurnOnModuleListener();                     // this allows it to accept messages about the status of other modules and platforms
16MyFirstTest.GetAvailPlatforms();                        // send out a msg to the network to get other places that can be migrated to
17                                                                                        // have to carefull with this command, use it rapidly and it could bring the whole network down
18while(1)
19{
20
21        yarp::os::Time::delay(8); // a small delay
22
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 loses a module, although there can be a small delay.
26        for ( ItMod=MyFirstTest.ListOfKnownModules.begin() ; ItMod != MyFirstTest.ListOfKnownModules.end(); ItMod++ )
27                {
28                        string name = ItMod->name;
29                        string cat1 = ItMod->catagory;
30                        string cat2 = ItMod->subcatagory;
31                        string Combi = name + " " + cat1 + " " + cat2 + "\n";
32                        printf(Combi.c_str());
33                }
34
35        printf(" \n \n The available platforms are : \n");
36        // this command sends a message to the GUI to ask for new data to which companion shells there are to migrate to
37        MyFirstTest.GetAvailPlatforms();
38                for ( ItPlat=MyFirstTest.ListOfKnownPlatforms.begin() ; ItPlat != MyFirstTest.ListOfKnownPlatforms.end(); ItPlat++ )
39                {
40                        string name = ItPlat->c_str();// + "\n";
41                        name = name +"\n";
42                        printf(name.c_str());
43                }
44        MyFirstTest.SucceedFail(true,888);
45}
46  return 0;
47}
Note: See TracBrowser for help on using the repository browser.