DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦97bb50165⟧ TextFile

    Length: 2816 (0xb00)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Text_Io;

package body Sensor is

    package Time_Io is new Text_Io.Fixed_Io (Num => Sensor.Time);

    function Value (A_Sensor : Sensor.Object) return Integer is
    begin
        return A_Sensor.Current_Value;
    end Value;


    function Duration (A_Sensor : Sensor.Object) return Time is
    begin
        case A_Sensor.Class is
            when Normal =>
                null;
            when With_Speed | Calibrating =>
                return A_Sensor.Action_Duration;
        end case;  
    end Duration;


    procedure Calibrate (A_Sensor : in out Sensor.Object;
                         Max : Integer := 100;
                         Min : Integer := 0;
                         Gain : Integer := 1) is
    begin
        case A_Sensor.Class is
            when Normal | With_Speed =>
                null;
            when Calibrating =>
                A_Sensor.Max := Max;
                A_Sensor.Min := Min;
                A_Sensor.Gain := Gain;
        end case;
    end Calibrate;


    function Image (A_Time : Time) return String is
        Tempo_String : String (1 .. 255);
    begin  
        Time_Io.Put (Tempo_String, A_Time);
        return Tempo_String;  
    end Image;


    procedure Print (A_Sensor : Sensor.Object) is  
    begin
        case A_Sensor.Class is
            when Normal =>
                Text_Io.Put_Line ("The current value = " &
                                  Integer'Image (A_Sensor.Current_Value));
            when With_Speed | Calibrating =>
                Text_Io.Put_Line ("The action duration = " &
                                  Image (A_Sensor.Action_Duration));
                case A_Sensor.Class is
                    when Normal | With_Speed =>
                        null;
                    when Calibrating =>
                        Text_Io.Put_Line ("The Max value = " &
                                          Integer'Image (A_Sensor.Max));  
                        Text_Io.Put_Line ("The Min value = " &
                                          Integer'Image (A_Sensor.Min));  
                        Text_Io.Put_Line ("The Gain value = " &
                                          Integer'Image (A_Sensor.Gain));  
                end case;

        end case;
    end Print;


    procedure Set (A_Sensor : in out Sensor.Object; The_Value : Integer) is
    begin
        A_Sensor.Current_Value := The_Value;
    end Set;


    procedure Set (A_Sensor : in out Sensor.Object;
                   The_Value : Integer;
                   The_Time : Time) is
    begin
        Set (A_Sensor, The_Value);
        case A_Sensor.Class is
            when Normal =>
                null;
            when With_Speed | Calibrating =>
                A_Sensor.Action_Duration := The_Time;
        end case;
    end Set;

end Sensor;