Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Filter.h

Go to the documentation of this file.
00001 //                            Package   : omniEvents
00002 // Filter.h                   Created   : 2004/04/30
00003 //                            Author    : Alex Tingle
00004 //
00005 //    Copyright (C) 2004 Alex Tingle.
00006 //
00007 //    This file is part of the omniEvents application.
00008 //
00009 //    omniEvents is free software; you can redistribute it and/or
00010 //    modify it under the terms of the GNU Lesser General Public
00011 //    License as published by the Free Software Foundation; either
00012 //    version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //    omniEvents is distributed in the hope that it will be useful,
00015 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //    Lesser General Public License for more details.
00018 //
00019 //    You should have received a copy of the GNU Lesser General Public
00020 //    License along with this library; if not, write to the Free Software
00021 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 
00024 #ifndef OMNIEVENTS__FILTER_H
00025 #define OMNIEVENTS__FILTER_H
00026 
00027 #ifdef HAVE_CONFIG_H
00028 #  include "config.h"
00029 #endif
00030 
00031 #include "Orb.h"
00032 
00033 #include <string.h>
00034 
00035 #ifdef HAVE_IOSTREAM
00036 #  include <iostream>
00037 #else
00038 #  include <iostream.h>
00039 #endif
00040 
00041 #ifdef HAVE_STD_IOSTREAM
00042 using namespace std;
00043 #endif
00044 
00045 
00046 namespace OmniEvents {
00047 
00049 class Filter
00050 {
00051 public:
00052   Filter(){}
00053   virtual ~Filter(){}
00054 
00058   virtual bool keep(const CORBA::Any& event) const =0;
00059 
00060   virtual void output(ostream& os) const =0;
00061 };
00062 
00066 class FilterByTCKind: public Filter
00067 {
00068 public:
00069   FilterByTCKind(CORBA::TCKind kind):_kind(kind){}
00070   virtual ~FilterByTCKind(){}
00071   bool keep(const CORBA::Any& event) const
00072   {
00073     CORBA::TypeCode_var tc=event.type();
00074     return( tc->kind()==_kind );
00075   }
00076   void output(ostream& os) const { os<<"\n FilterKind="<<_kind; }
00077 private:
00078   CORBA::TCKind _kind;
00079 };
00080 
00084 class FilterByRepositoryId: public Filter
00085 {
00086 public:
00087   FilterByRepositoryId(const char* rid):_rid(rid){}
00088   virtual ~FilterByRepositoryId(){}
00089   bool keep(const CORBA::Any& event) const;
00090   void output(ostream& os) const { os<<"\n FilterId="<<_rid; }
00091 private:
00092   CORBA::RepositoryId_var _rid;
00093 };
00094 
00095 }; // end namespace OmniEvents
00096 
00097 #endif // OMNIEVENTS__FILTER_H

Generated on Fri Aug 26 20:56:14 2005 for OmniEvents by  doxygen 1.4.3-20050530