I have an line detection Algorithm that uses a Solver(optimization Algo) to find some solutions for the line-detection problem.
class line-detect {
public:
(some functions);
private:
solver mSolve;
}
class Solver {
public:
(Some functions);
private:
(some functions);
}
In solver.cpp, the size of workspace/buffer used for solver computations is allocated using line-detect algo variables.
In Solver.cpp, size of workspace is allocated as below:
const uint32_t SIZEOF_WORKSPACE = static_cast<uint32_t>(((2 * NUM_ERRS_MAX) + (5 * NUM_VARS_MAX) + NUM_VARS_MAX * NUM_ERRS_MAX ) * sizeof(float64_t) + (NUM_VARS_MAX * sizeof(int32_t)));
Currently the solver is within the algo itself, but I want to extract out the solver and use as a separate entity/module. I have extracted the solver but this size workspace/buffer has to allocated statically(i.e I have to hard-coded the line-detect algo values in solver module)
Ques: What is the best possible way to allocate the size of workspace without having to hard-code the line-detect algo variables in the solver module ?
Aucun commentaire:
Enregistrer un commentaire