MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
messageProcessor.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2005 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: messageProcessor.h,v $ $Revision: 1.3 $ $State: Exp $
7 *******************************************************************************/
10 
11 #ifndef DtMessageProcessor_H_
12 #define DtMessageProcessor_H_
13 
14 #include "rtiMsConfig.h"
15 #include <vector>
16 #include <list>
17 
23 template < class Address, class Message >
25 {
26 public:
27 
28  typedef std::vector< Address > AddressList;
29 
31  class Filter
32  {
33  public:
34 
35  Filter() {};
36  virtual ~Filter() {};
37 
39  virtual inline bool applyFilter( const Message& msg ) const { return false; }
40 
42  virtual inline bool processDestinations( const Address& src, const Message& msg,
43  AddressList& destinations ) const
44  {
46  if ( applyFilter( msg ))
47  return doDestinationProcessing( src, msg, destinations );
48  else
49  return false;
50  }
51 
52  virtual inline bool processMessage( const Address& src, Message& msg ) const
53  {
55  if ( applyFilter( msg ))
56  return doMessageProcessing( src, msg );
57  else
58  return false;
59  }
60 
61  protected:
62 
64  virtual inline bool doDestinationProcessing( const Address& src, const Message& msg,
65  AddressList& destinations ) const { return false; }
66 
68  virtual inline bool doMessageProcessing( const Address& src, Message& msg ) const { return false; }
69  };
70 
71  typedef std::list< Filter* > FilterList;
72 
74  virtual ~DtMessageProcessor() {};
75 
79  virtual inline bool processDestinationList( const Address& src, const Message& msg,
80  AddressList& destinations ) const;
81 
85  virtual inline bool processMessage( const Address& src, Message& msg ) const;
86 
88  virtual inline void addDestinationFilter( Filter* filter )
89  {
90  myDestFilters.push_back( filter );
91  }
92  virtual inline void removeDestinationFilter( Filter* filter )
93  {
94  if ( myDestFilters.size() )
95  {
96  myDestFilters.remove( filter );
97  }
98  }
99  virtual inline void addMessageFilter( Filter* filter )
100  {
101  myMsgFilters.push_back( filter );
102  }
103  virtual inline void removeMessageFilter( Filter* filter )
104  {
105  if ( myMsgFilters.size() )
106  {
107  myMsgFilters.remove( filter );
108  }
109  }
110 
111 protected:
112 
115 };
116 
118 #define DtMessageProcessor_Inl_
119 #include "messageProcessor.inl"
120 #undef DtMessageProcessor_Inl_
121 
122 #endif
123 

Document ID: Generated on Mon Jul 9 10:30:41 EDT 2018 from SVN revision 190224
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)