In the current project, there are lots of GetData() method, which get different kind of data from hand written database at run time, and set them in different fields in a class. The projects then have such methods.
void GetData(Datatype type, int& value);
void GetData(Datatype type, double& value);
void GetData(Datatype type, long& value);
void GetData(Datatype type, longlong& value);
....
There are lots of data types, so, these method are often called with a switch with lots of branches.
void GetData(Datatype type, int& value)
{
switch(type)
{
Type1:
value = GetDataFromDB1(TYPE1);
Type2:
value = .. //get from different source
...
}
}
void GetData(Datatype type, double& value)
....
As you see, the the GetData()s are classified according to the second param. And within each single GetData(), there are lots of branches. Is this a reasonable method to get data?