with Ada.Streams;
with DDS.Logger.LoggerDevice;
private with GNAT.Semaphores;
private with Ada.Unchecked_Deallocation;
private with DDS.String_Vectors;
package DDS.Logger.Bufferd_Logger is
type Ref is new DDS.Logger.LoggerDevice.Ref with private;
overriding procedure Write (Self : not null access Ref;
Text : Standard.String;
Level : DDS.LogVerbosity);
overriding procedure Close (Self : not null access Ref);
not overriding procedure Reset (Self : not null access Ref);
not overriding procedure Save (Self : not null access Ref; To : access Ada.Streams.Root_Stream_Type'Class);
not overriding procedure Save (Self : not null access Ref; To : Standard.String);
not overriding procedure Dump (Self : not null access Ref);
not overriding function Contins (Self : not null access Ref; Item : Standard.String) return Boolean;
not overriding function Image (Self : not null access Ref) return Standard.String;
private
type Vector_Access is access all String_Vectors.Vector;
type Semaphore_Access is access all GNAT.Semaphores.Binary_Semaphore;
type Ref is new DDS.Logger.LoggerDevice.Ref with record
Buffer : Vector_Access := new String_Vectors.Vector;
Lock : Semaphore_Access :=
new GNAT.Semaphores.Binary_Semaphore
(True, GNAT.Semaphores.Default_Ceiling);
end record;
procedure Finalize (Self : in out Ref);
procedure Free is new Ada.Unchecked_Deallocation (String_Vectors.Vector, Vector_Access);
procedure Free is new Ada.Unchecked_Deallocation (GNAT.Semaphores.Binary_Semaphore, Semaphore_Access);
type Key (Lock : not null access GNAT.Semaphores.Binary_Semaphore) is new
Ada.Finalization.Limited_Controlled with null record with
Unreferenced_Objects => True;
procedure Initialize (Object : in out Key);
procedure Finalize (Object : in out Key);
end DDS.Logger.Bufferd_Logger;