gcontini
2020-02-09 8e1bdfdca2ad2157fd74cedc1a6768a1b1c0849d
src/library/pc_identifier/default_strategy.cpp
@@ -12,6 +12,7 @@
using namespace std;
namespace license {
namespace pc_identifier {
static vector<LCC_API_IDENTIFICATION_STRATEGY> available_strategies() {
   ExecutionEnvironment exec;
@@ -46,11 +47,8 @@
   FUNCTION_RETURN ret = FUNC_RET_NOT_AVAIL;
   for (auto it : strategy_to_try) {
      LCC_API_IDENTIFICATION_STRATEGY strat_to_try = it;
      auto strategy_ptr = PcIdentifierFacade::STRATEGY_MAP.find(strat_to_try);
      if (strategy_ptr == PcIdentifierFacade::STRATEGY_MAP.end()) {
         throw logic_error("strategy not found");
      }
      ret = strategy_ptr->second->identify_pc(pc_id);
      unique_ptr<IdentificationStrategy> strategy_ptr = IdentificationStrategy::get_strategy(strat_to_try);
      ret = strategy_ptr->identify_pc(pc_id);
      if (ret == FUNC_RET_OK) {
         break;
      }
@@ -64,12 +62,9 @@
   FUNCTION_RETURN ret = FUNC_RET_NOT_AVAIL;
   for (auto it : strategy_to_try) {
      LCC_API_IDENTIFICATION_STRATEGY strat_to_try = it;
      auto strategy_ptr = PcIdentifierFacade::STRATEGY_MAP.find(strat_to_try);
      if (strategy_ptr == PcIdentifierFacade::STRATEGY_MAP.end()) {
         throw logic_error("strategy not found");
      }
      vector<PcIdentifier> alt_ids = strategy_ptr->second->alternative_ids();
      // identifiers.push_back(alt_ids);
      unique_ptr<IdentificationStrategy> strategy_ptr = IdentificationStrategy::get_strategy(strat_to_try);
      vector<PcIdentifier> alt_ids = strategy_ptr->alternative_ids();
      identifiers.insert(alt_ids.begin(), alt_ids.end(), identifiers.end());
   }
   return identifiers;
}
@@ -79,4 +74,5 @@
   return IDENTIFIERS_MISMATCH;
}
}  // namespace pc_identifier
} /* namespace license */