from Part II - Modeling Custom Networks and Protocols
Published online by Cambridge University Press: 05 February 2012
This chapter demonstrates how to write your own high-level wrapper APIs which encapsulate many OPNET programming details, in order to facilitate and accelerate design and programming of OPNET models. We also provide several wrapper API packages to help users to quickly build their models. To be able to follow this chapter, you are assumed to know how to write custom models as shown in Chapter 5, and the basics of generic programming.
Why and how to use wrapper APIs
When creating a simulation model, one often needs to repetitively write code with some similar functionalities. To speed up modeling and coding, one can write some wrapper functions that implement those commonly used functionalities. These wrapper functions will save modeling time and reduce the chances of making errors. Wrapper APIs here refer to the functions that encapsulate many programming details and implement particular functionalities at higher level. Figure 6.1 shows an example of a wrapper API that is defined in a header file called “geo_topo.h”, which can be downloaded from the publisher's website.
Figure 6.1 shows that a wrapper API is simply a function that wraps some functionalities and provides a higher-level interface. To use the wrapper APIs in the process model, one needs to include the header file containing the APIs. By default, OPNET Modeler will look for header files in its installation path and in model paths.
To save this book to your Kindle, first ensure no-reply@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.