OmniEvents
|
00001 // Package : omniEvents 00002 // Filter.cc 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 #include "Filter.h" 00025 00026 #include <assert.h> 00027 00028 #ifdef HAVE_OMNIORB4 00029 # define STR_MATCH(s1,s2) omni::strMatch((s1),(s2)) 00030 #else 00031 # define STR_MATCH(s1,s2) (0==::strcmp((s1),(s2))) 00032 #endif 00033 00034 namespace OmniEvents { 00035 00036 bool FilterByRepositoryId::keep(const CORBA::Any& event) const 00037 { 00038 using namespace CORBA; 00039 CORBA::TypeCode_var tc=event.type(); 00040 switch( tc->kind() ) 00041 { 00042 #ifdef HAVE_OMNIORB4 00043 case _np_tk_indirect: // Internal to omniORB. We should never get this. 00044 assert(0); 00045 #endif 00046 00047 // TCs with Repository ID: 00048 case tk_objref: 00049 case tk_struct: 00050 case tk_union: 00051 case tk_enum: 00052 case tk_alias: 00053 case tk_except: 00054 return STR_MATCH( _rid.in(), tc->id() ); 00055 00056 // Collections 00057 case tk_sequence: 00058 case tk_array: 00059 00060 // Primitives 00061 case tk_null: 00062 case tk_void: 00063 case tk_short: 00064 case tk_long: 00065 case tk_ushort: 00066 case tk_ulong: 00067 case tk_float: 00068 case tk_double: 00069 case tk_boolean: 00070 case tk_char: 00071 case tk_octet: 00072 case tk_any: 00073 case tk_TypeCode: 00074 case tk_Principal: 00075 case tk_string: 00076 #ifdef HAS_LongLong 00077 case tk_longlong: 00078 case tk_ulonglong: 00079 #endif 00080 #ifdef HAS_LongDouble 00081 case tk_longdouble: 00082 #endif 00083 #ifndef HAVE_OMNIORB3 00084 case tk_wchar: 00085 case tk_wstring: 00086 case tk_fixed: 00087 00088 // WTF? Not implemented in omniORB? 00089 case tk_value: 00090 case tk_value_box: 00091 case tk_native: 00092 case tk_abstract_interface: 00093 case tk_local_interface: 00094 #else 00095 default: 00096 #endif 00097 break; 00098 } // end case. Note: no default, so that missing options are flagged by GCC. 00099 return false; 00100 } 00101 00102 }; // end namespace OmniEvents