gcontini
2020-02-15 483c73630a82fe8fbe9fe74cc8bbdd23a13d8b6b
src/library/hw_identifier/default_strategy.cpp
File was renamed from src/library/pc_identifier/default_strategy.cpp
@@ -6,13 +6,12 @@
 */
#include <vector>
#include "pc_identifier_facade.hpp"
#include "../os/execution_environment.hpp"
#include "default_strategy.hpp"
using namespace std;
namespace license {
namespace pc_identifier {
namespace hw_identifier {
static vector<LCC_API_IDENTIFICATION_STRATEGY> available_strategies() {
   ExecutionEnvironment exec;
@@ -42,7 +41,7 @@
LCC_API_IDENTIFICATION_STRATEGY DefaultStrategy::identification_strategy() const { return STRATEGY_DEFAULT; }
FUNCTION_RETURN DefaultStrategy::identify_pc(PcIdentifier& pc_id) const {
FUNCTION_RETURN DefaultStrategy::identify_pc(HwIdentifier& pc_id) const {
   vector<LCC_API_IDENTIFICATION_STRATEGY> strategy_to_try = available_strategies();
   FUNCTION_RETURN ret = FUNC_RET_NOT_AVAIL;
   for (auto it : strategy_to_try) {
@@ -56,23 +55,23 @@
   return ret;
}
std::vector<PcIdentifier> DefaultStrategy::alternative_ids() const {
std::vector<HwIdentifier> DefaultStrategy::alternative_ids() const {
   vector<LCC_API_IDENTIFICATION_STRATEGY> strategy_to_try = available_strategies();
   vector<PcIdentifier> identifiers;
   vector<HwIdentifier> identifiers;
   FUNCTION_RETURN ret = FUNC_RET_NOT_AVAIL;
   for (auto it : strategy_to_try) {
      LCC_API_IDENTIFICATION_STRATEGY strat_to_try = it;
      unique_ptr<IdentificationStrategy> strategy_ptr = IdentificationStrategy::get_strategy(strat_to_try);
      vector<PcIdentifier> alt_ids = strategy_ptr->alternative_ids();
      vector<HwIdentifier> alt_ids = strategy_ptr->alternative_ids();
      identifiers.insert(alt_ids.begin(), alt_ids.end(), identifiers.end());
   }
   return identifiers;
}
LCC_EVENT_TYPE DefaultStrategy::validate_identifier(const PcIdentifier& identifier) const {
LCC_EVENT_TYPE DefaultStrategy::validate_identifier(const HwIdentifier& identifier) const {
   // default strategy should always realize itself as a concrete strategy
   return IDENTIFIERS_MISMATCH;
}
}  // namespace pc_identifier
}  // namespace hw_identifier
} /* namespace license */