17 Programming in PDP++

This chapter contains some useful information for those who want to add new functionality to the PDP++ software by compiling their own executable. By creating new subclasses of existing classes, and using these new classes in your simulations, it should be possible to make PDP++ do exactly what you want it to.

Before taking this step, you should be reasonably comfortable with the CSS language and using it to access objects in the simulator. Further, you will need to know (or learn about) C++ in a bit more detail than is covered in the CSS section of this manual. There are a number of good books on this subject available in most bookstores.

This chapter describes how to set up the makefiles in your own directory where you will compile your executable. It then describes various coding conventions and extensions to the basic C++ language that we have added to facilitate programming in PDP++. We have established a standard way of dealing with creating, copying, and deleting objects. In addition, each object has special functions that allow groups to manage them. All of these "coding conventions" are described in this chapter.

We have developed a run-time-type-information (RTTI) system called TypeAccess, which provides type information about most classes at run-time. This can be used to determine what kind of unit a Unit* object really is, for example (i.e., is it a BpUnit or a MyWackyBpUnit?).

The TypeAccess system requires a more complicated than normal set of makefiles. Fortunately, it is reasonably straightforward to use the makefiles we have developed, so you won't have to deal with much of this complexity.

Most of the graphical interface (i.e., edit dialogs, menus, etc) is generated automatically from the information provided by TypeAccess. The same is true for the way you can transparently access hard-coded types and objects through CSS. Thus, you don't need to do anything special to be able to use your newly defined classes exactly in the way that you use the ones that come with the software.

There are some special keywords that you can put in the comments for your classes and class members and methods called "comment directives". These comment directives allow you to control various aspects of how the GUI and CSS treat your objects. These comment directives are described in this chapter.