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