--- /dev/null
+separate(Problem_Generator)
+
+package body Titration_Curve_Suite is
+
+ -- BEGIN: Inherited functions
+ function Create return access Titration_Curve_Problem is
+ begin
+ return new Titration_Curve_Problem;
+ end Create;
+
+ function Check_Answer(Problem: in out Titration_Curve_Problem; Answer: in Answer_Info.Map;
+ Message: out UB_Text) return Answer_RetCode is
+ begin
+ return No_Answer;
+ end Check_Answer;
+
+ function Get_Assignment(Problem: in out Titration_Curve_Problem; Assignment: in out Assignment_Info.Map) return RetCode is
+ begin
+ return E_INVAL;
+ end Get_Assignment;
+
+ function Get_Parameters(Problem: in out Titration_Curve_Problem; Parameters: out Parameters_Info.Map) return RetCode is
+ begin
+ return E_INVAL;
+ end Get_Parameters;
+
+ procedure New_Problem(Problem: in out Titration_Curve_Problem) is
+ begin
+ null;
+ end New_problem;
+
+ function Set_Parameters(Problem: in out Titration_Curve_Problem; Parameters: in Parameters_Info.Map) return RetCode is
+ begin
+ return E_INVAL;
+ end Set_Parameters;
+
+end Titration_Curve_Suite;
end if;
end Finalize;
end Auto_Lock;
-
+
function Get_Problem(P_Type: in Problem_Type) return access Chem_Problem'Class is
begin
case P_Type is
return Acidobazic_Suite.Create;
when Solubility =>
return Solubility_Suite.Create;
+ when Titration_Curve =>
+ return Titration_Curve_Suite.Create;
end case;
end Get_Problem;
package body Acidobazic_Suite is separate;
package body Solubility_Suite is separate;
+ package body Titration_Curve_Suite is separate;
end Problem_Generator;
Ks_MW: SS_Float; -- Molar mass of the sample
Ks_V: SS_Float; -- Sample volume in dm3
when C_FROM_KS_DIFFERENT_IONS | C_FROM_KS_SHARED_ION =>
- C_EC: SS_Float; -- Concentration of the other electrolyte in the solution
+ C_EC: SS_Float; -- Concentration of the other electrolyte in the solution
C_Ks: SS_Float; -- Ks constant
end case;
end record;
end Solubility_Suite;
+ package Titration_Curve_Suite is
+ use Problem_Generator_Syswides.Titration_Curve_Suite;
+
+ type Titration_Curve_Problem is new Problem_Generator.Chem_Problem with private;
+ -- Constructor
+ function Create return access Titration_Curve_Problem;
+ -- Inherited
+ function Check_Answer(Problem: in out Titration_Curve_Problem; Answer: in Answer_Info.Map; Message: out UB_Text) return Answer_RetCode;
+ function Get_Assignment(Problem: in out Titration_Curve_Problem; Assignment: in out Assignment_Info.Map) return RetCode;
+ function Get_Parameters(Problem: in out Titration_Curve_Problem; Parameters: out Parameters_Info.Map) return RetCode;
+ procedure New_Problem(Problem: in out Titration_Curve_Problem);
+ function Set_Parameters(Problem: in out Titration_Curve_Problem; Parameters: in Parameters_Info.Map) return RetCode;
+
+ private
+ type T_Float is digits 15;
+
+ type Titration_Curve_Problem is new Problem_Generator.Chem_Problem with null record;
+
+ end Titration_Curve_Suite;
+
+
end Problem_Generator;
package Problem_Generator_Syswides is
type Answer_RetCode is (Invalid_Answer, No_Answer, Correct_Answer, Wrong_Answer, Malformed_Answer);
- type Problem_Type is (Acidobazic, Solubility);
+ type Problem_Type is (Acidobazic, Solubility, Titration_Curve);
package Answer_Info is new Ada.Containers.Indefinite_Ordered_Maps(String, String);
package Assignment_Info is new Ada.Containers.Indefinite_Ordered_Maps(String, String);
package Parameters_Info is new Ada.Containers.Indefinite_Ordered_Maps(String, String);
end Solubility_Suite;
+ package Titration_Curve_Suite is
+ PROBLEM_NAME_READABLE: constant String := "Titrační křivka";
+ end Titration_Curve_Suite;
+
end Problem_Generator_Syswides;
P_Cat := Problem_Manager.Acidobazic;
elsif Raw_P_Cat = Problem_Manager.Problem_Category'Image(Problem_Manager.Solubility) then
P_Cat := Problem_Manager.Solubility;
+ elsif Raw_P_Cat = Problem_Manager.Problem_Category'Image(Problem_Manager.Titration_Curve) then
+ P_Cat := Problem_Manager.Titration_Curve;
else
return E_INVAL;
end if;
Problem := Problem_Generator.Get_Problem(Problem_Generator_Syswides.Acidobazic);
when Solubility =>
Problem := Problem_Generator.Get_Problem(Problem_Generator_Syswides.Solubility);
+ when Titration_Curve =>
+ Problem := Problem_Generator.Get_Problem(Problem_Generator_Syswides.Titration_Curve);
when others =>
return E_INVAL;
end case;
procedure Free_Session_Data_Internal is new Ada.Unchecked_Deallocation(Object => User_Session_Data, Name => User_Session_All_Access);
begin
Free_Session_Data_Internal(Data);
- end Free_Session_Data;
-
+ end Free_Session_Data;
+
function Get_Problem(UID: in Unique_ID; Pr_ID: in Problem_ID) return Stored_Problem_All_Access is
use Problem_Storage;
use Session_Keeping;
-
+
USD: User_Session_All_Access;
S: Stored_Problem_All_Access;
begin
use Global_Types;
package Problem_Manager is
- type Problem_Category is (Invalid, Acidobazic, Solubility);
+ type Problem_Category is (Invalid, Acidobazic, Solubility, Titration_Curve);
function Display_Checked_Answer(UID: in Unique_ID; Answer: in Problem_Generator_Syswides.Answer_Info.Map; HTML: out HTML_Code;
Pr_ID: in Problem_ID) return RetCode;
ERRMSG_GET_ASSIGNMENT: constant String := "Unable to get assignment";
ERRMSG_GET_PARAMETERS: constant String := "Unable to get problem parameters";
ERRMSG_UNHANDLED_EXCEPTION: constant String := "Unhandled exception occured";
-
+
package Session_Keeping is new Ada.Containers.Ordered_Maps(Key_Type => Unique_ID, Element_Type => User_Session_All_Access);
protected Active_Sessions is