Changeset 122 in flair-src for trunk/lib/FlairMeta/src/UavFactory.cpp
- Timestamp:
- Jan 6, 2017, 1:56:26 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairMeta/src/UavFactory.cpp
r45 r122 30 30 31 31 namespace { // anonymous 32 vector<flair::meta::Uav* (*)( FrameworkManager*,string,string,UavMultiplex*)> *vectoroffunctions=NULL;32 vector<flair::meta::Uav* (*)(string,string,UavMultiplex*)> *vectoroffunctions=NULL; 33 33 } 34 34 … … 41 41 42 42 43 Uav *CreateUav( FrameworkManager *parent, string uav_name, string uav_type,43 Uav *CreateUav(string name, string uav_type, 44 44 UavMultiplex *multiplex) { 45 45 … … 48 48 if(vectoroffunctions!=NULL) { 49 49 for(int i=0;i<vectoroffunctions->size();i++) { 50 uav=vectoroffunctions->at(i)( parent, uav_name,uav_type,multiplex);50 uav=vectoroffunctions->at(i)(name,uav_type,multiplex); 51 51 if(uav!=NULL) { 52 52 free(vectoroffunctions); … … 58 58 59 59 if (uav_type == "hds_x4") { 60 parent->Err("UAV type %s not yet implemented\n", uav_type.c_str());60 getFrameworkManager()->Err("UAV type %s not yet implemented\n", uav_type.c_str()); 61 61 return NULL; 62 62 } else if (uav_type == "hds_x8") { 63 return new HdsX8( parent, uav_name, multiplex);63 return new HdsX8(name, multiplex); 64 64 } else if (uav_type == "xair") { 65 return new XAir( parent, uav_name, multiplex);65 return new XAir(name, multiplex); 66 66 } else if (uav_type == "hds_xufo") { 67 parent->Err("UAV type %s not yet implemented\n", uav_type.c_str());67 getFrameworkManager()->Err("UAV type %s not yet implemented\n", uav_type.c_str()); 68 68 return NULL; 69 69 } else if (uav_type.compare(0, 7, "x4_simu") == 0) { … … 72 72 simu_id = atoi(uav_type.substr(7, uav_type.size() - 7).c_str()); 73 73 } 74 return new SimuX4( parent, uav_name, simu_id, multiplex);74 return new SimuX4(name, simu_id, multiplex); 75 75 } else if (uav_type.compare(0, 7, "x8_simu") == 0) { 76 76 int simu_id = 0; … … 78 78 simu_id = atoi(uav_type.substr(7, uav_type.size() - 7).c_str()); 79 79 } 80 return new SimuX8( parent, uav_name, simu_id, multiplex);80 return new SimuX8(name, simu_id, multiplex); 81 81 } else { 82 parent->Err("UAV type %s unknown\n", uav_type.c_str());82 getFrameworkManager()->Err("UAV type %s unknown\n", uav_type.c_str()); 83 83 return NULL; 84 84 } 85 85 } 86 86 87 void RegisterUavCreator(flair::meta::Uav*(*func)( FrameworkManager *parent, string uav_name, string uav_type,87 void RegisterUavCreator(flair::meta::Uav*(*func)(string name, string type, 88 88 UavMultiplex *multiplex)) { 89 if(vectoroffunctions==NULL) vectoroffunctions=(vector<flair::meta::Uav* (*)( FrameworkManager*,string,string,UavMultiplex*)>*)malloc(sizeof(vector<flair::meta::Uav* (*)(FrameworkManager*,string,string,UavMultiplex*)>));89 if(vectoroffunctions==NULL) vectoroffunctions=(vector<flair::meta::Uav* (*)(string,string,UavMultiplex*)>*)malloc(sizeof(vector<flair::meta::Uav* (*)(string,string,UavMultiplex*)>)); 90 90 91 91 vectoroffunctions->push_back(func);
Note:
See TracChangeset
for help on using the changeset viewer.