Commit c317d15a authored by jhugues's avatar jhugues
Browse files

* Implement Classifier_Match variant of Classifier_Matching_Rule

git-svn-id: 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent bb6dc792
......@@ -63,6 +63,11 @@ package body Ocarina.Analyzer.AADL.Semantics is
use Ocarina.ME_AADL.AADL_Tree.Entities.Properties;
use Ocarina.Processor.Properties;
function Check_Classifier_Matching_Rule
(Source_Type : Node_Id;
Destination_Type : Node_Id)
return Boolean;
function Check_Cycles_In_Component_Implementation
(Node : Node_Id;
Initial_Node : Node_Id := No_Node)
......@@ -189,6 +194,43 @@ package body Ocarina.Analyzer.AADL.Semantics is
Property_Value : Node_Id)
return Boolean;
-- Check_Classifier_Matching_Rule --
function Check_Classifier_Matching_Rule
(Source_Type : Node_Id;
Destination_Type : Node_Id)
return Boolean
-- This function implements a check for the classifier_matching
-- rule
-- For now, we only implement the following:
-- "Classifier_Match:" The source data type and data
-- implementation must be identical to the data type or data
-- implementation of the destination. If the destination
-- classifier is a component type, then any implementation of
-- the source matches. This is the default rule.
if Source_Type = Destination_Type then
-- a) strict equality
return True;
elsif Kind (Source_Type) = K_Component_Implementation
and then Corresponding_Entity
(Component_Type_Identifier (Source_Type)) = Destination_Type
-- b) source is an implementation of the destination
return True;
end if;
return False;
end Check_Classifier_Matching_Rule;
-- Check_Qualified_References --
......@@ -1083,15 +1125,16 @@ package body Ocarina.Analyzer.AADL.Semantics is
when CT_Access_Bus
| CT_Access_Data
| CT_Access_Subprogram =>
if Source_Type = Destination_Type then
Success := True;
Success := Check_Classifier_Matching_Rule
(Source_Type, Destination_Type);
if not Success then
DAE (Loc => Loc (Node),
Node1 => Source (Node),
Message1 => " and ",
Node2 => Destination (Node),
Message2 => " do not have compatible types");
Success := False;
end if;
end case;
......@@ -273,5 +273,5 @@ examples/real/safety/model.aadl
package Sampling
data Sample
Source_Data_Size => 16 Bytes;
end Sample;
data Sample_Set
Source_Data_Size => 1 MByte;
end Sample_Set;
data implementation Sample_Set.impl
Data_Set: data Sample ;
end Sample_Set.impl;
data Dynamic_Sample_Set extends Sample_Set
end Dynamic_Sample_Set;
data implementation Dynamic_Sample_Set.impl extends Sample_Set.impl
Source_Data_Size => 8 Bytes applies to Data_Set;
end Dynamic_Sample_Set.impl;
end Sampling;
package SamplingTasks
with Sampling;
thread Init_Samples
OrigSet : requires data access Sampling::Sample_Set;
SampleSet : requires data access Sampling::Sample_Set;
end Init_Samples;
thread Collect_Samples
Input_Sample : in event data port Sampling::Sample;
SampleSet : requires data access Sampling::Sample_Set;
Filtering_Routine: requires subprogram access Sample_Subprogram;
end Collect_Samples;
thread implementation Collect_Samples.Batch_Update
Source_Name => "InSample" applies to Input_Sample;
end Collect_Samples.Batch_Update;
thread Distribute_Samples
SampleSet : requires data access Sampling::Sample_Set;
UpdatedSamples : out event data port Sampling::Sample;
end Distribute_Samples;
process Sample_Manager
Input_Sample: in event data port Sampling::Sample;
External_Samples: requires data access Sampling::Sample_Set;
Result_Sample: out event data port Sampling::Sample;
end Sample_Manager;
process implementation Sample_Manager.Slow_Update
Samples: data Sampling::Sample_Set;
Init_Samples : thread Init_Samples;
-- the required access is resolved to a subcomponent declaration
Collect_Samples: thread Collect_Samples.Batch_Update;
Distribute: thread Distribute_Samples;
Sample_Filter: subprogram Sample_Subprogram.Simple;
ISSSConn: data access Samples -> Init_Samples.SampleSet;
ISOSConn: data access External_Samples -> Init_Samples.OrigSet;
CSSSConn: data access Samples -> Collect_Samples.SampleSet;
CSISConn: port Input_Sample -> Collect_Samples.Input_Sample;
DSSConn: data access Samples -> Distribute.SampleSet;
DUSConn: port Distribute.UpdatedSamples -> Result_Sample;
CSFRConn: subprogram access Sample_Filter -> Collect_Samples.Filtering_Routine;
end Sample_Manager.Slow_Update;
subprogram Sample_Subprogram
end Sample_Subprogram;
subprogram implementation Sample_Subprogram.Simple
end Sample_Subprogram.Simple;
end SamplingTasks;
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