# ObjectSet.hh

Go to the documentation of this file.

    00001 // ----------------------------------------------------------------------------
    00002 // CERTI - HLA RunTime Infrastructure
    00003 // Copyright (C) 2003  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 // ----------------------------------------------------------------------------
    00023
    00024 #ifndef _CERTI_OBJECT_SET_HH
    00025 #define _CERTI_OBJECT_SET_HH
    00026
    00027 // Project
    00028 class Object;
    00029 #include "SecurityServer.hh"
    00030 #include "MessageBuffer.hh"
    00031 #include "GAV.hh"
    00032 #include "certi.hh"
    00033
    00034 // Standard
    00035 #include <map>
    00036 #include <string>
    00037
    00038 namespace certi {
    00039
    00040 class CERTI_EXPORT ObjectSet : private std::map<ObjectHandle, Object *>
    00041 {
    00042 public:
    00043     // Public Methods.
    00044     ObjectSet(SecurityServer *the_server);
    00045     ~ObjectSet();
    00046
    00047     ObjectHandle
    00048     getObjectInstanceHandle(std::string) const
    00049         throw (ObjectNotKnown, RTIinternalError);
    00050
    00051     const char *
    00052     getObjectInstanceName(ObjectHandle the_object) const
    00053         throw (ObjectNotKnown, RTIinternalError);
    00054
    00055     ObjectClassHandle
    00056     getObjectClass(ObjectHandle the_object) const
    00057         throw (ObjectNotKnown, FederateNotExecutionMember,
    00058                ConcurrentAccessAttempted, RTIinternalError);
    00059
    00060     void changeAttributeTransportationType(ObjectHandle the_object,
    00061                                            AttributeHandle *the_attributes,
    00062                                            UShort the_size,
    00063                                            TransportType the_type)
    00064         throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
    00065                RTIinternalError, InvalidObjectHandle);
    00066
    00067     void changeAttributeOrderType(ObjectHandle the_object,
    00068                                   AttributeHandle *the_attributes,
    00069                                   UShort the_size,
    00070                                   TransportType the_type)
    00071         throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
    00072                RTIinternalError, InvalidObjectHandle);
    00073
    00074     Object *registerObjectInstance(FederateHandle, ObjectClassHandle,
    00075                    ObjectHandle, std::string)
    00076         throw (ObjectAlreadyRegistered, ConcurrentAccessAttempted,
    00077                SaveInProgress, RestoreInProgress, RTIinternalError);
    00078
    00079     void deleteObjectInstance(FederateHandle, ObjectHandle, std::string tag)
    00080         throw (ObjectNotKnown, DeletePrivilegeNotHeld,
    00081                FederateNotExecutionMember, ConcurrentAccessAttempted,
    00082                SaveInProgress, RestoreInProgress, RTIinternalError);
    00083
    00084      FederateHandle requestObjectOwner(FederateHandle the_federate,
    00085                                   ObjectHandle the_object)
    00086     throw (ObjectNotKnown);
    00087
    00088     void killFederate(FederateHandle) throw (RTIinternalError);
    00089
    00090     // Ownership Management.
    00091
    00092     bool isAttributeOwnedByFederate(FederateHandle the_federate,
    00093                                     ObjectHandle the_object,
    00094                                     AttributeHandle the_attribute) const
    00095         throw (ObjectNotKnown, AttributeNotDefined, RTIinternalError);
    00096
    00097     void
    00098     queryAttributeOwnership(FederateHandle the_federate,
    00099                             ObjectHandle the_object,
    00100                             AttributeHandle the_attribute) const
    00101         throw (ObjectNotKnown, AttributeNotDefined, RTIinternalError);
    00102
    00103     void
    00104     negotiatedAttributeOwnershipDivestiture(FederateHandle the_federate,
    00105                                             ObjectHandle the_object,
    00106                                             AttributeHandle *the_attributes,
    00107                                             UShort the_size,
    00108                                             const char *the_tag)
    00109         throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
    00110                AttributeAlreadyBeingDivested, RTIinternalError);
    00111
    00112     void
    00113     attributeOwnershipAcquisitionIfAvailable(FederateHandle the_federate,
    00114                                              ObjectHandle the_object,
    00115                                              AttributeHandle *the_attributes,
    00116                                              UShort the_size)
    00117         throw (ObjectNotKnown, ObjectClassNotPublished, AttributeNotDefined,
    00118                AttributeNotPublished, FederateOwnsAttributes,
    00119                AttributeAlreadyBeingAcquired, RTIinternalError);
    00120
    00121     void
    00122     unconditionalAttributeOwnershipDivestiture(FederateHandle the_federate,
    00123                                                ObjectHandle the_object,
    00124                                                AttributeHandle *the_attributes,
    00125                                                UShort the_size)
    00126         throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
    00127                RTIinternalError);
    00128
    00129     void
    00130     attributeOwnershipAcquisition(FederateHandle the_federate,
    00131                                   ObjectHandle the_object,
    00132                                   AttributeHandle *the_attributes,
    00133                                   UShort the_size,
    00134                                   const char *the_tag)
    00135         throw (ObjectNotKnown, ObjectClassNotPublished, AttributeNotDefined,
    00136                AttributeNotPublished, FederateOwnsAttributes, RTIinternalError);
    00137
    00138     void
    00139     cancelNegotiatedAttributeOwnershipDivestiture(FederateHandle the_federate,
    00140                                                   ObjectHandle the_object,
    00141                                                   std::vector <AttributeHandle> &,
    00142                                                   UShort the_size)
    00143         throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
    00144                AttributeDivestitureWasNotRequested, RTIinternalError);
    00145
    00146     AttributeHandleSet *
    00147     attributeOwnershipReleaseResponse(FederateHandle the_federate,
    00148                                       ObjectHandle the_object,
    00149                                       std::vector <AttributeHandle> &the_attributes,
    00150                                       UShort the_size)
    00151         throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
    00152                FederateWasNotAskedToReleaseAttribute, RTIinternalError);
    00153
    00154     void
    00155     cancelAttributeOwnershipAcquisition(FederateHandle the_federate,
    00156                                         ObjectHandle the_object,
    00157                                         std::vector <AttributeHandle> &the_attributes,
    00158                                         UShort the_size)
    00159         throw (ObjectNotKnown, AttributeNotDefined, AttributeAlreadyOwned,
    00160                AttributeAcquisitionWasNotRequested, RTIinternalError);
    00161
    00162     Object *getObject(ObjectHandle the_object) const
    00163         throw (ObjectNotKnown);
    00164
    00165 protected:
    00166     void sendToFederate(NetworkMessage *msg,
    00167                         FederateHandle the_federate) const ;
    00168
    00169     SecurityServer *server ;
    00170
    00171     typedef std::map<ObjectHandle,Object*,std::less<ObjectHandle> > Handle2ObjectMap_t;
    00172     typedef std::map<std::string,Object*,std::less<std::string> > Name2ObjectMap_t;
    00173     typedef Handle2ObjectMap_t::const_iterator handledO_const_iterator;
    00174     typedef Name2ObjectMap_t::const_iterator namedO_const_iterator;
    00175     Handle2ObjectMap_t OFromHandle;
    00176     Name2ObjectMap_t   OFromName;
    00177     /* The message buffer used to send Network messages */
    00178     MessageBuffer NM_msgBufSend;
    00179 };
    00180
    00181 } // namespace certi
    00182
    00183 #endif // _CERTI_OBJECT_SET_HH