Commit 22757a71 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Work on observer prototype

parent 2589db29
# this file was written manually.. for now
all: mc
mc: mcsrc/mc.adb mcsrc/properties.adb
mc: observer/my_observer.adb mcsrc/mc.adb mcsrc/properties.adb
ADA_PROJECT_PATH=~/.local/share/gpr:${ADA_PROJECT_PATH} gprbuild -p -P mc
observer/my_observer.adb: observer/observer.pr observer/observer.asn
cd observer && opengeode --toAda observer.pr
# gather dataviews needed to build an observer
observer/observer.asn: ../dataview/dataview-uniq.asn ../build/simulation.asn ../orchestrator/SDL/code/orchestrator_datamodel.asn ../another_function/SDL/code/another_function_datamodel.asn
cat $^ > $@
cd observer && asn1.exe -Ada -typePrefix asn1scc -equal observer.asn
clean:
ADA_PROJECT_PATH=~/.local/share/gpr:${ADA_PROJECT_PATH} gprclean -P mc
......@@ -2,7 +2,7 @@ with "share/gpr/demo_simulator.gpr";
with "asn1_iterators";
project mc is
for source_dirs use ("mcsrc", "../dataview/iterators");
for source_dirs use ("mcsrc", "../dataview/iterators", "observer");
for main use ("mc.adb");
package Compiler is
for Default_Switches ("Ada") use ("-g", "-O2");
......
......@@ -16,8 +16,8 @@ with Gnat.MD5,
adaasn1rtl.encoding;
use Ada.Streams;
procedure mc is
Pulse_Event : asn1SccEvent :=
(Kind => Orchestrator_PRESENT,
Orchestrator =>
......
with iterators_types;
use iterators_types;
with my_observer; use my_observer;
package body Properties is
procedure Check_Queue (Res : out asn1Boolean) is
begin
Res := False;
end Check_Queue;
procedure My_Properties (Id : out Natural; Success : out Boolean) is
begin
Id := 0;
Observe;
Success := (Simulator.State.Orchestrator.State = asn1SccWait
and Simulator.State.Orchestrator.SeqOf = (Length => 4, Data => (4, 4, 4, 4)));
end;
......
with simulator;
with simulation_dataview; use simulation_dataview;
with orchestrator_datamodel; use orchestrator_datamodel;
with adaasn1rtl; use adaasn1rtl;
package Properties is
-- there are continuous signals in the observers, we need check_queue
procedure Check_Queue (Res : out asn1Boolean);
pragma Export (C, Check_Queue, "my_observer_check_queue");
procedure My_Properties (Id : out Natural; Success : out Boolean);
end Properties;
Another-function-Datamodel DEFINITIONS ::=
BEGIN
IMPORTS
T-Null, T-Int, T-SeqOf FROM Iterators-Types
T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean, T-Null-Record FROM TASTE-BasicTypes;
Another-function-States ::= ENUMERATED {two, one}
Another-function-Context ::= SEQUENCE {
state Another-function-States,
init-done BOOLEAN
}
END
Iterators-Types DEFINITIONS ::=
BEGIN
......@@ -47,24 +32,6 @@ T-Null-Record ::= SEQUENCE {}
END
Orchestrator-Datamodel DEFINITIONS ::=
BEGIN
IMPORTS
T-Null, T-Int, T-SeqOf FROM Iterators-Types
T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean, T-Null-Record FROM TASTE-BasicTypes;
Orchestrator-States ::= ENUMERATED {wait, running}
Orchestrator-Context ::= SEQUENCE {
state Orchestrator-States,
init-done BOOLEAN,
t T-Int,
counter T-Int,
seqof T-SeqOf
}
END
Simulation-DataView DEFINITIONS ::=
BEGIN
IMPORTS
......@@ -138,3 +105,33 @@ BEGIN
orchestrator Orchestrator-Context
}
END
Orchestrator-Datamodel DEFINITIONS ::=
BEGIN
IMPORTS
T-Null, T-Int, T-SeqOf FROM Iterators-Types
T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean, T-Null-Record FROM TASTE-BasicTypes;
Orchestrator-States ::= ENUMERATED {wait, running}
Orchestrator-Context ::= SEQUENCE {
state Orchestrator-States,
init-done BOOLEAN,
t T-Int,
counter T-Int,
seqof T-SeqOf
}
ENDAnother-function-Datamodel DEFINITIONS ::=
BEGIN
IMPORTS
T-Null, T-Int, T-SeqOf FROM Iterators-Types
T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean, T-Null-Record FROM TASTE-BasicTypes;
Another-function-States ::= ENUMERATED {two, one}
Another-function-Context ::= SEQUENCE {
state Another-function-States,
init-done BOOLEAN
}
END
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment