summaryrefslogtreecommitdiff
path: root/src/candidates-containers.ads
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-02-10 18:41:36 +1100
committerJed Barber <jjbarber@y7mail.com>2017-02-10 18:41:36 +1100
commit60b2207a469a5a1e7a7e5619a8eb1b01c67f314a (patch)
treec928299d78242f2b36798e8c1802914552626352 /src/candidates-containers.ads
parent964a28e91593c4bf1e1c132536828d87f8d12c84 (diff)
Preference data reads into Bundles properly, with packed memory and a few fixed bugs
Diffstat (limited to 'src/candidates-containers.ads')
-rw-r--r--src/candidates-containers.ads71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/candidates-containers.ads b/src/candidates-containers.ads
new file mode 100644
index 0000000..60fe4cb
--- /dev/null
+++ b/src/candidates-containers.ads
@@ -0,0 +1,71 @@
+
+
+with Ada.Containers.Ordered_Maps;
+with Ada.Containers.Ordered_Sets;
+
+
+package Candidates.Containers is
+
+
+ package Candidate_Maps is new Ada.Containers.Ordered_Maps
+ (Key_Type => CandidateID,
+ Element_Type => Candidate);
+
+
+ subtype Candidate_Map is Candidate_Maps.Map;
+
+
+ procedure Read_Candidates
+ (Filename : in String;
+ State : in State_Name;
+ Candidate_Data : out Candidate_Map);
+
+
+
+
+ package CandidateID_Maps is new Ada.Containers.Ordered_Maps
+ (Key_Type => Positive,
+ Element_Type => CandidateID);
+ use type CandidateID_Maps.Map;
+
+
+ package CandidateID_Map_Maps is new Ada.Containers.Ordered_Maps
+ (Key_Type => Positive,
+ Element_Type => CandidateID_Maps.Map);
+
+
+ -- possibly put some aspects here to ensure the types are as expected?
+ subtype Above_Line_Ballot is CandidateID_Map_Maps.Map;
+ subtype Below_Line_Ballot is CandidateID_Maps.Map;
+
+
+ procedure Generate_Ballots
+ (Candidate_Data : in Candidate_Map;
+ Above_Ballot : out Above_Line_Ballot;
+ Below_Ballot : out Below_Line_Ballot);
+
+
+ -- debugging function
+ function To_String
+ (Above_Ballot : in Above_Line_Ballot)
+ return String;
+
+
+ -- debugging function
+ function To_String
+ (Below_Ballot : in Below_Line_Ballot)
+ return String;
+
+
+
+
+ package CandidateID_Sets is new Ada.Containers.Ordered_Sets
+ (Element_Type => CandidateID);
+
+
+ subtype CandidateID_Set is CandidateID_Sets.Set;
+
+
+end Candidates.Containers;
+
+