# Interaction.hh

Go to the documentation of this file.

    00001 // ----------------------------------------------------------------------------
    00002 // CERTI - HLA RunTime Infrastructure
    00003 // Copyright (C) 2002-2005  ONERA
    00004 //
    00005 // This file is part of CERTI-libCERTI
    00006 //
    00007 // CERTI-libCERTI is free software ; you can redistribute it and/or
    00008 // modify it under the terms of the GNU Lesser General Public License
    00009 // as published by the Free Software Foundation ; either version 2 of
    00010 // the License, or (at your option) any later version.
    00011 //
    00012 // CERTI-libCERTI is distributed in the hope that it will be useful, but
    00013 // WITHOUT ANY WARRANTY ; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    00015 // Lesser General Public License for more details.
    00016 //
    00017 // You should have received a copy of the GNU Lesser General Public
    00018 // License along with this program ; if not, write to the Free Software
    00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
    00020 // USA
    00021 //
    00022 // $Id: Interaction.hh,v 3.36 2008/11/09 12:41:40 gotthardp Exp $
    00023 // ----------------------------------------------------------------------------
    00024
    00025 #ifndef _CERTI_INTERACTION_HH
    00026 #define _CERTI_INTERACTION_HH
    00027
    00028 // forward declaration
    00029 namespace certi {
    00030     class InteractionBroadcastList;
    00031     class InteractionSet;
    00032 }  // namespace certi
    00033
    00034 // CERTI headers
    00035 #include "certi.hh"
    00036 #include "SecurityServer.hh"
    00037 #include "Parameter.hh"
    00038 #include "Subscribable.hh"
    00039
    00040 #include <list>
    00041 #include <set>
    00042 #include <string>
    00043
    00044 namespace certi {
    00045
    00054 class CERTI_EXPORT Interaction : public Subscribable
    00055 {
    00056 public:
    00057
    00061     typedef InteractionClassHandle handle_t;
    00065     typedef InteractionClassNotDefined ObjectNotDefinedException;
    00073     Interaction(const std::string& theName, InteractionClassHandle theHandle, TransportType theTransport, OrderType theOrder);
    00077     ~Interaction();
    00078
    00079     void setSpace(SpaceHandle);
    00080     SpaceHandle getSpace();
    00081
    00082     void setHandle(InteractionClassHandle h) { handle = h ; }
    00083     InteractionClassHandle getHandle() const { return handle ;}
    00084
    00089     InteractionClassHandle getSuperclass() const { return superClass ; };
    00090
    00095     void addSubClass(Interaction *child);
    00096
    00102     Interaction* getSubClassByName(const std::string subClassName);
    00106     InteractionSet* getSubClasses() {return subClasses;};
    00107
    00108     ParameterHandle addParameter(Parameter *the_parameter,
    00109                                  bool is_inherited = false);
    00110
    00111
    00112     void display() const ;
    00113
    00114     // -- Security Methods --
    00115     void checkFederateAccess(FederateHandle the_federate,
    00116                              const char *reason) const
    00117         throw (SecurityError);
    00118
    00119     SecurityLevelID getSecurityLevelId() const { return id ; };
    00120     void setSecurityLevelId(SecurityLevelID NewLevelID);
    00121
    00122     // -- Publication and Subscription --
    00123     void publish(FederateHandle)
    00124         throw (FederateNotPublishing, RTIinternalError, SecurityError);
    00125
    00126     void unpublish(FederateHandle)
    00127         throw (FederateNotPublishing, RTIinternalError, SecurityError);
    00128
    00129     // -- RTI Support Services --
    00130     ParameterHandle getParameterHandle(const char *) const
    00131         throw (NameNotFound, RTIinternalError);
    00132
    00138     const std::string& getParameterName(ParameterHandle the_handle) const
    00139         throw (InteractionParameterNotDefined, RTIinternalError);
    00140
    00141     void killFederate(FederateHandle theFederate)
    00142         throw ();
    00143
    00144     // -- Transport and Ordering --
    00145     void changeTransportationType(TransportType new_type,
    00146                                   FederateHandle the_handle)
    00147         throw (FederateNotPublishing, InvalidTransportationHandle, RTIinternalError);
    00148
    00149     void changeOrderType(OrderType new_order, FederateHandle the_handle)
    00150         throw (FederateNotPublishing, InvalidOrderingHandle, RTIinternalError);
    00151
    00152     // -- Instance Broadcasting --
    00153     void isReady(FederateHandle federate_handle,
    00154                  std::vector <ParameterHandle> &parameter_list,
    00155                  UShort list_size)
    00156         throw (FederateNotPublishing,
    00157                InteractionParameterNotDefined,
    00158                RTIinternalError);
    00159
    00160     InteractionBroadcastList *
    00161     sendInteraction(FederateHandle federate_handle,
    00162                     std::vector <ParameterHandle> &parameter_list,
    00163                     std::vector <ParameterValue_t> &value_list,
    00164                     UShort list_size,
    00165                     FederationTime the_time,
    00166             const RTIRegion *,
    00167                     const char *the_tag)
    00168         throw (FederateNotPublishing,
    00169                InteractionClassNotDefined,
    00170                InteractionParameterNotDefined,
    00171                RTIinternalError);
    00172
    00173     InteractionBroadcastList *
    00174     sendInteraction(FederateHandle federate_handle,
    00175                     std::vector <ParameterHandle> &parameter_list,
    00176                     std::vector <ParameterValue_t> &value_list,
    00177                     UShort list_size,
    00178             const RTIRegion *,
    00179                     const char *the_tag)
    00180         throw (FederateNotPublishing,
    00181                InteractionClassNotDefined,
    00182                InteractionParameterNotDefined,
    00183                RTIinternalError);
    00184
    00185     void broadcastInteractionMessage(InteractionBroadcastList *, const RTIRegion *);
    00186
    00188     SecurityServer *server ;
    00193     InteractionClassHandle parent ;
    00194
    00195     //std::list<InteractionClassHandle> children ;
    00196
    00197     UShort depth ;
    00198
    00202     TransportType transport ;
    00203
    00205     OrderType order ;
    00206
    00207 private:
    00208     /*
    00209      * private default constructor with no code
    00210      * one should not call it.
    00211      */
    00212     Interaction();
    00213
    00214     void addInheritedClassParameter(Interaction *new_child);
    00215
    00216     InteractionClassHandle handle ;
    00217
    00222     InteractionClassHandle superClass;
    00226     InteractionSet* subClasses;
    00227
    00228     Parameter *getParameterByHandle(ParameterHandle the_handle) const
    00229         throw (InteractionParameterNotDefined, RTIinternalError);
    00230
    00231     void deletePublisher(FederateHandle);
    00232     bool isPublishing(FederateHandle);
    00233
    00234     // Attributes
    00235     SecurityLevelID id ;
    00236     SpaceHandle space ;
    00237
    00239     std::list<Parameter *> parameterSet ;
    00240
    00241     typedef std::set<FederateHandle> PublishersList ;
    00242     PublishersList publishers ;
    00243 };
    00244
    00245 } // namespace
    00246
    00247 #endif // _CERTI_INTERACTION.HH
    00248
    00249 // $Id: Interaction.hh,v 3.36 2008/11/09 12:41:40 gotthardp Exp $