O_o
Okay.
So, totally serial, why aren't you going to approach the design as has been explained?
I've read the thread; it seems like you don't want to follow good design patterns because "It will be difficult."!?
Who told you that programming was going to be anything other than difficult? I'd like to know just so that I may avoid such a clearly deranged individual.
Anyway, you clearly need to centralize access to the configuration data. If your building a test harness for algorithmic statistics gathering, as it seems, passing all the configuration independently is extreme, wasteful, and foolish. You would not even need to know exactly what configuration data each function needs to use it!
You don't even have to parse the data in advance if you don't want to build the configuration structure in advance.
Code:
// adapted from the code posted by grumpy
class SControlParameters
{
SControlParameters
(
const std::string & fFilename
);
// ...
std::string queryValue
(
const std::string & fLabel
)
{
// ...
return(parsed_value);
}
// ...
};
void YourFunction(const std::string &filename, SControlParameters ¶meters)
{
// do whatever is needed, in nice, small, well-defined pieces, including separate supporting functions.
}
That said, it sounds like you are in desperate need of a primer on functional decomposition and function composition because it sounds as if you've tried and failed horribly to get algorithmic polymorphisms.
I don't know what you are doing exactly, but consider that each method of calculation can be a yield and each method of comparison can be provided these strategies through nested composition by client routines or tables. You don't have to build a specific function for each combination of comparison strategy, comparison property, and method of solution. You are already providing the data to a function as parameters, just go ahead and provide the method of determining patterns to functions as well.
Yeah, this is an extreme example, but the point remains, if you have many dozens of functions ultimately only gluing components together, you can rather well simply glue them together as part of an expression.
Soma
Code:
std::complex<double> SolveDifferentialEquation_DivideConquer(/*FIXED_INTERFACE*/);
std::complex<double> SolveDifferentialEquation_RecursiveAppliance(/*FIXED_INTERFACE*/);
// ...
class SYield
{
class Iterator
{
// ...
};
SYield(/**/);
// ...
};
// ...
typedef /**/ FuzzyComparisonValue;
// ...
FuzzyComparisonValue Compare_Precision
(
SYield::Iterator fOriginType1
, SYield::Iterator fTerminusType1
, SYield::Iterator fOriginType2
, SYield::Iterator fTerminusType2
);
FuzzyComparisonValue Compare_Distance
(
SYield::Iterator fOriginType1
, SYield::Iterator fTerminusType1
, SYield::Iterator fOriginType2
, SYield::Iterator fTerminusType2
)
{
FuzzyComparisonValue sResult;
while(fOriginType1 != fTerminusType1) && (fOriginType2 != fTerminusType2))
{
// Compare *fOriginType1 with *fOriginType2 and accumulate the results.
}
return(sResult);
}
// ...
FuzzyComparisonValue HarnessFuzzyResults(/**/);
// ...
{
// ...
std::vector<std::complex<double> > sData(parameters.loadData("dataname"));
SYield sDivideConquer(SolveDifferentialEquation_DivideConquer, sData);
SYield sRecursiveAppliance(SolveDifferentialEquation_RecursiveAppliance, sData);
FuzzyComparisonValue sDifferentialEquation(HarnessFuzzyResults(Compare_Precision, sDivideConquer, sRecursiveAppliance));
// ...
}