The Control Software Based on Windows
Gao Weizheng, Xinmin Huang · 1998
The C++ language is used as a development tool in the kernel of our software. C++ provides a new object-oriented programming method. It deals with everything as whole subject, and abstracts into a data type, named as class. The characteristics that belong to the object are described. It gives some functions that can be done by this class of object, and some properties that inherit from its parents or are inherited by its children. The abstracted mankind, for example, has some characteristics, such as name, height, weight, age and so on, and can eat, walk, sleep and work.. If we define a class named as Mankind in our programs and realize all functions that should be done by a man, when we attach some characteristics to this class we generate a man in our software. Everything in our programs can be generated by defining a class. If we can look into a object, abstract it as a class, and this class is properly written, a object of this class can be easy generated . In the OOP view, the programs will be assembled by many classes , just like a machine is assembled by many components. We see that the object-oriented program has many advantages. First, the analysis and implementation of a program is easier. The analysis is important for designing of a large program. Second, the program debugging is easy, because the program is assembled by classes. We can look for the bugs in each class, so that much time can be saved in the program debugging period. Third, the program's code can be reused since the code is used by all the objects of this class, and also by objects of a relative class that is derived from this class. The object oriented programming method has been introduced into our control software designing. The accelerator is composed of many components. The components that will affect beam quality are our control objects. We abstract those components into classes. Take the power supply as example, we have defined a class that manages all power supplies. Many power supplies are used in accelerator most systems. A power supply has some attributes, such as the input current value, the maximum value that can be bear, the status and the site in an accelerator (we always label it by its location). The power supply can change its current value according to the command given by the operator, report its current value to operator, or report its status to an operator. So we can define a PowerClass as follows (in C++ language):