1. -- 
  2. --  Copyright (c) 2008, 
  3. --  Reto Buerki, Adrian-Ken Rueegsegger 
  4. --  secunet SwissIT AG 
  5. -- 
  6. --  This file is part of Alog. 
  7. -- 
  8. --  Alog is free software; you can redistribute it and/or modify 
  9. --  it under the terms of the GNU Lesser General Public License as published 
  10. --  by the Free Software Foundation; either version 2.1 of the License, or 
  11. --  (at your option) any later version. 
  12. -- 
  13. --  Alog is distributed in the hope that it will be useful, 
  14. --  but WITHOUT ANY WARRANTY; without even the implied warranty of 
  15. --  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
  16. --  GNU Lesser General Public License for more details. 
  17. -- 
  18. --  You should have received a copy of the GNU Lesser General Public License 
  19. --  along with Alog; if not, write to the Free Software 
  20. --  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 
  21. --  MA  02110-1301  USA 
  22. -- 
  23.  
  24. with Ada.Strings.Unbounded; 
  25.  
  26. --  Abstract package Transforms. Provides methods used by all Alog transforms. 
  27. package Alog.Transforms is 
  28.  
  29.    use Ada.Strings.Unbounded; 
  30.  
  31.    type Instance is abstract tagged limited private; 
  32.    --  Abstract type transform instance. All tranforms in the Alog framework 
  33.    --  must implement this type. 
  34.  
  35.    subtype Class is Instance'Class; 
  36.  
  37.    type Handle is access Class; 
  38.  
  39.    function "=" 
  40.      (Left  : Handle; 
  41.       Right : Handle) 
  42.       return Boolean; 
  43.    --  Equal function. 
  44.  
  45.    procedure Set_Name 
  46.      (Transform : in out Class; 
  47.       Name      :        String); 
  48.    --  Set transform name. 
  49.  
  50.    function Get_Name (Transform : Class) return String; 
  51.    --  Get transform name. 
  52.  
  53.    function Transform_Message 
  54.      (Transform : Instance; 
  55.       Level     : Log_Level; 
  56.       Msg       : String) 
  57.       return String is abstract; 
  58.    --  Transform message with specified log level. 
  59.  
  60.    procedure Setup (Transform : in out Instance) is null; 
  61.    --  Each transform must provide a Setup-procedure. These procedures are 
  62.    --  called by logger instances when attaching Transforms. All needed 
  63.    --  operations prior to transforming log messages should be done here. 
  64.  
  65.    procedure Teardown (Transform : in out Instance) is null; 
  66.    --  Each transform must provide a Teardown-procedure. These procedures are 
  67.    --  called by logger instances when detaching Transforms or when the logger 
  68.    --  object gets out of scope. 
  69.  
  70. private 
  71.  
  72.    type Instance is abstract tagged limited record 
  73.       Name : Unbounded_String := To_Unbounded_String ("sample-transform"); 
  74.       --  Transform Name. Names must be unique. 
  75.    end record; 
  76.  
  77. end Alog.Transforms;