today, I like to ask you a question towards the capabilities of C++ to realize a specific software architecture.
Of course, I have used the search but have not found any directly linked answer.
Basically, my goal is to build a program which allows the user for modeling and simulation of arbitrarily composed physical systems, e.g. a driving car. I assume to have a library of physical models (functions within classes). Each function may have some inputs and return some outputs depending on the underlying physical description, e.g. a combustion engine model, an aerodynamic drag model, a wheel model, etc.
Now, the idea is to provide the user a framework which allows him to compose any functions according to his needs, i.e. to map any physical behavior. The framework should provide functionalities to connect the outputs and inputs of different functions. Therefore, the framework provides a container class. I call it COMPONENT, which is able to hold one or many model objects (FUNCTION). These containers can also hold other components (cf. composite pattern) as well as the connections (CONNECTOR) between the function parameters. Additionally, the component class provides some general numeric functionalities such as math solver and so on.
The composition of functions should be done during runtime. In the first instance, the user should be able to set up a composition through importing an XML which defines the composition structure. Later, one could think of adding a GUI.
To give you a better understanding here is a very simplified example:
<COMPONENT name="Main">
<COMPONENT name="A">
<FUNCTION name="A1" path="lib/functionA1" />
</COMPONENT>
<COMPONENT name="B">
<FUNCTION name="B1" path="lib/functionB1" />
<FUNCTION name="B2" path="lib/functionB2" />
</COMPONENT>
<CONNECTIONS>
<CONNECTOR source="A1" target="B1" />
<CONNECTOR source="B1" target="B2" />
</CONNECTIONS>
</COMPONENT>
It is not necessary to dive deeper into the framework's capabilities because my problem is much more general. When the framework code/program is compiled, the physical problem description, as well as the user-defined functions, are not known. When the user selects (via XML or later via a GUI) a function, the framework should read the function information, i.e. should get the information of input and output parameters, in order to offer the user the option to interconnect the functions.
I know the principles of reflection and I am aware that C++ does not provide this feature. However, I am sure that the concept of "building objects during runtime" is very often required. How should I set up my software architecture in C++ to achieve my goal? Is C++ the right language? What do I overlook?
Thanks in advance!
Cheers, Oliver