Passing of parameters is done in BRITE via a configuration file. This file must be parsed and its contents must be put in a parameter data structure associated with the specific model we are implementing. BRITE provides a base class called ModelPar which is the base class for parameter classes for the models provided with BRITE.
For example, listing 1 shows a C++ excerpt containing the declaration of the RouterWaxPar class which is the parameter class associated to the Router Waxman model. This class contains data members for all parameters required by the Router Waxman model.
There is a single entry point to the parsing of configuration files, which is the method:
ModelPar* Parse::ParseConfigFile();
The method ParseConfigFile, which is invoked from BRITE's main routine, will determine the type of model that must be parsed and then it will invoke the specific method in charge of parsing parameters for the corresponding model. As an example, let's suppose that ParseConfigFile is parsing a configuration file for generating a Waxman topology. Listing 6.1.1 shows such a configuration file.
Upon parsing the field Name = 1, ParseConfigFile will determine that it must parse parameters for the RouterWaxman model and will invoke the appropriate parsing procedure, ParseRouterWaxman in this case. Excerpt 2 shows this logic.
ParseRouterWaxman, shown in code excerpt 3, will parse the parameters associated with the Waxman model.
At this point, ParseConfigFile returns to BRITE's main routine the data structure with the parameters just parsed. Next, BRITE instantiates an object of the model class we are creating, and uses it to create the corresponding topology. Code excerpt 4 shows the logic for the last step.
In summary with respect to parameter passing, when we are adding a new model we must create a parameter class, NewModelPar, which will contain the parameters for the new model. In addition, we must provide parsing procedure such as ParseRouterWaxman for our new model. Finally, we have to modify the following parts of the code: