targeting.cpp (fabe92e8ed1cbb65e4b054f41688935416765917) | targeting.cpp (be407166d0cb22f6967055b426c805e82ac48af8) |
---|---|
1/** 2 * Copyright © 2017 IBM Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 --- 23 unchanged lines hidden (view full) --- 32 { 33 cfamFD = std::make_unique< 34 openpower::util::FileDescriptor>(getCFAMPath()); 35 } 36 37 return cfamFD->get(); 38} 39 | 1/** 2 * Copyright © 2017 IBM Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 --- 23 unchanged lines hidden (view full) --- 32 { 33 cfamFD = std::make_unique< 34 openpower::util::FileDescriptor>(getCFAMPath()); 35 } 36 37 return cfamFD->get(); 38} 39 |
40std::unique_ptr<Target>& Targeting::getTarget(size_t pos) 41{ 42 auto search = [pos](const auto& t) 43 { 44 return t->getPos() == pos; 45 }; |
|
40 | 46 |
47 auto target = find_if(targets.begin(), targets.end(), search); 48 if (target == targets.end()) 49 { 50 throw std::runtime_error("Target not found: " + std::to_string(pos)); 51 } 52 else 53 { 54 return *target; 55 } 56} 57 58 |
|
41Targeting::Targeting(const std::string& fsiMasterDev, 42 const std::string& fsiSlaveDir) : 43 fsiMasterPath(fsiMasterDev), 44 fsiSlaveBasePath(fsiSlaveDir) 45{ 46 //Always create P0, the FSI master. 47 targets.push_back(std::make_unique<Target>(0, fsiMasterPath)); 48 --- 33 unchanged lines hidden --- | 59Targeting::Targeting(const std::string& fsiMasterDev, 60 const std::string& fsiSlaveDir) : 61 fsiMasterPath(fsiMasterDev), 62 fsiSlaveBasePath(fsiSlaveDir) 63{ 64 //Always create P0, the FSI master. 65 targets.push_back(std::make_unique<Target>(0, fsiMasterPath)); 66 --- 33 unchanged lines hidden --- |