Ø CASE France Ø Services & consulting Ø Events & Press Ø Information request Ø Contact Ø Search

 

"Producer - Consumer" application note

Automatic generation of the algorithms of a couple of concurrent States/Transitions diagrams with mutual access.

 Application note based on the work of M. Ankur Agarwal from
Computer Science and Engineering Florida Atlantic University
- Boca Raton - FL-33486
  USA

Generated with Envision
UML C++

Forewords

This application note shows how to generate automatically from UML diagrams, a Windows application with two states concurrent multi threads (diagrams states / transitions UML) with mutual access to variables.
This application note includes a demonstration on the use of threads with Windows. The application was created with the code generator-UML C + + 5.0 diagrams from UML 1.4 (see diagram below). The source code obtained was compiled with the Borland C + + 4.5 and Windows OWL library.
To study the source files and run the code, download (see below) and decompress the file cppPC.zip in a temporary directory and then double click on producer.exe. Click the button to start the demonstration. Observe the execution of threads and wait until they stop before closing the window. If you have problems, contact:
mailto:jean-claude.jacquiot@case-france.com

Generation parameters

Conclusion

  • The execution shows faithfully respect of the assumptions set out in the UML diagrams
  • The generated code was compiled without error and normally runs on Windows XP or 2K.
  • The  thread Producer algorithm can access data from "Consumer" and vice versa. Compliance with the requirements
  • No difficulty was found during generation, which takes less than one second
  • This application note's theory, clearly demonstrates the feasibility of this technology which could be applied to a wide variety of needs:
    • IHM
    • Automate and Controller
    • Web
    • Prototyping and Simulation ...

Components and logical views


Click on images to enlarger

A physical design was chosen based on the components view. This implies the generation of three definition files (cpp) associated with three declaration files (. H). All classes are grouped in a single cpp file with its header file associated

States-Transitions diagrams

Thread 1 classes Producer  - Thread 2 classes Consumer

Click on images to enlarger

Classes "Producer and Consumer" each contain a  states / transitions diagram involved in operations update () and update () respectively.

Files generated structure

  • Folder Produce0 has been generated and includes:
    • Borland2.cpp et .h
    • Produce1.cpp et .h
    • Provide3. cpp et .h
  • Produce0.log Generation log file
  • Attached to this presentation, the source files C + +, the generation report, the executable file "Producer.exe" and the Borland DLLs needed to integrated the Windows user interface

Code generated

  • A directory including three definition files (. Cpp) with associated declarations files  (. H)  have been generated in accordance with the  components view.
     
  • A log file "log" containing the  generation's steps and details on warnings has also been generated

Information leveraging solutions
tailored to each enterprise and its projects.
In France since 1989

Pages trouvées

 

CASE France copyright - 05/01/2016