Index

Package: Swarm_Structures

Description

package Swarm_Structures is
Jan & Uwe R. Zimmer, Australia, 2013

Packages

Distance_Vectors (new Ada.Containers.Vectors)

package Distance_Vectors is new Vectors (Swarm_Element_Index, Distance_Entries);

Sort_Distances (new Ada.Containers.Vectors.Generic_Sorting)

package Sort_Distances is new Distance_Vectors.Generic_Sorting;

Buffers_Outgoing (new Generic_Realtime_Buffer)

Buffers_Incoming (new Generic_Realtime_Buffer)

Protected_Time (new Generic_Protected)

package Protected_Time is new Generic_Protected (Time, Time_First);

Protected_Rotation (new Generic_Protected)

package Protected_Rotation is new Generic_Protected (Quaternion_Rotation, Zero_Rotation);

Swarm_Vectors (new Ada)

package Swarm_Vectors is new Vectors (Swarm_Element_Index, Swarm_Element_State);

Tasks & Protected

Types

Distance_Entries

type Distance_Entries is
      record
         Index         : Swarm_Element_Index;
         Distance      : Distances;
         Position_Diff : Positions;
         Velocity_Diff : Velocities;
      end record;

Buffer_Size_Outgoing

type Buffer_Size_Outgoing is mod No_Of_Buffered_Outgoing_Messages;

References:

swarm_structures.ads:42:9 (declaration)
swarm_structures.ads:45:85 (reference)

Buffer_Size_Incoming

type Buffer_Size_Incoming is mod No_Of_Buffered_Incoming_Messages;

References:

swarm_structures.ads:43:9 (declaration)
swarm_structures.ads:46:85 (reference)

Globes_Touched_A

type Globes_Touched_A is array (Energy_Globes_Defaults'Range) of Boolean;

References:

swarm_structures.ads:73:9 (declaration)
swarm_structures.ads:75:33 (reference)
swarm_structures.ads:83:24 (reference)

Charge_Info

type Charge_Info is record
      Level          : Vehicle_Charges;            pragma Atomic (Level);
      Charge_Time    : Protected_Time.Monitor_Ptr;
      Charge_No      : Natural;                    pragma Atomic (Charge_No);
      Globes_Touched : Globes_Touched_A := No_Globes_Touched;
   end record;

References:

swarm_structures.ads:79:9 (declaration)
swarm_control.adb:62:45 (reference)
swarm_control.ads:27:52 (reference)
swarm_structures.ads:99:26 (reference)

Neighbours_P

type Neighbours_P       is access all Distance_Vectors.Vector;

References:

swarm_structures.ads:86:9 (declaration)
swarm_structures.ads:100:26 (reference)
swarm_structures.ads:112:104 (reference)

Vehicle_Comms_P

type Vehicle_Comms_P    is access all Vehicle_Comms;

Vehicle_Controls_P

type Vehicle_Controls_P is access all Vehicle_Controls;

Vehicle_Task_P

type Vehicle_Task_P     is access all Vehicle_Task;

References:

swarm_structures.ads:89:9 (declaration)
swarm_structures.ads:103:26 (reference)
swarm_structures.ads:115:104 (reference)

Swarm_Element_State

type Swarm_Element_State is
      record
         Position      : Protected_Point_3D.Monitor_Ptr;
         Rotation      : Protected_Rotation.Monitor_Ptr;
         Velocity      : Protected_Vector_3D.Monitor_Ptr;
         Acceleration  : Protected_Vector_3D.Monitor_Ptr;
         Charge        : Charge_Info;
         Neighbours    : Neighbours_P;
         Controls      : Vehicle_Controls_P;
         Comms         : Vehicle_Comms_P;
         Process       : Vehicle_Task_P;
         Process_abort : Barrier_Ptr;
         Process_Id    : Task_Id;
         Vehicle_Id    : Positive;
         Last_Update   : Time;
      end record;

Constants & Global variables

No_Of_Buffered_Incoming_Messages (Positive)

No_Of_Buffered_Incoming_Messages : constant Positive := 10;

References:

swarm_structures.ads:23:4 (declaration)
swarm_structures.ads:43:37 (reference)

No_Of_Buffered_Outgoing_Messages (Positive)

No_Of_Buffered_Outgoing_Messages : constant Positive := 2;

References:

swarm_structures.ads:24:4 (declaration)
swarm_structures.ads:42:37 (reference)

No_Globes_Touched (Globes_Touched_A)

No_Globes_Touched : constant Globes_Touched_A := (others => False);

Subprograms & Entries

Vehicle_Comms. Has_Incoming_Messages

function  Has_Incoming_Messages return Boolean;

Vehicle_Comms. Has_Outgoing_Messages

function  Has_Outgoing_Messages return Boolean;

Vehicle_Controls. Steering_Direction (private)

Steering_Direction: Vector_3D  := Zero_Vector_3D;

References:

Vehicle_Controls. Throttle (private)

References:

"<"

function "<" 
(L, R: Distance_Entries) return Boolean;

References:

swarm_structures.ads:35:14 (declaration)
swarm_structures.adb:83:14 (body)

Free_Neighbours

procedure Free_Neighbours is new Unchecked_Deallocation 
(Object => Distance_Vectors.Vector, Name => Neighbours_P);

References:

swarm_structures.ads:112:14 (declaration)
swarm_control.adb:134:16 (call)

Free_Controls

procedure Free_Controls   is new Unchecked_Deallocation 
(Object => Vehicle_Controls, Name => Vehicle_Controls_P);

References:

swarm_structures.ads:113:14 (declaration)
swarm_control.adb:136:16 (call)

Free_Comms

procedure Free_Comms      is new Unchecked_Deallocation 
(Object => Vehicle_Comms, Name => Vehicle_Comms_P);

References:

swarm_structures.ads:114:14 (declaration)
swarm_control.adb:135:16 (call)

Free_Process

procedure Free_Process    is new Unchecked_Deallocation 
(Object => Vehicle_Task, Name => Vehicle_Task_P);

References:

swarm_structures.ads:115:14 (declaration)
swarm_control.adb:132:16 (call)