MCPcopy Create free account
hub / github.com/astra-toolbox/astra-toolbox / initialize

Method initialize

src/CudaDataOperationAlgorithm.cpp:64–104  ·  view source on GitHub ↗

--------------------------------------------------------------------------------------- Initialize - Config

Source from the content-addressed store, hash-verified

62//---------------------------------------------------------------------------------------
63// Initialize - Config
64bool 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++

Callers

nothing calls this directly

Calls 8

removeFunction · 0.85
getRequiredStringMethod · 0.80
getRequiredIntArrayMethod · 0.80
getMethod · 0.80
getOptionIDMethod · 0.80
hasOptionMethod · 0.45
getOptionIntMethod · 0.45

Tested by

no test coverage detected