LogService
libdadi: utility tools for distributed applications
 All Classes Functions Variables
SimpleFilterManager.hh
00001 /****************************************************************************/
00002 /* The SimpleFilterManager implements the FilterManagerInterface. This      */
00003 /* Implementation is complete, but it is not very efficient.                */
00004 /*                                                                          */
00005 /*  Author(s):                                                              */
00006 /*    - Georg Hoesch (hoesch@in.tum.de)                                     */
00007 /*    - Cyrille Pontvieux (cyrille.pontvieux@edu.univ-fcomte.fr)            */
00008 /*                                                                          */
00009 /*  This file is part of DIET .                                             */
00010 /*                                                                          */
00011 /*  Copyright (C) 2000-2003 ENS Lyon, LIFC, INSA, INRIA and SysFera (2000)  */
00012 /*                                                                          */
00013 /*  - Frederic.Desprez@ens-lyon.fr (Project Manager)                        */
00014 /*  - Eddy.Caron@ens-lyon.fr (Technical Manager)                            */
00015 /*  - Tech@sysfera.com (Maintainer and Technical Support)                   */
00016 /*                                                                          */
00017 /*  This software is a computer program whose purpose is to provide an      */
00018 /*  distributed logging services.                                           */
00019 /*                                                                          */
00020 /*                                                                          */
00021 /*  This software is governed by the CeCILL license under French law and    */
00022 /*  abiding by the rules of distribution of free software.  You can  use,   */
00023 /*  modify and/ or redistribute the software under the terms of the CeCILL  */
00024 /*  license as circulated by CEA, CNRS and INRIA at the following URL       */
00025 /*  "http://www.cecill.info".                                               */
00026 /*                                                                          */
00027 /*  As a counterpart to the access to the source code and  rights to copy,  */
00028 /*  modify and redistribute granted by the license, users are provided      */
00029 /*  only with a limited warranty  and the software's author,  the holder    */
00030 /*  of the economic rights,  and the successive licensors  have only        */
00031 /*  limited liability.                                                      */
00032 /*                                                                          */
00033 /*  In this respect, the user's attention is drawn to the risks             */
00034 /*  associated with loading,  using,  modifying and/or developing or        */
00035 /*  reproducing the software by the user in light of its specific status    */
00036 /*  of free software, that may mean  that it is complicated to              */
00037 /*  manipulate, and  that  also therefore means  that it is reserved for    */
00038 /*  developers and experienced professionals having in-depth computer       */
00039 /*  knowledge. Users are therefore encouraged to load and test the          */
00040 /*  software's suitability as regards their requirements in conditions      */
00041 /*  enabling the security of their systems and/or data to be ensured and,   */
00042 /*  more generally, to use and operate it in the same conditions as         */
00043 /*  regards security.                                                       */
00044 /*                                                                          */
00045 /*  The fact that you are presently reading this means that you have had    */
00046 /*  knowledge of the CeCILL license and that you accept its terms.          */
00047 /*                                                                          */
00048 /****************************************************************************/
00049 /* $Id$
00050  * $Log$
00051  * Revision 1.1  2004/01/09 11:07:12  ghoesch
00052  * Restructured the whole LogService source tree.
00053  * Added autotools make process. Cleaned up code.
00054  * Removed some testers. Ready to release.
00055  *
00056  ***************************************************************************/
00057 
00058 #ifndef _SIMPLEFILTERMANAGER_HH_
00059 #define _SIMPLEFILTERMANAGER_HH_
00060 
00061 #include "LogTypes.hh"
00062 #include "ToolList.hh"
00063 #include "ComponentList.hh"
00064 #include "FilterManagerInterface.hh"
00065 #include "FullLinkedList.hh"
00066 
00070 struct ConfigElement {
00071   CORBA::String_var componentName;
00072   tag_list_t config;
00073   tag_list_t oldConfig;
00074 };
00075 
00079 typedef FullLinkedList<ConfigElement> ConfigList;
00080 
00081 
00086 class SimpleFilterManager:public FilterManagerInterface {
00087 public:
00098   SimpleFilterManager(ToolList* toolList,
00099                       ComponentList* compList,
00100                       tag_list_t* stateTags);
00101 
00102   virtual
00103   ~SimpleFilterManager();
00104 
00111   void
00112   toolConnect(const char* toolName, ToolList::ReadIterator* iter);
00113 
00122   void
00123   toolDisconnect(const char* toolName, ToolList::ReadIterator* iter);
00124 
00130   void
00131   addFilter(const char* toolName, const char* filterName,
00132             ToolList::ReadIterator* iter);
00133 
00140   void
00141   removeFilter(const char* toolName, const char* filterName,
00142                ToolList::ReadIterator* iter);
00143 
00150   virtual void
00151   flushAllFilters(const char* toolName, ToolList::ReadIterator* iter);
00152 
00158   tag_list_t*
00159   componentConnect(const char* componentName,
00160                    ComponentList::ReadIterator* iter);
00161 
00168   void
00169   componentDisconnect(const char* componentName,
00170                       ComponentList::ReadIterator* iter);
00171 
00177   void
00178   sendMessageWithFilters(log_msg_t* message);
00179 
00180 private:
00181   ToolList* toolList;
00182   ComponentList* componentList;
00183 
00187   ConfigList configList;
00188 
00192   tag_list_t systemStateTags;
00193 
00198   bool
00199   containsComponent(component_list_t* list, const char* name);
00200 
00206   bool
00207   containsComponentName(component_list_t* list, const char* name);
00208 
00212   bool
00213   containsComponentStar(component_list_t* list);
00214 
00219   bool
00220   containsTag(tag_list_t* list, const char* name);
00221 
00227   bool
00228   containsTagName(tag_list_t* list, const char* name);
00229 
00233   bool
00234   containsTagStar(tag_list_t* list);
00235 
00241   void
00242   addTagList(tag_list_t* destList, tag_list_t* srcList);
00243 
00248   void
00249   addFilter(filter_t* filter);
00250 
00255   void
00256   updateComponentConfigs();
00257 };
00258 
00259 #endif