comp.lang.ada
 help / color / mirror / Atom feed
From: "Björn Lundin" <b.f.lundin@gmail.com>
Subject: Ada.Containers warnings with gnat
Date: Sat, 15 Nov 2014 15:35:41 +0100
Date: 2014-11-15T15:35:41+01:00	[thread overview]
Message-ID: <m47o94$cnv$1@dont-email.me> (raw)


Hi!
I'm using a db to keep data in, that I retrieve and
put into ordered and hashed maps from Ada.Containers.

I do this to
 * learn to use Ada standard containers, instead of home-rolled lists
 * to simulate outcome of different parameters into a business modell

Reading from db takes about 1 hour, with i5/ssd/12 gb ram
needless to say, I'd like this to go faster.

So, I rewrote the simulator to use the mentioned containers.
I then run it once, and save the maps into (largish ) files
instead via streams and 'write/'read.

fantastic performance.

The simulator was in a single file before -> no problem.
So I then refactored and created a storage package and suddenly I get
warnings like

 /home/bnl/bnlbot/botstart/bot-1-0/source/ada/local/utils/simulation_storage.ads
    17.   package Sample_Map_Pack is new Ada.Containers.Ordered_Maps
          |
        >>> warning: in instantiation at a-coorma.ads:266
        >>> warning: no entities of package "Ada.Streams" are referenced

    23.   package Marketid_Map_Pack is new Ada.Containers.Hashed_Maps
          |
        >>> warning: in instantiation at a-cohama.ads:342
        >>> warning: no entities of package "Ada.Streams" are referenced

    30.   package Winner_Map_Pack is new Ada.Containers.Hashed_Maps
          |
        >>> warning: in instantiation at a-cohama.ads:342
        >>> warning: no entities of package "Ada.Streams" are referenced

    37.   package Win_Place_Map_Pack is new Ada.Containers.Hashed_Maps
          |
        >>> warning: in instantiation at a-cohama.ads:342
        >>> warning: no entities of package "Ada.Streams" are referenced



what do the mean ?
The body of the package uses streams like

    Log("read Marketid_Map from file ");
    declare
     File   : Ada.Streams.Stream_IO.File_Type;
     Stream : Ada.Streams.Stream_IO.Stream_Access;
     Filename : String := Map_files(Marketid).Filename.Fix_String;
    begin
      Ada.Streams.Stream_IO.Open
          (File => File,
           Name => Filename,
           Mode => Ada.Streams.Stream_IO.In_File);
      Stream := Ada.Streams.Stream_IO.Stream (File);
      Marketid_Map_Pack.Map'Read(Stream, Marketid_Map);
      Ada.Streams.Stream_IO.Close(File);
      Log("Marketid_Map read from file " & Filename);
    end;




package spec is

---------------------------
with Ada;
with Ada.Strings;
with Ada.Strings.Hash;

with Ada.Containers;
with Ada.Containers.Hashed_Maps;
with Ada.Containers.Ordered_Maps;

with Calendar2;
with Bot_Types; use Bot_Types;
with Table_Apricesfinish;
with Table_Arunners;

package Simulation_Storage is

  package Sample_Map_Pack is new Ada.Containers.Ordered_Maps
        (Key_Type     => Calendar2.Time_Type,
         Element_Type => Table_Apricesfinish.Apricesfinish_List_Pack2.List,
         "<"          => Calendar2."<",
         "="          => Table_Apricesfinish.Apricesfinish_List_Pack2."=");

  package Marketid_Map_Pack is new Ada.Containers.Hashed_Maps
        (Market_Id_Type,
         Sample_Map_Pack.Map,
         Ada.Strings.Hash,
         "=",
         Sample_Map_Pack."=");

  package Winner_Map_Pack is new Ada.Containers.Hashed_Maps
        (Market_Id_Type,
         Table_Arunners.Arunners_List_Pack2.List,
         Ada.Strings.Hash,
         "=",
         Table_Arunners.Arunners_List_Pack2."=");

  package Win_Place_Map_Pack is new Ada.Containers.Hashed_Maps
        (Market_Id_Type,
         Market_Id_Type,
         Ada.Strings.Hash,
         "=",
         "=");


  procedure Create_Files_From_Database;
  procedure Fill_Maps(Marketid_Map  : out Marketid_Map_Pack.Map;
                      Winner_Map    : out Winner_Map_Pack.Map;
                      Win_Place_Map : out Win_Place_Map_Pack.Map) ;


end Simulation_Storage;



--
Björn

             reply	other threads:[~2014-11-15 14:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15 14:35 Björn Lundin [this message]
2014-11-15 15:15 ` Ada.Containers warnings with gnat Björn Lundin
2014-11-15 18:01 ` Jeffrey Carter
2014-11-16 10:05   ` Björn Lundin
2014-11-16 11:37     ` Björn Lundin
2014-11-16 17:32       ` Jeffrey Carter
2014-11-17  8:13         ` Björn Lundin
2014-11-17 16:39           ` Anh Vo
2014-11-17 17:27           ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox