--------------------------------------------------------------------------------------- Initialize - Config
| 62 | //--------------------------------------------------------------------------------------- |
| 63 | // Initialize - Config |
| 64 | bool CCudaDataOperationAlgorithm::initialize(const Config& _cfg) |
| 65 | { |
| 66 | ConfigReader<CAlgorithm> CR("CCudaDataOperationAlgorithm", this, _cfg); |
| 67 | |
| 68 | // operation |
| 69 | if (!CR.getRequiredString("Operation", m_sOperation)) |
| 70 | return false; |
| 71 | m_sOperation.erase(std::remove(m_sOperation.begin(), m_sOperation.end(), ' '), m_sOperation.end()); |
| 72 | |
| 73 | // data |
| 74 | vector<int> data; |
| 75 | if (!CR.getRequiredIntArray("DataId", data)) |
| 76 | return false; |
| 77 | for (vector<int>::iterator it = data.begin(); it != data.end(); ++it){ |
| 78 | m_pData.push_back(dynamic_cast<CData2D*>(CData2DManager::getSingleton().get(*it))); |
| 79 | } |
| 80 | |
| 81 | bool ok = true; |
| 82 | |
| 83 | ok &= CR.getRequiredNumericalArray("Scalar", m_fScalar); |
| 84 | |
| 85 | if (CR.hasOption("GPUIndex")) |
| 86 | ok &= CR.getOptionInt("GPUIndex", m_iGPUIndex, -1); |
| 87 | else |
| 88 | ok &= CR.getOptionInt("GPUindex", m_iGPUIndex, -1); |
| 89 | |
| 90 | int id = -1; |
| 91 | if (CR.getOptionID("MaskId", id)) { |
| 92 | m_pMask = dynamic_cast<CData2D*>(CData2DManager::getSingleton().get(id)); |
| 93 | } |
| 94 | |
| 95 | if (!ok) |
| 96 | return false; |
| 97 | |
| 98 | _check(); |
| 99 | |
| 100 | if (!m_bIsInitialized) |
| 101 | return false; |
| 102 | |
| 103 | return true; |
| 104 | } |
| 105 | |
| 106 | //--------------------------------------------------------------------------------------- |
| 107 | // Initialize - C++ |
nothing calls this directly
no test coverage detected