00001 // ---------------------------------------------------------------------------- 00002 // CERTI - HLA RunTime Infrastructure 00003 // Copyright (C) 2005 ONERA 00004 // 00005 // This program is free software ; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public License 00007 // as published by the Free Software Foundation ; either version 2 of 00008 // the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, but 00011 // WITHOUT ANY WARRANTY ; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with this program ; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00018 // USA 00019 // 00020 // $Id: Subscribable.hh,v 3.7 2008/11/08 11:36:05 erk Exp $ 00021 // ---------------------------------------------------------------------------- 00022 00023 #ifndef CERTI_SUBSCRIBABLE_HH 00024 #define CERTI_SUBSCRIBABLE_HH 00025 00026 namespace certi { 00027 class ObjectClassBroadcastList; 00028 class InteractionBroadcastList; 00029 class RTIRegion ; 00030 } 00031 00032 #include "certi.hh" 00033 #include "Named.hh" 00034 #include <list> 00035 00036 00037 namespace certi { 00038 00039 class Subscriber 00040 { 00041 public: 00042 Subscriber(FederateHandle); 00043 Subscriber(FederateHandle, const RTIRegion *); 00044 00045 FederateHandle getHandle() const ; 00046 const RTIRegion *getRegion() const ; 00047 bool equals(FederateHandle, const RTIRegion *) const ; 00048 bool match(const RTIRegion *) const ; 00049 00050 bool operator==(const Subscriber &) const ; 00051 00052 protected: 00053 FederateHandle handle ; 00054 const RTIRegion *region ; 00055 }; 00056 00061 class CERTI_EXPORT Subscribable : public Named 00062 { 00063 public: 00064 virtual ~Subscribable(); 00065 00066 virtual void checkFederateAccess(FederateHandle, const char *) const = 0 ; 00067 virtual Handle getHandle() const = 0 ; 00068 00069 bool isSubscribed(FederateHandle, const RTIRegion *) const ; 00070 bool isSubscribed(FederateHandle) const ; 00071 00072 void subscribe(FederateHandle, const RTIRegion *); 00073 00074 void unsubscribe(FederateHandle); 00075 void unsubscribe(FederateHandle, const RTIRegion *); 00076 00077 void addFederatesIfOverlap(ObjectClassBroadcastList &, const RTIRegion *, Handle) const ; 00078 void addFederatesIfOverlap(InteractionBroadcastList &, const RTIRegion *) const ; 00079 00080 private: 00081 std::list<Subscriber> subscribers ; 00082 }; 00083 00084 } // namespace certi 00085 00086 #endif // CERTI_SUBSCRIBABLE_HH 00087 00088 // $Id: Subscribable.hh,v 3.7 2008/11/08 11:36:05 erk Exp $