[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi libCERTI/ObjectClassSet.hh libCERTI/Objec...
From: |
certi-cvs |
Subject: |
[certi-cvs] certi libCERTI/ObjectClassSet.hh libCERTI/Objec... |
Date: |
Mon, 23 Nov 2009 07:34:29 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Eric NOULARD <erk> 09/11/23 07:34:29
Modified files:
libCERTI : ObjectClassSet.hh ObjectClassSet.cc
ObjectClass.cc ObjectClass.hh RootObject.cc
RTIG : Federation.cc
Log message:
Check-in clean-up and perf enhancement patch from Mathias
patch #6995: improved object pointer lookup in the RootObject
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClassSet.hh?cvsroot=certi&r1=3.37&r2=3.38
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClassSet.cc?cvsroot=certi&r1=3.49&r2=3.50
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.cc?cvsroot=certi&r1=3.73&r2=3.74
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.hh?cvsroot=certi&r1=3.49&r2=3.50
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/RootObject.cc?cvsroot=certi&r1=3.46&r2=3.47
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.117&r2=3.118
Patches:
Index: libCERTI/ObjectClassSet.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClassSet.hh,v
retrieving revision 3.37
retrieving revision 3.38
diff -u -b -r3.37 -r3.38
--- libCERTI/ObjectClassSet.hh 19 Nov 2009 18:15:31 -0000 3.37
+++ libCERTI/ObjectClassSet.hh 23 Nov 2009 07:34:28 -0000 3.38
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClassSet.hh,v 3.37 2009/11/19 18:15:31 erk Exp $
+// $Id: ObjectClassSet.hh,v 3.38 2009/11/23 07:34:28 erk Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_OBJECT_CLASS_SET_HH
@@ -37,9 +37,7 @@
#include "TreeNamedAndHandledSet.hh"
// System headers
-#include <list>
#include <string>
-#include <map>
namespace certi {
@@ -94,13 +92,13 @@
// Object Instance Management
void deleteObject(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
FederationTime theTime,
const std::string& theTag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError);
void deleteObject(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
const std::string& theTag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError);
@@ -110,74 +108,64 @@
RTIinternalError);
void updateAttributeValues(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
std::vector <AttributeHandle> &theAttribArray,
std::vector <AttributeValue_t> &theValueArray,
- UShort theArraySize,
- FederationTime theTime,
+ const FederationTime& theTime,
const std::string& theUserTag)
- throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
+ throw (AttributeNotDefined, AttributeNotOwned,
RTIinternalError, InvalidObjectHandle);
void updateAttributeValues(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
std::vector <AttributeHandle> &theAttribArray,
std::vector <AttributeValue_t> &theValueArray,
- UShort theArraySize,
const std::string& theUserTag)
- throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
+ throw (AttributeNotDefined, AttributeNotOwned,
RTIinternalError, InvalidObjectHandle);
// Ownership Management
void negotiatedAttributeOwnershipDivestiture(FederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
std::vector <AttributeHandle> &,
- UShort theListSize,
const std::string& theTag)
- throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
+ throw (AttributeNotDefined, AttributeNotOwned,
AttributeAlreadyBeingDivested, RTIinternalError);
void attributeOwnershipAcquisitionIfAvailable(FederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle>&,
- UShort theListSize)
- throw (ObjectNotKnown, ObjectClassNotPublished, AttributeNotDefined,
+ Object* object,
+ std::vector <AttributeHandle>&)
+ throw (ObjectClassNotPublished, AttributeNotDefined,
AttributeNotPublished, FederateOwnsAttributes,
AttributeAlreadyBeingAcquired, RTIinternalError);
void unconditionalAttributeOwnershipDivestiture(FederateHandle,
- ObjectHandle,
- std::vector <AttributeHandle>&,
- UShort theListSize)
- throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
+ Object* object,
+ std::vector <AttributeHandle>&)
+ throw (AttributeNotDefined, AttributeNotOwned,
RTIinternalError);
void attributeOwnershipAcquisition(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
std::vector <AttributeHandle> &theAttributeList,
- UShort theListSize,
const std::string& theTag)
- throw (ObjectNotKnown, ObjectClassNotPublished, AttributeNotDefined,
+ throw (ObjectClassNotPublished, AttributeNotDefined,
AttributeNotPublished, FederateOwnsAttributes,
RTIinternalError);
AttributeHandleSet *attributeOwnershipReleaseResponse(FederateHandle,
- ObjectHandle,
- std::vector <AttributeHandle> &,
- UShort)
- throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned,
+ Object* object,
+ std::vector <AttributeHandle> &)
+ throw (AttributeNotDefined, AttributeNotOwned,
FederateWasNotAskedToReleaseAttribute,
RTIinternalError);
void cancelAttributeOwnershipAcquisition(FederateHandle
theFederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle> &theAttributeList,
- UShort theListSize)
- throw (ObjectNotKnown, AttributeNotDefined, AttributeAlreadyOwned,
+ Object* object,
+ std::vector <AttributeHandle> &theAttributeList)
+ throw (AttributeNotDefined, AttributeAlreadyOwned,
AttributeAcquisitionWasNotRequested, RTIinternalError);
- Object *getObject(ObjectHandle) const throw (ObjectNotKnown);
-
private:
/**
@@ -194,4 +182,4 @@
#endif // _CERTI_OBJECT_CLASS_SET_HH
-// $Id: ObjectClassSet.hh,v 3.37 2009/11/19 18:15:31 erk Exp $
+// $Id: ObjectClassSet.hh,v 3.38 2009/11/23 07:34:28 erk Exp $
Index: libCERTI/ObjectClassSet.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClassSet.cc,v
retrieving revision 3.49
retrieving revision 3.50
diff -u -b -r3.49 -r3.50
--- libCERTI/ObjectClassSet.cc 21 Nov 2009 21:18:28 -0000 3.49
+++ libCERTI/ObjectClassSet.cc 23 Nov 2009 07:34:28 -0000 3.50
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClassSet.cc,v 3.49 2009/11/21 21:18:28 erk Exp $
+// $Id: ObjectClassSet.cc,v 3.50 2009/11/23 07:34:28 erk Exp $
// ----------------------------------------------------------------------------
// Project
@@ -35,8 +35,6 @@
#include <iosfwd>
#include <sstream>
-using std::endl ;
-
namespace certi {
static PrettyDebug D("OBJECTCLASSSET", __FILE__);
@@ -70,13 +68,13 @@
//! deleteObject with time.
void
ObjectClassSet::deleteObject(FederateHandle federate,
- ObjectHandle object,
+ Object* object,
FederationTime theTime,
const std::string& tag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError)
{
// It may throw ObjectNotKnown
- ObjectClass *oclass = getInstanceClass(object);
+ ObjectClass *oclass = getInstanceClass(object->getHandle());
D.Out(pdRegister,
"Federate %d attempts to delete instance %d in class %d.",
@@ -113,12 +111,12 @@
//! deleteObject without time.
void
ObjectClassSet::deleteObject(FederateHandle federate,
- ObjectHandle object,
+ Object* object,
const std::string& tag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError)
{
// It may throw ObjectNotKnown
- ObjectClass *oclass = getInstanceClass(object);
+ ObjectClass *oclass = getInstanceClass(object->getHandle());
D.Out(pdRegister,
"Federate %d attempts to delete instance %d in class %d.",
@@ -227,24 +225,6 @@
}
// ----------------------------------------------------------------------------
-/** Get object
- */
-Object *
-ObjectClassSet::getObject(ObjectHandle h) const
- throw (ObjectNotKnown)
-{
- handled_const_iterator i ;
-
- for (i = fromHandle.begin(); i != fromHandle.end(); ++i) {
- if (!i->second->isInstanceInClass(h)) {
- continue;
- }
- return i->second->getInstanceWithID(h);
- }
- throw ObjectNotKnown("");
-}
-
-// ----------------------------------------------------------------------------
//! getObjectClassHandle.
ObjectClassHandle
ObjectClassSet::getObjectClassHandle(const std::string& class_name) const
@@ -378,7 +358,7 @@
}
Debug(D, pdRegister) << "Instance " << the_object << " has been
registered."
- << endl ;
+ << std::endl ;
}
// ----------------------------------------------------------------------------
@@ -411,29 +391,26 @@
//! updateAttributeValues with time
void
ObjectClassSet::updateAttributeValues(FederateHandle federate,
- ObjectHandle object_handle,
+ Object* object,
std::vector <AttributeHandle>
&attributes,
std::vector <AttributeValue_t> &values,
- UShort nb,
- FederationTime time,
+ const FederationTime& time,
const std::string& tag)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ throw (AttributeNotDefined,
AttributeNotOwned,
RTIinternalError,
InvalidObjectHandle)
{
- Object *object = getObject(object_handle);
ObjectClass *object_class = getObjectFromHandle(object->getClass());
ObjectClassHandle current_class = object_class->getHandle();
D.Out(pdProtocol, "Federate %d Updating object %d from class %d.",
- federate, object_handle, current_class);
+ federate, object->getHandle(), current_class);
// It may throw a bunch of exceptions
ObjectClassBroadcastList *ocbList = NULL ;
ocbList = object_class->updateAttributeValues(
- federate, object, attributes, values, nb, time, tag);
+ federate, object,
attributes, values, attributes.size(), time, tag);
// Broadcast ReflectAttributeValues message recursively
current_class = object_class->getSuperclass();
@@ -441,7 +418,7 @@
while (current_class != 0) {
D.Out(pdProtocol,
"Broadcasting RAV msg to parent class %d for instance %d.",
- current_class, object_handle);
+ current_class, object->getHandle());
// It may throw ObjectClassNotDefined
object_class = getObjectFromHandle(current_class);
@@ -457,28 +434,25 @@
//! updateAttributeValues without time
void
ObjectClassSet::updateAttributeValues(FederateHandle federate,
- ObjectHandle object_handle,
+ Object* object,
std::vector <AttributeHandle>
&attributes,
std::vector <AttributeValue_t> &values,
- UShort nb,
const std::string& tag)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ throw (AttributeNotDefined,
AttributeNotOwned,
RTIinternalError,
InvalidObjectHandle)
{
- Object *object = getObject(object_handle);
ObjectClass *object_class = getObjectFromHandle(object->getClass());
ObjectClassHandle current_class = object_class->getHandle();
D.Out(pdProtocol, "Federate %d Updating object %d from class %d.",
- federate, object_handle, current_class);
+ federate, object->getHandle(), current_class);
// It may throw a bunch of exceptions
ObjectClassBroadcastList *ocbList = NULL ;
ocbList = object_class->updateAttributeValues(
- federate, object, attributes, values, nb, tag);
+ federate, object,
attributes, values, attributes.size(), tag);
// Broadcast ReflectAttributeValues message recursively
current_class = object_class->getSuperclass();
@@ -486,7 +460,7 @@
while (current_class != 0) {
D.Out(pdProtocol,
"Broadcasting RAV msg to parent class %d for instance %d.",
- current_class, object_handle);
+ current_class, object->getHandle());
// It may throw ObjectClassNotDefined
object_class = getObjectFromHandle(current_class);
@@ -503,27 +477,24 @@
void
ObjectClassSet::
negotiatedAttributeOwnershipDivestiture(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
std::vector <AttributeHandle>
&theAttributeList,
- UShort theListSize,
const std::string& theTag)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ throw (AttributeNotDefined,
AttributeNotOwned,
AttributeAlreadyBeingDivested,
RTIinternalError)
{
// It may throw ObjectNotKnown
- ObjectClass *objectClass = getInstanceClass(theObjectHandle);
+ ObjectClass *objectClass = getInstanceClass(object->getHandle());
ObjectClassHandle currentClass = objectClass->getHandle();
// It may throw a bunch of exceptions.
ObjectClassBroadcastList *ocbList = NULL ;
ocbList =
objectClass->negotiatedAttributeOwnershipDivestiture(theFederateHandle,
- theObjectHandle,
+ object,
theAttributeList,
- theListSize,
theTag);
// Broadcast ReflectAttributeValues message recursively
@@ -532,7 +503,7 @@
while (currentClass != 0) {
D.Out(pdProtocol,
"Broadcasting NAOD msg to parent class %d for instance %d.",
- currentClass, theObjectHandle);
+ currentClass, object->getHandle());
// It may throw ObjectClassNotDefined
objectClass = getObjectFromHandle(currentClass);
@@ -549,11 +520,9 @@
void
ObjectClassSet::
attributeOwnershipAcquisitionIfAvailable(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle>
&theAttributeList,
- UShort theListSize)
- throw (ObjectNotKnown,
- ObjectClassNotPublished,
+ Object* object,
+ std::vector <AttributeHandle>
&theAttributeList)
+ throw (ObjectClassNotPublished,
AttributeNotDefined,
AttributeNotPublished,
FederateOwnsAttributes,
@@ -561,13 +530,12 @@
RTIinternalError)
{
// It may throw ObjectNotKnown
- ObjectClass * objectClass = getInstanceClass(theObjectHandle);
+ ObjectClass * objectClass = getInstanceClass(object->getHandle());
// It may throw a bunch of exceptions.
objectClass->attributeOwnershipAcquisitionIfAvailable(theFederateHandle,
- theObjectHandle,
- theAttributeList,
- theListSize);
+ object,
+ theAttributeList);
}
// ----------------------------------------------------------------------------
@@ -575,25 +543,19 @@
void
ObjectClassSet::
unconditionalAttributeOwnershipDivestiture(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle>
&theAttributeList,
- UShort theListSize)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ Object* object,
+ std::vector <AttributeHandle>
&theAttributeList)
+ throw (AttributeNotDefined,
AttributeNotOwned,
RTIinternalError)
{
- // It may throw ObjectNotKnown
- ObjectClass *objectClass = getInstanceClass(theObjectHandle);
+ ObjectClass *objectClass = getInstanceClass(object->getHandle());
ObjectClassHandle currentClass = objectClass->getHandle();
// It may throw a bunch of exceptions.
ObjectClassBroadcastList *ocbList = NULL ;
ocbList = objectClass->
- unconditionalAttributeOwnershipDivestiture(theFederateHandle,
- theObjectHandle,
- theAttributeList,
- theListSize);
+ unconditionalAttributeOwnershipDivestiture(theFederateHandle, object,
theAttributeList);
// Broadcast ReflectAttributeValues message recursively
currentClass = objectClass->getSuperclass();
@@ -601,7 +563,7 @@
while (currentClass != 0) {
D.Out(pdProtocol,
"Broadcasting UAOD msg to parent class %d for instance %d.",
- currentClass, theObjectHandle);
+ currentClass, object->getHandle());
// It may throw ObjectClassNotDefined
objectClass = getObjectFromHandle(currentClass);
@@ -618,74 +580,58 @@
void
ObjectClassSet::
attributeOwnershipAcquisition(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
std::vector <AttributeHandle> &theAttributeList,
- UShort theListSize,
const std::string& theTag)
- throw (ObjectNotKnown,
- ObjectClassNotPublished,
+ throw (ObjectClassNotPublished,
AttributeNotDefined,
AttributeNotPublished,
FederateOwnsAttributes,
RTIinternalError)
{
// It may throw ObjectNotKnown
- ObjectClass * objectClass = getInstanceClass(theObjectHandle);
+ ObjectClass * objectClass = getInstanceClass(object->getHandle());
// It may throw a bunch of exceptions.
- objectClass->attributeOwnershipAcquisition(theFederateHandle,
- theObjectHandle,
- theAttributeList,
- theListSize,
- theTag);
+ objectClass->attributeOwnershipAcquisition(theFederateHandle, object,
theAttributeList, theTag);
}
// ----------------------------------------------------------------------------
//! attributeOwnershipReleaseResponse.
AttributeHandleSet * ObjectClassSet::
attributeOwnershipReleaseResponse(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle>
&theAttributeList,
- UShort theListSize)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ Object* object,
+ std::vector <AttributeHandle>
&theAttributeList)
+ throw (AttributeNotDefined,
AttributeNotOwned,
FederateWasNotAskedToReleaseAttribute,
RTIinternalError)
{
// It may throw ObjectNotKnown
- ObjectClass *objectClass = getInstanceClass(theObjectHandle);
+ ObjectClass *objectClass = getInstanceClass(object->getHandle());
// It may throw a bunch of exceptions.
- return(objectClass->attributeOwnershipReleaseResponse(theFederateHandle,
- theObjectHandle,
- theAttributeList,
- theListSize));
+ return objectClass->attributeOwnershipReleaseResponse(theFederateHandle,
object, theAttributeList);
}
// ----------------------------------------------------------------------------
//! cancelAttributeOwnershipAcquisition.
void ObjectClassSet::
cancelAttributeOwnershipAcquisition(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle>
&theAttributeList,
- UShort theListSize)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ Object* object,
+ std::vector <AttributeHandle>
&theAttributeList)
+ throw (AttributeNotDefined,
AttributeAlreadyOwned,
AttributeAcquisitionWasNotRequested,
RTIinternalError)
{
// It may throw ObjectNotKnown
- ObjectClass *objectClass = getInstanceClass(theObjectHandle);
+ ObjectClass *objectClass = getInstanceClass(object->getHandle());
// It may throw a bunch of exceptions.
- objectClass->cancelAttributeOwnershipAcquisition(theFederateHandle,
- theObjectHandle,
- theAttributeList,
- theListSize);
+ objectClass->cancelAttributeOwnershipAcquisition(theFederateHandle,
object, theAttributeList);
}
} // namespace certi
-// $Id: ObjectClassSet.cc,v 3.49 2009/11/21 21:18:28 erk Exp $
+// $Id: ObjectClassSet.cc,v 3.50 2009/11/23 07:34:28 erk Exp $
Index: libCERTI/ObjectClass.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.cc,v
retrieving revision 3.73
retrieving revision 3.74
diff -u -b -r3.73 -r3.74
--- libCERTI/ObjectClass.cc 21 Nov 2009 21:18:28 -0000 3.73
+++ libCERTI/ObjectClass.cc 23 Nov 2009 07:34:28 -0000 3.74
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClass.cc,v 3.73 2009/11/21 21:18:28 erk Exp $
+// $Id: ObjectClass.cc,v 3.74 2009/11/23 07:34:28 erk Exp $
// ----------------------------------------------------------------------------
#include "Object.hh"
@@ -208,7 +208,7 @@
//! sendToOwners.
void
ObjectClass::sendToOwners(CDiffusion *diffusionList,
- ObjectHandle theObjectHandle,
+ Object* object,
FederateHandle theFederate,
const std::string& theTag,
NetworkMessage::Type type)
@@ -222,7 +222,7 @@
std::auto_ptr<NetworkMessage> answer(NM_Factory::create(type));
answer->federation = server->federation();
answer->federate = theFederate ;
- answer->object = theObjectHandle ;
+ answer->object = object->getHandle() ;
answer->setLabel(theTag);
answer->handleArray.resize(nbAttributes) ;
@@ -308,26 +308,22 @@
*/
ObjectClassBroadcastList *
ObjectClass::deleteInstance(FederateHandle the_federate,
- ObjectHandle the_object,
- FederationTime theTime,
+ Object* object,
+ const FederationTime& theTime,
const std::string& the_tag)
throw (DeletePrivilegeNotHeld,
ObjectNotKnown,
RTIinternalError)
{
-
- // 1. Pre-conditions checking(may throw ObjectNotKnown)
- Object *object = getInstanceWithID(the_object);
-
// Is the Federate really the Object Owner?(Checked only on RTIG)
if ((server != 0) && (object->getOwner() != the_federate)) {
D.Out(pdExcept, "Delete Object %d: Federate %d not owner.",
- the_object, the_federate);
+ object->getHandle(), the_federate);
throw DeletePrivilegeNotHeld("");
}
// 2. Remove Instance from list.
- HandleObjectMap::iterator o = _handleObjectMap.find(the_object);
+ HandleObjectMap::iterator o = _handleObjectMap.find(object->getHandle());
if (o != _handleObjectMap.end()) {
_handleObjectMap.erase(o);
}
@@ -337,14 +333,14 @@
if (server != NULL) {
D.Out(pdRegister,
"Object %u deleted in class %u, now broadcasting...",
- the_object, handle);
+ object->getHandle(), handle);
NetworkMessage *answer =
NM_Factory::create(NetworkMessage::REMOVE_OBJECT);
answer->federation = server->federation();
answer->federate = the_federate ;
answer->setException(e_NO_EXCEPTION);
answer->objectClass = handle ; // Class Handle
- answer->object = the_object ;
+ answer->object = object->getHandle() ;
// with time
answer->setDate(theTime);
@@ -356,7 +352,7 @@
else {
D.Out(pdRegister,
"Object %u deleted in class %u, no broadcast to do.",
- the_object, handle);
+ object->getHandle(), handle);
}
// Return the BroadcastList in case it had to be passed to the parent
@@ -374,24 +370,21 @@
*/
ObjectClassBroadcastList *
ObjectClass::deleteInstance(FederateHandle the_federate,
- ObjectHandle the_object,
+ Object* object,
const std::string& the_tag)
throw (DeletePrivilegeNotHeld,
ObjectNotKnown,
RTIinternalError)
{
- // 1. Pre-conditions checking(may throw ObjectNotKnown)
- Object *object = getInstanceWithID(the_object);
-
// Is the Federate really the Object Owner?(Checked only on RTIG)
if ((server != 0) && (object->getOwner() != the_federate)) {
D.Out(pdExcept, "Delete Object %d: Federate %d not owner.",
- the_object, the_federate);
+ object->getHandle(), the_federate);
throw DeletePrivilegeNotHeld("");
}
// 2. Remove Instance from list.
- HandleObjectMap::iterator o = _handleObjectMap.find(the_object);
+ HandleObjectMap::iterator o = _handleObjectMap.find(object->getHandle());
if (o != _handleObjectMap.end()) {
_handleObjectMap.erase(o);
}
@@ -401,13 +394,13 @@
if (server != NULL) {
D.Out(pdRegister,
"Object %u deleted in class %u, now broadcasting...",
- the_object, handle);
+ object->getHandle(), handle);
NetworkMessage *answer =
NM_Factory::create(NetworkMessage::REMOVE_OBJECT);
answer->federation = server->federation();
answer->federate = the_federate ;
answer->objectClass = handle ; // Class Handle
- answer->object = the_object ;
+ answer->object = object->getHandle() ;
// without time
@@ -419,7 +412,7 @@
else {
D.Out(pdRegister,
"Object %u deleted in class %u, no broadcast to do.",
- the_object, handle);
+ object->getHandle(), handle);
}
// Return the BroadcastList in case it had to be passed to the parent
@@ -517,27 +510,6 @@
}
// ----------------------------------------------------------------------------
-//! Get Object
-Object *
-ObjectClass::getInstanceWithID(ObjectHandle objectHandle) const
- throw (ObjectNotKnown)
-{
- HandleObjectMap::const_iterator i = _handleObjectMap.find(objectHandle);
- if (i != _handleObjectMap.end()) {
- return i->second;
- }
-
- std::stringstream msg;
- msg << "Could not find ObjectHandle <" << objectHandle << "> among <"
- << _handleObjectMap.size() << "> objects of ObjectClass "
- << handle;
-
- Debug(D, pdError) << msg.str() << std::endl ;
-
- throw ObjectNotKnown(msg.str());
-}
-
-// ----------------------------------------------------------------------------
//! Return true if the Federate is publishing any attribute of this class.
bool
ObjectClass::isFederatePublisher(FederateHandle the_federate) const
@@ -611,7 +583,7 @@
// 2- The federate may own another instance, and this function
// must be called again.
// BUG: String \/
- return deleteInstance(the_federate, i->second->getHandle(),
"Killed");
+ return deleteInstance(the_federate, i->second, "Killed");
}
}
@@ -858,8 +830,7 @@
int the_size,
FederationTime the_time,
const std::string& the_tag)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ throw (AttributeNotDefined,
AttributeNotOwned,
RTIinternalError,
InvalidObjectHandle)
@@ -921,8 +892,7 @@
std::vector <AttributeValue_t> &the_values,
int the_size,
const std::string& the_tag)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ throw (AttributeNotDefined,
AttributeNotOwned,
RTIinternalError,
InvalidObjectHandle)
@@ -980,23 +950,18 @@
//! negotiatedAttributeOwnershipDivestiture.
ObjectClassBroadcastList * ObjectClass::
negotiatedAttributeOwnershipDivestiture(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
std::vector <AttributeHandle>
&theAttributeList,
- UShort theListSize,
const std::string& theTag)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ throw (AttributeNotDefined,
AttributeNotOwned,
AttributeAlreadyBeingDivested,
RTIinternalError)
{
// Pre-conditions checking
- // may throw ObjectNotKnown
- Object *object = getInstanceWithID(theObjectHandle);
-
// Do all attribute handles exist ? It may throw AttributeNotDefined.
- for (int index = 0 ; index < theListSize ; index++)
+ for (unsigned index = 0 ; index < theAttributeList.size() ; index++)
getAttribute(theAttributeList[index]);
// Does federate owns every attributes.
@@ -1005,7 +970,7 @@
ObjectAttribute * oa ;
ObjectClassAttribute * oca ;
- for (int i = 0 ; i < theListSize ; i++) {
+ for (unsigned i = 0 ; i < theAttributeList.size() ; i++) {
oca = getAttribute(theAttributeList[i]);
oa = object->getAttribute(theAttributeList[i]);
@@ -1028,17 +993,17 @@
NetworkMessage *AnswerAssumption =
NM_Factory::create(NetworkMessage::REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION) ;
NM_Attribute_Ownership_Divestiture_Notification AnswerDivestiture;
- AnswerAssumption->handleArraySize = theListSize ;
- AnswerAssumption->handleArray.resize(theListSize) ;
+ AnswerAssumption->handleArraySize = theAttributeList.size() ;
+ AnswerAssumption->handleArray.resize(theAttributeList.size()) ;
// Maximum size
- AnswerDivestiture.handleArray.resize(theListSize) ;
+ AnswerDivestiture.handleArray.resize(theAttributeList.size()) ;
CDiffusion diffusionAcquisition;
ObjectAttribute * oa ;
ObjectClassAttribute * oca ;
- for (int i = 0 ; i < theListSize ; i++) {
+ for (unsigned i = 0 ; i < theAttributeList.size() ; i++) {
oa = object->getAttribute(theAttributeList[i]);
if (oa->hasCandidates()) {
@@ -1080,7 +1045,7 @@
if (compteur_acquisition != 0) {
diffusionAcquisition.size = compteur_acquisition ;
- sendToOwners(&diffusionAcquisition, theObjectHandle,
+ sendToOwners(&diffusionAcquisition, object,
theFederateHandle, theTag,
NetworkMessage::ATTRIBUTE_OWNERSHIP_ACQUISITION_NOTIFICATION);
}
@@ -1088,7 +1053,7 @@
if (compteur_divestiture !=0) {
AnswerDivestiture.federation = server->federation();
AnswerDivestiture.federate = theFederateHandle ;
- AnswerDivestiture.object = theObjectHandle ;
+ AnswerDivestiture.object = object->getHandle();
AnswerDivestiture.setLabel(std::string());
AnswerDivestiture.handleArraySize = compteur_divestiture ;
@@ -1099,7 +1064,7 @@
AnswerAssumption->federation = server->federation();
AnswerAssumption->federate = theFederateHandle ;
AnswerAssumption->setException(e_NO_EXCEPTION) ;
- AnswerAssumption->object = theObjectHandle ;
+ AnswerAssumption->object = object->getHandle();
AnswerAssumption->setLabel(theTag);
AnswerAssumption->handleArraySize = compteur_assumption ;
@@ -1108,7 +1073,7 @@
D.Out(pdProtocol,
"Object %u divestiture in class %u, now broadcasting...",
- theObjectHandle, handle);
+ object->getHandle(), handle);
broadcastClassMessage(List);
}
else
@@ -1131,22 +1096,17 @@
//! attributeOwnershipAcquisitionIfAvailable.
void ObjectClass::
attributeOwnershipAcquisitionIfAvailable(FederateHandle the_federate,
- ObjectHandle the_object,
- std::vector <AttributeHandle>
&the_attributes,
- UShort theListSize)
- throw (ObjectNotKnown,
- ObjectClassNotPublished,
+ Object* object,
+ std::vector <AttributeHandle>
&the_attributes)
+ throw (ObjectClassNotPublished,
AttributeNotDefined,
AttributeNotPublished,
FederateOwnsAttributes,
AttributeAlreadyBeingAcquired,
RTIinternalError)
{
- //It may throw ObjectNotKnown.
- Object *object = getInstanceWithID(the_object);
-
// Do all attribute handles exist ? It may throw AttributeNotDefined.
- for (int index = 0 ; index < theListSize ; index++) {
+ for (unsigned index = 0 ; index < the_attributes.size() ; index++) {
getAttribute(the_attributes[index]);
}
@@ -1158,11 +1118,9 @@
}
//rem _handleClassAttributeMap.size()=attributeState.size()
- ObjectAttribute * oa ;
- ObjectClassAttribute * oca ;
- for (int i = 0 ; i < theListSize ; i++) {
- oca = getAttribute(the_attributes[i]);
- oa = object->getAttribute(the_attributes[i]);
+ for (unsigned i = 0 ; i < the_attributes.size() ; i++) {
+ ObjectClassAttribute * oca = getAttribute(the_attributes[i]);
+ ObjectAttribute * oa = object->getAttribute(the_attributes[i]);
// The federate has to publish attributes he desire to
// acquire.
@@ -1181,15 +1139,15 @@
Answer_notification->federation = server->federation();
Answer_notification->federate = the_federate ;
Answer_notification->setException(e_NO_EXCEPTION) ;
- Answer_notification->object = the_object ;
- Answer_notification->handleArray.resize(theListSize) ;
+ Answer_notification->object = object->getHandle();
+ Answer_notification->handleArray.resize(the_attributes.size()) ;
NetworkMessage *Answer_unavailable =
NM_Factory::create(NetworkMessage::ATTRIBUTE_OWNERSHIP_UNAVAILABLE) ;
Answer_unavailable->federation = server->federation();
Answer_unavailable->federate = the_federate ;
Answer_unavailable->setException(e_NO_EXCEPTION) ;
- Answer_unavailable->object = the_object ;
- Answer_unavailable->handleArray.resize(theListSize) ;
+ Answer_unavailable->object = object->getHandle();
+ Answer_unavailable->handleArray.resize(the_attributes.size()) ;
CDiffusion *diffusionDivestiture = new CDiffusion();
@@ -1202,9 +1160,9 @@
int compteur_divestiture = 0 ;
FederateHandle oldOwner ;
- for (int i = 0 ; i < theListSize ; i++) {
- oca = getAttribute(the_attributes[i]);
- oa = object->getAttribute(the_attributes[i]);
+ for (unsigned i = 0 ; i < the_attributes.size() ; i++) {
+ ObjectClassAttribute * oca = getAttribute(the_attributes[i]);
+ ObjectAttribute * oa = object->getAttribute(the_attributes[i]);
oldOwner = oa->getOwner();
if ((oldOwner == 0) || (oa->beingDivested())) {
@@ -1249,7 +1207,7 @@
if (compteur_divestiture != 0) {
diffusionDivestiture->size =compteur_divestiture ;
- sendToOwners(diffusionDivestiture, the_object,
+ sendToOwners(diffusionDivestiture, object,
the_federate, "\0",
NetworkMessage::ATTRIBUTE_OWNERSHIP_DIVESTITURE_NOTIFICATION);
}
@@ -1274,26 +1232,21 @@
//! unconditionalAttributeOwnershipDivestiture.
ObjectClassBroadcastList * ObjectClass::
unconditionalAttributeOwnershipDivestiture(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle>
&theAttributeList,
- UShort theListSize)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ Object* object,
+ std::vector <AttributeHandle>
&theAttributeList)
+ throw (AttributeNotDefined,
AttributeNotOwned,
RTIinternalError)
{
// Pre-conditions checking
- // may throw ObjectNotKnown
- Object *object = getInstanceWithID(theObjectHandle);
-
// Do all attribute handles exist ? It may throw AttributeNotDefined.
- for (int index = 0 ; index < theListSize ; index++)
+ for (unsigned index = 0 ; index < theAttributeList.size() ; index++)
getAttribute(theAttributeList[index]);
//Le federe est-il proprietaire de tous les attributs
ObjectAttribute * oa ;
- for (int i = 0 ; i < theListSize ; i++) {
+ for (unsigned i = 0 ; i < theAttributeList.size() ; i++) {
oa = object->getAttribute(theAttributeList[i]);
if (oa->getOwner() != theFederateHandle)
@@ -1308,15 +1261,13 @@
if (server != NULL) {
AnswerAssumption = new NM_Request_Attribute_Ownership_Assumption();
- AnswerAssumption->handleArraySize = theListSize ;
- AnswerAssumption->handleArray.resize(theListSize) ;
+ AnswerAssumption->handleArraySize = theAttributeList.size() ;
+ AnswerAssumption->handleArray.resize(theAttributeList.size()) ;
CDiffusion *diffusionAcquisition = new CDiffusion();
- ObjectAttribute * oa ;
- ObjectClassAttribute * oca ;
- for (int i = 0 ; i < theListSize ; i++) {
- oca = getAttribute(theAttributeList[i]);
- oa = object->getAttribute(theAttributeList[i]);
+ for (unsigned i = 0 ; i < theAttributeList.size() ; i++) {
+ ObjectClassAttribute * oca = getAttribute(theAttributeList[i]);
+ ObjectAttribute * oa = object->getAttribute(theAttributeList[i]);
if (oa->hasCandidates()) {
// An attributeOwnershipAcquisition is on the way
@@ -1356,7 +1307,7 @@
AnswerAssumption->federation = server->federation();
AnswerAssumption->federate = theFederateHandle ;
AnswerAssumption->setException(e_NO_EXCEPTION) ;
- AnswerAssumption->object = theObjectHandle ;
+ AnswerAssumption->object = object->getHandle() ;
AnswerAssumption->setLabel(std::string());
AnswerAssumption->handleArraySize = compteur_assumption ;
@@ -1365,7 +1316,7 @@
D.Out(pdProtocol,
"Object %u updated in class %u, now broadcasting...",
- theObjectHandle, handle);
+ object->getHandle(), handle);
broadcastClassMessage(List);
}
@@ -1374,7 +1325,7 @@
if (compteur_acquisition != 0) {
diffusionAcquisition->size =compteur_acquisition ;
- sendToOwners(diffusionAcquisition, theObjectHandle,
+ sendToOwners(diffusionAcquisition, object,
theFederateHandle, "\0",
NetworkMessage::ATTRIBUTE_OWNERSHIP_ACQUISITION_NOTIFICATION);
}
@@ -1396,12 +1347,10 @@
//! attributeOwnershipAcquisition.
void
ObjectClass::attributeOwnershipAcquisition(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
std::vector <AttributeHandle>
&theAttributeList,
- UShort theListSize,
const std::string& theTag)
- throw (ObjectNotKnown,
- ObjectClassNotPublished,
+ throw (ObjectClassNotPublished,
AttributeNotDefined,
AttributeNotPublished,
FederateOwnsAttributes,
@@ -1412,15 +1361,10 @@
// Pre-conditions checking
- // may throw ObjectNotKnown
- Object *object = getInstanceWithID(theObjectHandle);
-
- ObjectAttribute * oa ;
- ObjectClassAttribute * oca ;
- for (int i = 0 ; i < theListSize ; i++) {
+ for (unsigned i = 0 ; i < theAttributeList.size() ; i++) {
// Do all attribute handles exist ? It may throw AttributeNotDefined.
- oca = getAttribute(theAttributeList[i]);
- oa = object->getAttribute(theAttributeList[i]);
+ ObjectClassAttribute * oca = getAttribute(theAttributeList[i]);
+ ObjectAttribute * oa = object->getAttribute(theAttributeList[i]);
//Le f�d�r� est-il d�j� propri�taire de certains attributs
if (oa->getOwner() == theFederateHandle)
@@ -1447,18 +1391,16 @@
AnswerNotification->federation = server->federation();
AnswerNotification->federate = theFederateHandle ;
AnswerNotification->setException(e_NO_EXCEPTION) ;
- AnswerNotification->object = theObjectHandle ;
- AnswerNotification->handleArray.resize(theListSize) ;
+ AnswerNotification->object = object->getHandle() ;
+ AnswerNotification->handleArray.resize(theAttributeList.size()) ;
CDiffusion *diffusionDivestiture = new CDiffusion();
CDiffusion *diffusionRelease = new CDiffusion();
- ObjectAttribute * oa ;
- ObjectClassAttribute * oca ;
- for (int i = 0 ; i < theListSize ; i++) {
- oca = getAttribute(theAttributeList[i]);
- oa = object->getAttribute(theAttributeList[i]);
+ for (unsigned i = 0 ; i < theAttributeList.size() ; i++) {
+ ObjectClassAttribute * oca = getAttribute(theAttributeList[i]);
+ ObjectAttribute * oa = object->getAttribute(theAttributeList[i]);
oldOwner = oa->getOwner();
if ((oldOwner == 0) || (oa->beingDivested())) {
@@ -1507,7 +1449,7 @@
if (compteur_divestiture != 0) {
diffusionDivestiture->size =compteur_divestiture ;
- sendToOwners(diffusionDivestiture, theObjectHandle,
+ sendToOwners(diffusionDivestiture, object,
theFederateHandle, "\0",
NetworkMessage::ATTRIBUTE_OWNERSHIP_DIVESTITURE_NOTIFICATION);
}
@@ -1515,7 +1457,7 @@
if (compteur_release != 0) {
diffusionRelease->size =compteur_release ;
- sendToOwners(diffusionRelease, theObjectHandle, theFederateHandle,
+ sendToOwners(diffusionRelease, object, theFederateHandle,
theTag,
NetworkMessage::REQUEST_ATTRIBUTE_OWNERSHIP_RELEASE);
}
delete diffusionRelease ;
@@ -1534,30 +1476,24 @@
AttributeHandleSet *
ObjectClass::
attributeOwnershipReleaseResponse(FederateHandle the_federate,
- ObjectHandle the_object,
- std::vector <AttributeHandle>
&the_attributes,
- UShort the_size)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ Object* object,
+ std::vector <AttributeHandle>
&the_attributes)
+ throw (AttributeNotDefined,
AttributeNotOwned,
FederateWasNotAskedToReleaseAttribute,
RTIinternalError)
{
// Pre-conditions checking
- // may throw ObjectNotKnown
- Object *object = getInstanceWithID(the_object);
-
// Do all attribute handles exist ? It may throw AttributeNotDefined.
- for (int index = 0 ; index < the_size ; index++) {
+ for (unsigned index = 0 ; index < the_attributes.size() ; index++) {
getAttribute(the_attributes[index]);
}
//Le f�d�r� est-il propri�taire de tous les attributs
//Y a-t-il des acqu�reurs pour les attributs
- ObjectAttribute * oa ;
- for (int i = 0 ; i < the_size ; i++) {
- oa = object->getAttribute(the_attributes[i]);
+ for (unsigned i = 0 ; i < the_attributes.size() ; i++) {
+ ObjectAttribute * oa = object->getAttribute(the_attributes[i]);
if (oa->getOwner() != the_federate) {
throw AttributeNotOwned("");
@@ -1573,12 +1509,11 @@
if (server != NULL) {
CDiffusion *diffusionAcquisition = new CDiffusion();
- theAttribute = new AttributeHandleSet(the_size);
+ theAttribute = new AttributeHandleSet(the_attributes.size());
- ObjectClassAttribute * oca ;
- for (int i = 0 ; i < the_size ; i++) {
- oca = getAttribute(the_attributes[i]);
- oa = object->getAttribute(the_attributes[i]);
+ for (unsigned i = 0 ; i < the_attributes.size() ; i++) {
+ ObjectClassAttribute * oca = getAttribute(the_attributes[i]);
+ ObjectAttribute* oa = object->getAttribute(the_attributes[i]);
//Le demandeur le plus r�cent devient propri�taire
newOwner = oa->getFirstCandidate();
@@ -1606,7 +1541,7 @@
if (compteur_acquisition != 0) {
diffusionAcquisition->size =compteur_acquisition ;
- sendToOwners(diffusionAcquisition, the_object, the_federate, "\0",
+ sendToOwners(diffusionAcquisition, object, the_federate, "\0",
NetworkMessage::ATTRIBUTE_OWNERSHIP_ACQUISITION_NOTIFICATION);
}
delete diffusionAcquisition ;
@@ -1626,36 +1561,28 @@
void
ObjectClass::
cancelAttributeOwnershipAcquisition(FederateHandle federate_handle,
- ObjectHandle object_handle,
- std::vector <AttributeHandle>
&attribute_list,
- UShort list_size)
- throw (ObjectNotKnown,
- AttributeNotDefined,
+ Object* object,
+ std::vector <AttributeHandle>
&attribute_list)
+ throw (AttributeNotDefined,
AttributeAlreadyOwned,
AttributeAcquisitionWasNotRequested,
RTIinternalError)
{
// Pre-conditions checking
- //It may throw ObjectNotKnown.
- Object *object = getInstanceWithID(object_handle);
-
// Do all attribute handles exist ? It may throw AttributeNotDefined.
- for (int index = 0 ; index < list_size ; index++)
+ for (unsigned index = 0 ; index < attribute_list.size() ; index++)
getAttribute(attribute_list[index]);
- for (int i = 0 ; i < list_size ; i++)
+ for (unsigned i = 0 ; i < attribute_list.size(); i++)
D.Out(pdDebug, "CancelAcquisition Object %u Attribute %u ",
- object_handle, attribute_list[i]);
+ object->getHandle(), attribute_list[i]);
if (server != NULL) {
//rem _handleClassAttributeMap.size()=attributeState.size()
- ObjectAttribute * oa ;
- ObjectClassAttribute * oca ;
- for (int i = 0 ; i < list_size ; i++) {
- oca = getAttribute(attribute_list[i]);
- oa = object->getAttribute(attribute_list[i]);
+ for (unsigned i = 0 ; i < attribute_list.size() ; i++) {
+ ObjectAttribute * oa = object->getAttribute(attribute_list[i]);
D.Out(pdDebug, "Attribut %u Owner %u", attribute_list[i],
oa->getOwner());
// Does federate is already owning some attributes ?
@@ -1670,19 +1597,19 @@
answer_confirmation->federation = server->federation();
answer_confirmation->federate = federate_handle ;
answer_confirmation->setException(e_NO_EXCEPTION) ;
- answer_confirmation->object = object_handle ;
- answer_confirmation->handleArray.resize(list_size) ;
+ answer_confirmation->object = object->getHandle() ;
+ answer_confirmation->handleArray.resize(attribute_list.size()) ;
int compteur_confirmation = 0 ;
- for (int i = 0 ; i < list_size ; i++) {
- oa = object->getAttribute(attribute_list[i]);
+ for (unsigned i = 0 ; i < attribute_list.size(); i++) {
+ ObjectAttribute * oa = object->getAttribute(attribute_list[i]);
answer_confirmation->handleArray[compteur_confirmation] =
attribute_list[i] ;
// We remove federate from candidates.
oa->removeCandidate(federate_handle);
D.Out(pdDebug, "Adding federate %u to attribute %u object %u",
- federate_handle, attribute_list[i], object_handle);
+ federate_handle, attribute_list[i], object->getHandle());
compteur_confirmation++ ;
}
@@ -1798,4 +1725,4 @@
} // namespace certi
-// $Id: ObjectClass.cc,v 3.73 2009/11/21 21:18:28 erk Exp $
+// $Id: ObjectClass.cc,v 3.74 2009/11/23 07:34:28 erk Exp $
Index: libCERTI/ObjectClass.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.hh,v
retrieving revision 3.49
retrieving revision 3.50
diff -u -b -r3.49 -r3.50
--- libCERTI/ObjectClass.hh 21 Nov 2009 21:18:28 -0000 3.49
+++ libCERTI/ObjectClass.hh 23 Nov 2009 07:34:28 -0000 3.50
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClass.hh,v 3.49 2009/11/21 21:18:28 erk Exp $
+// $Id: ObjectClass.hh,v 3.50 2009/11/23 07:34:28 erk Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_OBJECT_CLASS_HH
@@ -164,53 +164,47 @@
// Ownership Management
ObjectClassBroadcastList *
negotiatedAttributeOwnershipDivestiture(FederateHandle
theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
std::vector <AttributeHandle> &theAttributeList,
- UShort theListSize,
const std::string& theTag)
- throw (ObjectNotKnown, AttributeNotDefined,
AttributeNotOwned,
+ throw (AttributeNotDefined, AttributeNotOwned,
AttributeAlreadyBeingDivested,
RTIinternalError);
void
attributeOwnershipAcquisitionIfAvailable(FederateHandle
theFederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle> &theAttributeList,
- UShort theListSize)
- throw (ObjectNotKnown, ObjectClassNotPublished, AttributeNotDefined,
+ Object* object,
+ std::vector <AttributeHandle> &theAttributeList)
+ throw (ObjectClassNotPublished, AttributeNotDefined,
AttributeNotPublished, FederateOwnsAttributes,
AttributeAlreadyBeingAcquired, RTIinternalError);
ObjectClassBroadcastList *
unconditionalAttributeOwnershipDivestiture(FederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle> &,
- UShort theListSize)
- throw (ObjectNotKnown, AttributeNotDefined,
AttributeNotOwned,
+ Object* object,
+ std::vector <AttributeHandle> &)
+ throw (AttributeNotDefined, AttributeNotOwned,
RTIinternalError);
void
attributeOwnershipAcquisition(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
std::vector <AttributeHandle> &theAttributeList,
- UShort theListSize,
const std::string& theTag)
- throw (ObjectNotKnown, ObjectClassNotPublished, AttributeNotDefined,
+ throw (ObjectClassNotPublished, AttributeNotDefined,
AttributeNotPublished, FederateOwnsAttributes,
RTIinternalError);
AttributeHandleSet *
attributeOwnershipReleaseResponse(FederateHandle theFederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle> &theAttributeList,
- UShort theListSize)
- throw (ObjectNotKnown, AttributeNotDefined,
AttributeNotOwned,
+ Object* object,
+ std::vector <AttributeHandle> &theAttributeList)
+ throw (AttributeNotDefined, AttributeNotOwned,
FederateWasNotAskedToReleaseAttribute,
RTIinternalError);
void cancelAttributeOwnershipAcquisition(FederateHandle
theFederateHandle,
- ObjectHandle theObjectHandle,
- std::vector <AttributeHandle> &theAttributeList,
- UShort theListSize)
- throw (ObjectNotKnown, AttributeNotDefined, AttributeAlreadyOwned,
+ Object* object,
+ std::vector <AttributeHandle> &theAttributeList)
+ throw (AttributeNotDefined, AttributeAlreadyOwned,
AttributeAcquisitionWasNotRequested, RTIinternalError);
// RTI Support Services
@@ -230,15 +224,15 @@
// Instance Management
ObjectClassBroadcastList *deleteInstance(FederateHandle
theFederateHandle,
- ObjectHandle theObjectHandle,
- FederationTime theTime,
+ Object* object,
+ const FederationTime& theTime,
const std::string& theUserTag)
throw (DeletePrivilegeNotHeld,
ObjectNotKnown,
RTIinternalError);
ObjectClassBroadcastList *deleteInstance(FederateHandle
theFederateHandle,
- ObjectHandle theObjectHandle,
+ Object* object,
const std::string& theUserTag)
throw (DeletePrivilegeNotHeld,
ObjectNotKnown,
@@ -257,21 +251,18 @@
ObjectClassBroadcastList *
updateAttributeValues(FederateHandle, Object *, std::vector
<AttributeHandle> &,
std::vector <AttributeValue_t> &, int, FederationTime,
const std::string&)
- throw (ObjectNotKnown, AttributeNotDefined,
AttributeNotOwned,
+ throw (AttributeNotDefined, AttributeNotOwned,
RTIinternalError, InvalidObjectHandle);
ObjectClassBroadcastList *
updateAttributeValues(FederateHandle, Object *, std::vector
<AttributeHandle> &,
std::vector <AttributeValue_t> &, int, const
std::string&)
- throw (ObjectNotKnown, AttributeNotDefined,
AttributeNotOwned,
+ throw (AttributeNotDefined, AttributeNotOwned,
RTIinternalError, InvalidObjectHandle);
void recursiveDiscovering(FederateHandle, ObjectClassHandle)
throw (ObjectClassNotDefined);
- Object *getInstanceWithID(ObjectHandle the_id) const
- throw (ObjectNotKnown);
-
/**
* Getter for the attribute list of the object class.
* param[out] AttributeList_t @see ObjectClass::AttributeList_t
@@ -294,7 +285,7 @@
void sendToFederate(NetworkMessage *msg, FederateHandle theFederate);
void sendToOwners(CDiffusion *diffusionList,
- ObjectHandle theObjectHandle,
+ Object* object,
FederateHandle theFederate,
const std::string& theTag,
NetworkMessage::Type type);
@@ -351,4 +342,4 @@
#endif // _CERTI_OBJECT_CLASS_HH
-// $Id: ObjectClass.hh,v 3.49 2009/11/21 21:18:28 erk Exp $
+// $Id: ObjectClass.hh,v 3.50 2009/11/23 07:34:28 erk Exp $
Index: libCERTI/RootObject.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/RootObject.cc,v
retrieving revision 3.46
retrieving revision 3.47
diff -u -b -r3.46 -r3.47
--- libCERTI/RootObject.cc 21 Nov 2009 15:13:08 -0000 3.46
+++ libCERTI/RootObject.cc 23 Nov 2009 07:34:28 -0000 3.47
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RootObject.cc,v 3.46 2009/11/21 15:13:08 erk Exp $
+// $Id: RootObject.cc,v 3.47 2009/11/23 07:34:28 erk Exp $
// ----------------------------------------------------------------------------
#include "Object.hh"
@@ -263,24 +263,26 @@
// ----------------------------------------------------------------------------
void
RootObject::deleteObjectInstance(FederateHandle the_federate,
- ObjectHandle the_object,
+ ObjectHandle objectHandle,
FederationTime theTime,
const std::string& the_tag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError)
{
- ObjectClasses->deleteObject(the_federate, the_object, theTime, the_tag);
- objects->deleteObjectInstance(the_federate, the_object, the_tag);
+ Object *object = objects->getObject(objectHandle);
+ ObjectClasses->deleteObject(the_federate, object, theTime, the_tag);
+ objects->deleteObjectInstance(the_federate, objectHandle, the_tag);
}
// ----------------------------------------------------------------------------
void
RootObject::deleteObjectInstance(FederateHandle the_federate,
- ObjectHandle the_object,
+ ObjectHandle objectHandle,
const std::string& the_tag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError)
{
- ObjectClasses->deleteObject(the_federate, the_object, the_tag);
- objects->deleteObjectInstance(the_federate, the_object, the_tag);
+ Object *object = objects->getObject(objectHandle);
+ ObjectClasses->deleteObject(the_federate, object, the_tag);
+ objects->deleteObjectInstance(the_federate, objectHandle, the_tag);
}
// ----------------------------------------------------------------------------
@@ -557,4 +559,4 @@
} // namespace certi
-// $Id: RootObject.cc,v 3.46 2009/11/21 15:13:08 erk Exp $
+// $Id: RootObject.cc,v 3.47 2009/11/23 07:34:28 erk Exp $
Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.117
retrieving revision 3.118
diff -u -b -r3.117 -r3.118
--- RTIG/Federation.cc 21 Nov 2009 14:46:17 -0000 3.117
+++ RTIG/Federation.cc 23 Nov 2009 07:34:28 -0000 3.118
@@ -18,7 +18,7 @@
// along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: Federation.cc,v 3.117 2009/11/21 14:46:17 erk Exp $
+// $Id: Federation.cc,v 3.118 2009/11/23 07:34:28 erk Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -1910,7 +1910,7 @@
void
Federation::updateAttributeValues(FederateHandle federate,
- ObjectHandle id,
+ ObjectHandle objectHandle,
std::vector <AttributeHandle> &attributes,
std::vector <AttributeValue_t> &values,
UShort list_size,
@@ -1928,13 +1928,15 @@
// It may throw FederateNotExecutionMember.
this->check(federate);
+ // Get the object pointer by id from the root object
+ Object *object = root->objects->getObject(objectHandle);
+
// It may throw *NotDefined
- root->ObjectClasses->updateAttributeValues(federate, id, attributes,
values,
- list_size, time, tag);
+ root->ObjectClasses->updateAttributeValues(federate, object, attributes,
values, time, tag);
D.Out(pdRegister,
"Federation %d: Federate %d updated attributes of Object %d.",
- handle, federate, id);
+ handle, federate, objectHandle);
G.Out(pdGendoc,"exit Federation::updateAttributeValues with time");
}
@@ -1943,7 +1945,7 @@
void
Federation::updateAttributeValues(FederateHandle federate,
- ObjectHandle id,
+ ObjectHandle objectHandle,
std::vector <AttributeHandle> &attributes,
std::vector <AttributeValue_t> &values,
UShort list_size,
@@ -1960,13 +1962,15 @@
// It may throw FederateNotExecutionMember.
this->check(federate);
+ // Get the object pointer by id from the root object
+ Object *object = root->objects->getObject(objectHandle);
+
// It may throw *NotDefined
- root->ObjectClasses->updateAttributeValues(federate, id, attributes,
values,
- list_size, tag);
+ root->ObjectClasses->updateAttributeValues(federate, object, attributes,
values, tag);
D.Out(pdRegister,
"Federation %d: Federate %d updated attributes of Object %d.",
- handle, federate, id);
+ handle, federate, objectHandle);
G.Out(pdGendoc,"exit Federation::updateAttributeValues without time");
}
// ----------------------------------------------------------------------------
@@ -2048,7 +2052,7 @@
void
Federation::negotiateDivestiture(FederateHandle federate,
- ObjectHandle id,
+ ObjectHandle objectHandle,
std::vector <AttributeHandle> &attribs,
UShort list_size,
const std::string& tag)
@@ -2064,12 +2068,11 @@
// It may throw FederateNotExecutionMember.
this->check(federate);
+ // Get the object pointer by id from the root object
+ Object *object = root->objects->getObject(objectHandle);
+
// It may throw *NotDefined
- root->ObjectClasses->negotiatedAttributeOwnershipDivestiture(federate,
- id,
- attribs,
- list_size,
- tag);
+ root->ObjectClasses->negotiatedAttributeOwnershipDivestiture(federate,
object, attribs, tag);
}
// ----------------------------------------------------------------------------
@@ -2077,7 +2080,7 @@
void
Federation::acquireIfAvailable(FederateHandle federate,
- ObjectHandle id,
+ ObjectHandle objectHandle,
std::vector <AttributeHandle> &attribs,
UShort list_size)
throw (ObjectNotKnown,
@@ -2094,11 +2097,11 @@
// It may throw FederateNotExecutionMember.
this->check(federate);
+ // Get the object pointer by id from the root object
+ Object *object = root->objects->getObject(objectHandle);
+
// It may throw *NotDefined
- root->ObjectClasses->attributeOwnershipAcquisitionIfAvailable(federate,
- id,
- attribs,
- list_size);
+ root->ObjectClasses->attributeOwnershipAcquisitionIfAvailable(federate,
object, attribs);
}
// ----------------------------------------------------------------------------
@@ -2106,7 +2109,7 @@
void
Federation::divest(FederateHandle federate,
- ObjectHandle id,
+ ObjectHandle objectHandle,
std::vector <AttributeHandle> &attrs,
UShort list_size)
throw (ObjectNotKnown,
@@ -2120,11 +2123,11 @@
// It may throw FederateNotExecutionMember.
this->check(federate);
+ // Get the object pointer by id from the root object
+ Object *object = root->objects->getObject(objectHandle);
+
// It may throw *NotDefined
- root->ObjectClasses->unconditionalAttributeOwnershipDivestiture(federate,
- id,
- attrs,
- list_size);
+ root->ObjectClasses->unconditionalAttributeOwnershipDivestiture(federate,
object, attrs);
}
// ----------------------------------------------------------------------------
@@ -2132,7 +2135,7 @@
void
Federation::acquire(FederateHandle federate,
- ObjectHandle id,
+ ObjectHandle objectHandle,
std::vector <AttributeHandle> &attributes,
UShort list_size,
const std::string& tag)
@@ -2149,14 +2152,13 @@
// It may throw FederateNotExecutionMember.
this->check(federate);
+ // Get the object pointer by id from the root object
+ Object *object = root->objects->getObject(objectHandle);
+
// It may throw *NotDefined
- root->ObjectClasses->attributeOwnershipAcquisition(federate,
- id,
- attributes,
- list_size,
- tag);
+ root->ObjectClasses->attributeOwnershipAcquisition(federate, object,
attributes, tag);
- D.Out(pdDebug, "Acquisition on Object %u ", id);
+ D.Out(pdDebug, "Acquisition on Object %u ", objectHandle);
}
// ----------------------------------------------------------------------------
@@ -2193,7 +2195,7 @@
AttributeHandleSet*
Federation::respondRelease(FederateHandle federate,
- ObjectHandle id,
+ ObjectHandle objectHandle,
std::vector <AttributeHandle> &attributes,
UShort list_size)
throw (ObjectNotKnown,
@@ -2208,13 +2210,13 @@
// It may throw FederateNotExecutionMember.
this->check(federate);
- D.Out(pdDebug, "RespondRelease on Object %u.", id);
+ D.Out(pdDebug, "RespondRelease on Object %u.", objectHandle);
+
+ // Get the object pointer by id from the root object
+ Object *object = root->objects->getObject(objectHandle);
// It may throw *NotDefined
- return(root->ObjectClasses->attributeOwnershipReleaseResponse(federate,
- id,
- attributes,
- list_size));
+ return root->ObjectClasses->attributeOwnershipReleaseResponse(federate,
object, attributes);
}
// ----------------------------------------------------------------------------
@@ -2222,7 +2224,7 @@
void
Federation::cancelAcquisition(FederateHandle federate,
- ObjectHandle id,
+ ObjectHandle objectHandle,
std::vector <AttributeHandle> &attributes,
UShort list_size)
throw (ObjectNotKnown,
@@ -2237,13 +2239,13 @@
// It may throw FederateNotExecutionMember.
this->check(federate);
- D.Out(pdDebug, "CancelAcquisition sur Objet %u ", id);
+ D.Out(pdDebug, "CancelAcquisition sur Objet %u ", objectHandle);
+
+ // Get the object pointer by id from the root object
+ Object *object = root->objects->getObject(objectHandle);
// It may throw *NotDefined
- root->ObjectClasses->cancelAttributeOwnershipAcquisition(federate,
- id,
- attributes,
- list_size);
+ root->ObjectClasses->cancelAttributeOwnershipAcquisition(federate, object,
attributes);
}
// ----------------------------------------------------------------------------
@@ -2608,5 +2610,5 @@
}} // namespace certi/rtig
-// $Id: Federation.cc,v 3.117 2009/11/21 14:46:17 erk Exp $
+// $Id: Federation.cc,v 3.118 2009/11/23 07:34:28 erk Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi libCERTI/ObjectClassSet.hh libCERTI/Objec...,
certi-cvs <=