Changeset 41 in flair-src for trunk/lib/FlairMeta


Ignore:
Timestamp:
Jun 28, 2016, 3:20:04 PM (8 years ago)
Author:
Sanahuja Guillaume
Message:

m

Location:
trunk/lib/FlairMeta/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairMeta/src/UavFactory.cpp

    r15 r41  
    2929using namespace flair::meta;
    3030
     31namespace { // anonymous
     32     vector<flair::meta::Uav* (*)(FrameworkManager*,string,string,UavMultiplex*)> vectoroffunctions;
     33}
     34
    3135Uav *CreateUav(FrameworkManager *parent, string uav_name, string uav_type,
    3236               UavMultiplex *multiplex) {
    33   /*if(uav_type=="ardrone2") {
    34         return new ArDrone2(parent,uav_name,multiplex);
    35     } else */ if (uav_type == "hds_x4") {
     37
     38  Uav *uav;
     39  for(int i=0;i<vectoroffunctions.size();i++) {
     40    uav=vectoroffunctions.at(i)(parent, uav_name, uav_type,multiplex);
     41    if(uav!=NULL) return uav;
     42  }
     43
     44  if (uav_type == "hds_x4") {
    3645    parent->Err("UAV type %s not yet implemented\n", uav_type.c_str());
    3746    return NULL;
     
    6069  }
    6170}
     71
     72void RegisterUavCreator(flair::meta::Uav*(*func)(FrameworkManager *parent, string uav_name, string uav_type,
     73               UavMultiplex *multiplex)) {
     74                 vectoroffunctions.push_back(func);
     75
     76}
  • trunk/lib/FlairMeta/src/UavFactory.h

    r15 r41  
    2525                            flair::filter::UavMultiplex *multiplex = NULL);
    2626
     27void RegisterUavCreator(flair::meta::Uav*(*func)(flair::core::FrameworkManager *parent,
     28                                   std::string uav_name, std::string uav_type,
     29                                   flair::filter::UavMultiplex *multiplex));
    2730#endif // UAVFACTORY
Note: See TracChangeset for help on using the changeset viewer.