1 | #define maxmodules 50
|
---|
2 | #define maxconns 100
|
---|
3 | #define maxports 10
|
---|
4 | #define maxmigraionplatforms 10
|
---|
5 |
|
---|
6 | #include "InteruptOverlay.h"
|
---|
7 |
|
---|
8 |
|
---|
9 | class SamClass
|
---|
10 | {
|
---|
11 | private:
|
---|
12 | MainPortOverlay MainPort;
|
---|
13 | string myName;
|
---|
14 | string ports[maxports];
|
---|
15 | int portcounter;
|
---|
16 | Network yarp;
|
---|
17 |
|
---|
18 | string PossibleMigrationPlatforms[maxmigraionplatforms];
|
---|
19 |
|
---|
20 | public:
|
---|
21 | myPortReport myPortStatus;
|
---|
22 | SamClass()
|
---|
23 | {
|
---|
24 | portcounter =0;
|
---|
25 | myPortStatus.CopyMainPort=&MainPort;
|
---|
26 | }
|
---|
27 |
|
---|
28 | void StartModule(string NameOfModule)
|
---|
29 | {
|
---|
30 |
|
---|
31 | myName=NameOfModule;
|
---|
32 | MainPort.SetUp(NameOfModule);
|
---|
33 | MainPort.addOutput("/CONTROL","tcp");
|
---|
34 |
|
---|
35 | while(MainPort.isWriting()){}
|
---|
36 | Bottle& B = MainPort.prepare();
|
---|
37 | B.addString("Add_Module");
|
---|
38 | B.addString(NameOfModule.c_str());
|
---|
39 | for(int uu =0;uu<portcounter;uu++)
|
---|
40 | {
|
---|
41 | B.addString(ports[uu].c_str());
|
---|
42 | }
|
---|
43 | MainPort.write();
|
---|
44 |
|
---|
45 | }
|
---|
46 | void RecognisePort(string name)
|
---|
47 | {
|
---|
48 | ports[portcounter]=name.c_str();
|
---|
49 | portcounter++;
|
---|
50 | if(portcounter>maxports){portcounter=0;}
|
---|
51 | }
|
---|
52 |
|
---|
53 | void RegisterForMigration(void)
|
---|
54 | {
|
---|
55 | // switch namespaces
|
---|
56 | // open port
|
---|
57 | // switch namespace back
|
---|
58 | }
|
---|
59 |
|
---|
60 | void UpdateMigratoinPlatforms(void)
|
---|
61 | {
|
---|
62 | // switch to global namespace
|
---|
63 | // get a list of possible platforms
|
---|
64 | //string PossibleMigrationPlatforms[maxmigraionplatforms];
|
---|
65 | }
|
---|
66 | bool ConnectToPlatform(string platform)
|
---|
67 | {
|
---|
68 | //switch namespaces
|
---|
69 | // uses yarp.connect(thisname,platformname)
|
---|
70 | }
|
---|
71 | };
|
---|