You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-sources/art-lang/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -681,7 +681,7 @@ It's possible (but unusual) to import a capsule instance into more than one plug
681
681
Plugin parts by default have multiplicity 0..1.
682
682
683
683
!!! example
684
-
You can find a sample application that uses a plugin part [here]({$vars.github.repo$}/tree/main/art-comp-test/art-samples/MoreOrLess).
684
+
You can find a sample application that uses a plugin part [here]({$vars.github.repo$}/tree/main/art-samples/MoreOrLess).
685
685
686
686
In the example below the capsule `C` contains a few parts of different kinds and multiplicities. Note that you may declare multiple parts on the same line if they are of the same kind (both `c` and `d` below are optional parts).
Copy file name to clipboardExpand all lines: docs-sources/samples.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,40 +2,40 @@ The {$product.name$} [Git repository](https://github.com/secure-dev-ops/code-rea
2
2
3
3
The samples are listed here in an order that may be appropriate when learning to use {$product.name$}, starting with the simplest examples and proceeding with more advanced ones. For each sample, Art language constructs and TargetRTS APIs that it uses, are listed, so you can find the sample that shows what you currently want to learn more about. To keep these lists short, we only list what is new in the sample compared to previously mentioned samples.
The most classical of samples for learning a new programming language. This version prints "Hello World!" on the console after a short delay, implemented by means of a timer. Watch [this video](https://youtu.be/TGpCqA63MxQ) to see how the sample was created.
Two capsules, `Pinger` and `Ponger`, send the events `ping` and `pong` back and forth. The `ping` event has an integer parameter which gets incremented by one for each ping-pong round. The sample prints messages to stdout both using standard C++ code and with the [Log service](target-rts/logging.md) of the TargetRTS.
14
14
15
15
**Art:** fixed [part](art-lang/index.md#part), [connector](art-lang/index.md#connector), service and behavior [port](art-lang/index.md#port), [protocol and event](art-lang/index.md#protocol-and-event), log [port](art-lang/index.md#port)
While the standard [PingPong sample](#pingpong) runs forever, this version lets the user enter the number of ping-pong rounds at start-up. When the rounds are completed, information about how long it took is printed.
This application computes a value of Pi using [Madhava](https://en.wikipedia.org/wiki/Madhava_of_Sangamagrama)'s formula, which consists of a series of additions and multiplications. The result is obtained as a collaboration of three capsules, each with a simple state machine, which coordinate their work by sending events with parameters.
28
28
29
29
**Art:**[composite state](art-lang/index.md#hierarchical-state-machine) (hierarchical state machine)
This sample implements a classical traffic light that switches between red, yellow and green based on a periodic timer. The actual traffic light is implemented by means of a class `Light` with a state machine. An instance of that class is managed by the `TrafficLight` capsule. The `Light` class uses an interface class `ILogger`, which the `TrafficLight` capsules implements, for logging messages when the traffic light switches state. It delegates the work of logging to a separate Logger capsule. Note that only the `ILogger` interface is provided to the `Light` object, instead of the whole `TrafficLight` capsule which has an unnecessary big API for the needs of the `Light`.
33
33
34
34
**Art:**[class with state machine](art-lang/index.md#class-with-state-machine)
Two different implementations of the classical [Dining Philosophers problem](https://en.wikipedia.org/wiki/Dining_philosophers_problem). The applications implement 3 different strategies (represented by an enum) for how to let all philosophers eat and think without causing a deadlock.
40
40
41
41
Version 1 of the sample uses fixed parts which are incarnated statically. The strategy to use is hard-coded into the application.
@@ -46,61 +46,61 @@ Version 2 of the sample uses optional parts which are incarnated dynamically, an
This sample shows how to use [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) to customize capsule incarnation. Build variants are used for configuring how to customize the dependency injection, which will influence on how the application behaves.
This application has a user interface developed with [Qt](https://www.qt.io/) which controls a realtime application that implements the logic of a traffic light that works together with a pedestrian light. Note that you need to have [Qt](https://www.qt.io/) installed to build and run this sample.
65
65
66
66
**Art:**[composite state with entry- and exitpoint](art-lang/index.md#hierarchical-state-machine), [external port](target-rts/integrate-with-external-code.md#external-port), [notification port](art-lang/index.md#notification-port), [internal transition](art-lang/index.md#internal-transition)
This sample is similar to [QtTrafficLight](#qttrafficlight) but the user interface is instead implemented as a Node.js web application. The application uses the [TCPServer library](https://github.com/secure-dev-ops/code-realtime/tree/main/art-samples/TcpServer) and the Node.js application therefore can use the [rt-tcp-utils](https://www.npmjs.com/package/rt-tcp-utils) library for communicating with it. Communication between the Node.js application and the web page uses [socket.io](https://socket.io/).
This sample is similar to [QtTrafficLight](#qttrafficlight) but the user interface is instead implemented as a Node.js web application. The application uses the [TCPServer library]({$vars.github.repo$}/tree/main/art-samples/TcpServer) and the Node.js application therefore can use the [rt-tcp-utils](https://www.npmjs.com/package/rt-tcp-utils) library for communicating with it. Communication between the Node.js application and the web page uses [socket.io](https://socket.io/).
**TargetRTS:** Extracting command-line arguments by means of [RTMain](targetrts-api/class_r_t_main.html)::argCount() and [RTMain](targetrts-api/class_r_t_main.html)::argStrings()
This sample uses the [TCPServer library](https://github.com/secure-dev-ops/code-realtime/tree/main/art-samples/TcpServer) which makes it possible to communicate with the application from the "outside" by means of making TCP requests. Two sample client applications for making such requests are included:
This sample uses the [TCPServer library]({$vars.github.repo$}/tree/main/art-samples/TcpServer) which makes it possible to communicate with the application from the "outside" by means of making TCP requests. Two sample client applications for making such requests are included:
This sample uses the [TCPServer library](https://github.com/secure-dev-ops/code-realtime/tree/main/art-samples/TcpServer) for implementing a distributed application. Two instances of the PingPong application are launched and the TCPServer library ensures that the events that are sent out by one application, are serialized to JSON, sent over TCP and received by the other application. The applications are connected by means of command-line arguments that specify the application's own port, and the port of the other application.
This sample uses the [TCPServer library]({$vars.github.repo$}/tree/main/art-samples/TcpServer) for implementing a distributed application. Two instances of the PingPong application are launched and the TCPServer library ensures that the events that are sent out by one application, are serialized to JSON, sent over TCP and received by the other application. The applications are connected by means of command-line arguments that specify the application's own port, and the port of the other application.
91
91
92
92
To start the communication, a special command-line argument `-injectFirstPing` is supported. The implementation of this argument uses APIs of [RTMessage](targetrts-api/class_r_t_message.html) for programmatically injecting an event on a port.
93
93
94
94
**Art:**[timer data](target-rts/timers.md#timer-data), [symmetric events](art-lang/index.md#protocol-and-event), [calling code from an inherited transition](art-lang/index.md#calling-code-from-an-inherited-transition)
This sample is similar to [DistributedPingPong](#distributedpingpong), and also uses the [TCPServer library](https://github.com/secure-dev-ops/code-realtime/tree/main/art-samples/TcpServer). But instead of just connecting two applications, here multiple applications can be connected in a ring structure. The applications exchange a `token` event which has a string (`RTString`) data parameter.
This sample is similar to [DistributedPingPong](#distributedpingpong), and also uses the [TCPServer library]({$vars.github.repo$}/tree/main/art-samples/TcpServer). But instead of just connecting two applications, here multiple applications can be connected in a ring structure. The applications exchange a `token` event which has a string (`RTString`) data parameter.
This sample uses the [gRPCServer library](https://github.com/secure-dev-ops/code-realtime/tree/main/art-samples/gRPCServer) which allows a realtime application to communicate using [gRPC](https://grpc.io/) with other applications. The sample also shows how to mix Art files with [hand-written C++ source files](building/build-cpp-files.md) and build them into a single application.
This sample uses the [gRPCServer library]({$vars.github.repo$}/tree/main/art-samples/gRPCServer) which allows a realtime application to communicate using [gRPC](https://grpc.io/) with other applications. The sample also shows how to mix Art files with [hand-written C++ source files](building/build-cpp-files.md) and build them into a single application.
0 commit comments