00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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 };
00096
00097 #endif // OMNIEVENTS__FILTER_H