| 30 | The communication between the C++ program and the Java program (Sophie2, except the demos) will be sequence of integers. We chose integers over string because there are too many encodings for strings. Every integer sequence will be in the following format: [[BR]] |
| 31 | <size> <id> ... [[BR]] |
| 32 | <size> and <id> are mandatory and their meanings are : |
| 33 | * size - the length of the integer sequence |
| 34 | * id - command/sequence id |
| 35 | |
| 36 | Example(start command, whose id is 0) : 2 0 |
| 37 | |
| 38 | The communication will be in the following way: |
| 39 | * the Java program sends a command through the standard input of the C++ process |
| 40 | * the C++ program creates a respones on the base of the command |
| 41 | * the C++ program returns the reposne through its standard output |
| 42 | * the Java program receives the respone and acts on the base of it |
| 43 | |
| 44 | This means that the Java program will be blocked until it recieves mething from the standard input of the process so the Java wrapper will be in separate thread. Also the control of the C++ application will be in the Java part - it will run and stop it. |
| 45 | |
| 46 | The flow of communication written above is common for all other wrapers and native applications. This code will reside in classes called Bridges. [[BR]] |
| 47 | There will be some common commands and responses: |
| 48 | * StartCommand |
| 49 | * StopCommand |
| 50 | * OkResponse |
| 51 | * ErrorResponse |
| 52 | |
| 53 | |