[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi RTIA/Communications.cc RTIA/Communication...
From: |
certi-cvs |
Subject: |
[certi-cvs] certi RTIA/Communications.cc RTIA/Communication... |
Date: |
Thu, 29 May 2008 12:20:41 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: ROUSSELOT <rousse> 08/05/29 12:20:40
Modified files:
RTIA : Communications.cc Communications.hh
FederationManagement.cc FederationManagement.hh
ObjectManagement.cc ObjectManagement.hh
OwnershipManagement.cc OwnershipManagement.hh
RTIA.cc RTIA_federate.cc
RTIG : Federation.cc RTIG.cc RTIG_processing.cc
include : certi.hh
libCERTI : BasicMessage.cc BasicMessage.hh Message.cc
Message.hh MessageBody.cc MessageBody.hh
Message_R.cc Message_W.cc ObjectClass.cc
ObjectClass.hh ObjectClassSet.cc
ObjectClassSet.hh ObjectSet.cc ObjectSet.hh
RootObject.cc RootObject.hh
libRTI : RTIambPrivateRefs.cc RTIambPrivateRefs.hh
RTIambassador.cc
Log message:
#bug 23329 and others, correction (beginning)
BUFFER_SIZE_DEFAULT,MAX_FEDERATE_NAME_LENGTH,MAX_PARAMETERS_CLASS
suppressed
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/Communications.cc?cvsroot=certi&r1=3.26&r2=3.27
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/Communications.hh?cvsroot=certi&r1=3.12&r2=3.13
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/FederationManagement.cc?cvsroot=certi&r1=3.62&r2=3.63
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/FederationManagement.hh?cvsroot=certi&r1=3.22&r2=3.23
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/ObjectManagement.cc?cvsroot=certi&r1=3.45&r2=3.46
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/ObjectManagement.hh?cvsroot=certi&r1=3.20&r2=3.21
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/OwnershipManagement.cc?cvsroot=certi&r1=3.13&r2=3.14
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/OwnershipManagement.hh?cvsroot=certi&r1=3.6&r2=3.7
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA.cc?cvsroot=certi&r1=3.20&r2=3.21
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA_federate.cc?cvsroot=certi&r1=3.79&r2=3.80
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.86&r2=3.87
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG.cc?cvsroot=certi&r1=3.43&r2=3.44
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG_processing.cc?cvsroot=certi&r1=3.70&r2=3.71
http://cvs.savannah.gnu.org/viewcvs/certi/include/certi.hh?cvsroot=certi&r1=3.27&r2=3.28
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/BasicMessage.cc?cvsroot=certi&r1=3.11&r2=3.12
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/BasicMessage.hh?cvsroot=certi&r1=3.9&r2=3.10
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message.cc?cvsroot=certi&r1=3.52&r2=3.53
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message.hh?cvsroot=certi&r1=3.44&r2=3.45
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/MessageBody.cc?cvsroot=certi&r1=3.17&r2=3.18
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/MessageBody.hh?cvsroot=certi&r1=3.15&r2=3.16
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message_R.cc?cvsroot=certi&r1=3.23&r2=3.24
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message_W.cc?cvsroot=certi&r1=3.27&r2=3.28
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.cc?cvsroot=certi&r1=3.44&r2=3.45
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClass.hh?cvsroot=certi&r1=3.32&r2=3.33
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClassSet.cc?cvsroot=certi&r1=3.34&r2=3.35
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectClassSet.hh?cvsroot=certi&r1=3.26&r2=3.27
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectSet.cc?cvsroot=certi&r1=3.19&r2=3.20
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ObjectSet.hh?cvsroot=certi&r1=3.10&r2=3.11
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/RootObject.cc?cvsroot=certi&r1=3.32&r2=3.33
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/RootObject.hh?cvsroot=certi&r1=3.27&r2=3.28
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambPrivateRefs.cc?cvsroot=certi&r1=3.12&r2=3.13
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambPrivateRefs.hh?cvsroot=certi&r1=3.4&r2=3.5
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambassador.cc?cvsroot=certi&r1=3.81&r2=3.82
Patches:
Index: RTIA/Communications.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/Communications.cc,v
retrieving revision 3.26
retrieving revision 3.27
diff -u -b -r3.26 -r3.27
--- RTIA/Communications.cc 5 May 2008 09:47:21 -0000 3.26
+++ RTIA/Communications.cc 29 May 2008 12:20:32 -0000 3.27
@@ -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: Communications.cc,v 3.26 2008/05/05 09:47:21 erk Exp $
+// $Id: Communications.cc,v 3.27 2008/05/29 12:20:32 rousse Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -227,7 +227,7 @@
// Datas are in UNIX waiting buffer.
// Read a message from federate UNIX link.
(*msg) = new Message();
- (*msg)->read((SocketUN *) this);
+ (*msg)->receive((SocketUN *) this,msgBufReceive);
n = 2 ;
}
else {
@@ -327,16 +327,16 @@
void
Communications::sendUN(Message *Msg)
{
- Msg->write((SocketUN *) this);
+ Msg->send((SocketUN *) this,msgBufSend);
}
// ----------------------------------------------------------------------------
void
Communications::receiveUN(Message *Msg)
{
- Msg->read((SocketUN *) this);
+ Msg->receive((SocketUN *) this,msgBufReceive);
}
}} // namespace certi/rtia
-// $Id: Communications.cc,v 3.26 2008/05/05 09:47:21 erk Exp $
+// $Id: Communications.cc,v 3.27 2008/05/29 12:20:32 rousse Exp $
Index: RTIA/Communications.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/Communications.hh,v
retrieving revision 3.12
retrieving revision 3.13
diff -u -b -r3.12 -r3.13
--- RTIA/Communications.hh 26 Apr 2008 14:59:41 -0000 3.12
+++ RTIA/Communications.hh 29 May 2008 12:20:32 -0000 3.13
@@ -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: Communications.hh,v 3.12 2008/04/26 14:59:41 erk Exp $
+// $Id: Communications.hh,v 3.13 2008/05/29 12:20:32 rousse Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_COMMUNICATIONS_HH
@@ -67,6 +67,7 @@
*/
NetworkMessage* waitMessage(NetworkMessage::Type type_msg,
FederateHandle numeroFedere);
+ MessageBuffer msgBufSend, msgBufReceive ;
private:
/**
@@ -85,4 +86,4 @@
#endif // _CERTI_COMMUNICATIONS_HH
-// $Id: Communications.hh,v 3.12 2008/04/26 14:59:41 erk Exp $
+// $Id: Communications.hh,v 3.13 2008/05/29 12:20:32 rousse Exp $
Index: RTIA/FederationManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/FederationManagement.cc,v
retrieving revision 3.62
retrieving revision 3.63
diff -u -b -r3.62 -r3.63
--- RTIA/FederationManagement.cc 22 May 2008 12:20:22 -0000 3.62
+++ RTIA/FederationManagement.cc 29 May 2008 12:20:33 -0000 3.63
@@ -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: FederationManagement.cc,v 3.62 2008/05/22 12:20:22 erk Exp $
+// $Id: FederationManagement.cc,v 3.63 2008/05/29 12:20:33 rousse Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -69,7 +69,7 @@
_nom_federation = "";
_nom_federe = "";
- _FEDid = NULL;
+ //_FEDid = NULL;is now a string then...
G.Out(pdGendoc,"exit FederationManagement::FederationManagement");
}
@@ -100,7 +100,7 @@
cout << "RTIA: Federation destroyed" << endl ;
//}
- delete[] _FEDid ;
+ //delete[] _FEDid ;
G.Out(pdGendoc,"exit ~FederationManagement");
}
@@ -108,7 +108,7 @@
//! createFederationExecution.
void
FederationManagement::
-createFederationExecution(const char *theName,
+createFederationExecution(std::string theName,
TypeException &e)
throw ( FederationExecutionAlreadyExists,
CouldNotOpenFED,ErrorReadingFED,
@@ -117,7 +117,7 @@
NM_Create_Federation_Execution requete;
G.Out(pdGendoc,"enter FederationManagement::createFederationExecution");
- D.Out(pdInit, "Creating Federation %s.", theName);
+ D.Out(pdInit, "Creating Federation %s.", theName.c_str());
e = e_NO_EXCEPTION ;
@@ -190,12 +190,12 @@
//! destroyFederationExecution.
void
FederationManagement::
-destroyFederationExecution(const char *theName,
+destroyFederationExecution(std::string theName,
TypeException &e)
{
NM_Destroy_Federation_Execution requete ;
- D.Out(pdInit, "Destroy Federation %s.", theName);
+ D.Out(pdInit, "Destroy Federation %s.", theName.c_str());
G.Out(pdGendoc,"enter FederationManagement::destroyFederationExecution");
e = e_NO_EXCEPTION ;
@@ -223,7 +223,7 @@
_numero_federation = 0 ;
_fin_execution = true ;
// Now, remove temporary file (if not yet done)
- if ( _FEDid != NULL )
+ if ( _FEDid.c_str() != NULL )
{
if ( _FEDid[0] != '\0' )
{
@@ -232,7 +232,7 @@
if ( _FEDid[0] == '_' || _FEDid[1] == 'R' || _FEDid[2] ==
'T')
{
std::cout<<"Removing temporary file "<<_FEDid<<" on
destroy federation."<<std::endl;
- std::remove(_FEDid);
+ std::remove(_FEDid.c_str());
_FEDid[0] = '\0' ;
}
else
@@ -256,18 +256,18 @@
//! joinFederationExecution.
FederateHandle
FederationManagement::
-joinFederationExecution(const char *Federate,
- const char *Federation,
+joinFederationExecution(std::string Federate,
+ std::string Federation,
TypeException &e)
{
NM_Join_Federation_Execution requete;
NM_Get_FED_File requeteFED;
int i, nb ;
- char* filename ; // Needed for working file name
+ string filename ; // Needed for working file name
G.Out(pdGendoc,"enter FederationManagement::joinFederationExecution");
- D.Out(pdInit, "Join Federation %s as %s.", Federation, Federate);
+ D.Out(pdInit, "Join Federation %s as %s.", Federation.c_str(),
Federate.c_str());
e = e_NO_EXCEPTION ;
@@ -309,10 +309,10 @@
char pid_name[10];
sprintf(pid_name,"%d_",getpid());
- filename = new char[6+strlen(pid_name)+strlen(Federation)+4+1] ;
- strcpy(filename,"_RTIA_");
- strcat(filename,pid_name);
- strcat(filename,Federation);
+ //filename = new char[6+strlen(pid_name)+strlen(Federation)+4+1] ;
+ filename += "_RTIA_";
+ filename += pid_name ;
+ filename += Federation ;
// Last file type : fed or xml ?
string filename_RTIG = reponse->FEDid ;
@@ -320,19 +320,18 @@
string extension = filename_RTIG.substr(nbcar_filename_RTIG-3,3) ;
if ( !strcasecmp(extension.c_str(),"fed") )
{
- strcat(filename,".fed");
+ filename += ".fed";
}
else if ( !strcasecmp(extension.c_str(),"xml") )
{
- strcat(filename,".xml");
+ filename += ".xml";
}
else
throw CouldNotOpenFED("nor .fed nor .xml");
// FED filename for working must be stored
- _FEDid = new char[strlen(filename)+1] ;
- strcpy(_FEDid,filename) ;
+ _FEDid = filename ;
// RTIA opens working file
- std::ofstream fedWorkFile(filename);
+ std::ofstream fedWorkFile(filename.c_str());
if ( !fedWorkFile.is_open()) {
throw RTIinternalError("FED file has vanished.") ;
}
@@ -456,12 +455,12 @@
_numero_federation = 0 ;
federate = 0 ;
// Now, remove temporary file (if not yet done)
- if ( _FEDid != NULL)
+ if ( _FEDid.c_str() != NULL)
{
if ( _FEDid[0] != '\0' )
{
std::cout<<"Removing temporary file "<<_FEDid<<" on resign
federation."<<std::endl;
- std::remove(_FEDid);
+ std::remove(_FEDid.c_str());
_FEDid[0] = '\0' ;
}
}
@@ -476,21 +475,21 @@
// ----------------------------------------------------------------------------
//! Register synchronization.
void
-FederationManagement::registerSynchronization(const char *label,
- const char *tag,
+FederationManagement::registerSynchronization(std::string label,
+ std::string tag,
TypeException &e)
{
D.Out(pdProtocol, "RegisterSynchronization.");
G.Out(pdGendoc,"enter FederationManagement::registerSynchronization");
- assert(label != NULL);
+ //assert(label != NULL);
e = e_NO_EXCEPTION ;
list<char *>::const_iterator i = synchronizationLabels.begin();
bool exists = false ;
for (; i != synchronizationLabels.end(); i++) {
- if (!strcmp((*i), label)) {
+ if (!strcmp((*i), label.c_str())) {
e = e_FederationAlreadyPaused ; // Label already pending.
exists = true ;
break ;
@@ -498,7 +497,7 @@
}
if (!exists)
- synchronizationLabels.push_back(strdup(label));
+ synchronizationLabels.push_back(strdup(label.c_str()));
if (!_est_membre_federation)
e = e_FederateNotExecutionMember ;
@@ -524,8 +523,8 @@
// ----------------------------------------------------------------------------
//! Register synchronization with set of federates
void
-FederationManagement::registerSynchronization(const char *label,
- const char *tag,
+FederationManagement::registerSynchronization(std::string label,
+ std::string tag,
unsigned short array_size,
FederateHandle *fed_array,
TypeException &e)
@@ -533,14 +532,14 @@
D.Out(pdProtocol, "RegisterSynchronization.");
G.Out(pdGendoc,"enter FederationManagement::registerSynchronization with
federate set");
- assert(label != NULL);
+ //assert(label != NULL);
e = e_NO_EXCEPTION ;
list<char *>::const_iterator i = synchronizationLabels.begin();
bool exists = false ;
for (; i != synchronizationLabels.end(); i++) {
- if (!strcmp((*i), label)) {
+ if (!strcmp((*i), label.c_str())) {
e = e_FederationAlreadyPaused ; // Label already pending.
exists = true ;
break ;
@@ -548,7 +547,7 @@
}
if (!exists)
- synchronizationLabels.push_back(strdup(label));
+ synchronizationLabels.push_back(strdup(label.c_str()));
if (!_est_membre_federation)
e = e_FederateNotExecutionMember ;
@@ -576,12 +575,12 @@
// ----------------------------------------------------------------------------
//! Unregister synchronization.
void
-FederationManagement::unregisterSynchronization(const char *label,
+FederationManagement::unregisterSynchronization(std::string label,
TypeException &e)
{
D.Out(pdProtocol, "unregisterSynchronization.");
- assert(label != NULL);
+ //assert(label != NULL);
e = e_NO_EXCEPTION ;
@@ -589,7 +588,7 @@
list<char *>::iterator i = synchronizationLabels.begin();
bool exists = false ;
for (; i != synchronizationLabels.end(); ++i) {
- if (!strcmp((*i), label)) {
+ if (!strcmp((*i), label.c_str())) {
// Label already pending.
exists = true ;
break ;
@@ -714,15 +713,15 @@
// ----------------------------------------------------------------------------
// requestFederationSave with time
void
-FederationManagement::requestFederationSave(const char *label,
+FederationManagement::requestFederationSave(std::string label,
FederationTime the_time,
TypeException &e)
{
- D.Out(pdInit, "Request for federation save \"%s\".", label);
+ D.Out(pdInit, "Request for federation save \"%s\".", label.c_str());
G.Out(pdGendoc,"enter FederationManagement::requestFederationSave "
"with time");
- assert(label != 0);
+ //assert(label != 0);
NM_Request_Federation_Save req ;
@@ -744,14 +743,14 @@
// ----------------------------------------------------------------------------
// requestFederationSave without time
void
-FederationManagement::requestFederationSave(const char *label,
+FederationManagement::requestFederationSave(std::string label,
TypeException &e)
{
- D.Out(pdInit, "Request for federation save \"%s\".", label);
+ D.Out(pdInit, "Request for federation save \"%s\".", label.c_str());
G.Out(pdGendoc,"enter FederationManagement::requestFederationSave "
"without time");
- assert(label != 0);
+ //assert(label != 0);
NM_Request_Federation_Save req ;
@@ -858,13 +857,13 @@
// ----------------------------------------------------------------------------
void
-FederationManagement::requestFederationRestore(const char *label,
+FederationManagement::requestFederationRestore(std::string label,
TypeException &)
{
G.Out(pdGendoc,"enter FederationManagement::requestFederationRestore");
- D.Out(pdInit, "Request for federation restore \"%s\".", label);
+ D.Out(pdInit, "Request for federation restore \"%s\".", label.c_str());
- assert(label != NULL);
+ //assert(label != NULL);
NM_Request_Federation_Restore req ;
Index: RTIA/FederationManagement.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/FederationManagement.hh,v
retrieving revision 3.22
retrieving revision 3.23
diff -u -b -r3.22 -r3.23
--- RTIA/FederationManagement.hh 29 Apr 2008 13:11:14 -0000 3.22
+++ RTIA/FederationManagement.hh 29 May 2008 12:20:33 -0000 3.23
@@ -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: FederationManagement.hh,v 3.22 2008/04/29 13:11:14 erk Exp $
+// $Id: FederationManagement.hh,v 3.23 2008/05/29 12:20:33 rousse Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_RTIA_FEDERATION_MANAGEMENT
@@ -44,30 +44,30 @@
void checkFederationRestoring(void) throw (RestoreInProgress);
// -- Create/Destroy --
- void createFederationExecution(const char *theName, TypeException &e)
+ void createFederationExecution(std::string theName, TypeException &e)
throw ( FederationExecutionAlreadyExists,
CouldNotOpenFED,ErrorReadingFED,
RTIinternalError);
- void destroyFederationExecution(const char *theName, TypeException &e);
+ void destroyFederationExecution(std::string theName, TypeException &e);
// -- Join/Resign --
- FederateHandle joinFederationExecution(const char *Federate,
- const char *Federation,
+ FederateHandle joinFederationExecution(std::string Federate,
+ std::string Federation,
TypeException &e);
void resignFederationExecution(RTI::ResignAction action,
TypeException &e);
// Synchronization.
- void registerSynchronization(const char *label,
- const char *tag,
+ void registerSynchronization(std::string label,
+ std::string tag,
TypeException &e);
- void registerSynchronization(const char *label,
- const char *tag,
+ void registerSynchronization(std::string label,
+ std::string tag,
unsigned short array_size,
FederateHandle *fed_array,
TypeException &e);
- void unregisterSynchronization(const char *label,
+ void unregisterSynchronization(std::string label,
TypeException &e);
void synchronizationPointRegistrationFailed(const char *label);
void synchronizationPointRegistrationSucceeded(const char *label);
@@ -76,15 +76,15 @@
const char *tag);
// Saving.
- void requestFederationSave(const char *label, FederationTime the_time,
TypeException &e);
- void requestFederationSave(const char *label, TypeException &e);
+ void requestFederationSave(std::string label, FederationTime the_time,
TypeException &e);
+ void requestFederationSave(std::string label, TypeException &e);
void federateSaveBegun(TypeException &);
void federateSaveStatus(bool, TypeException &);
void initiateFederateSave(const char *label);
void federationSavedStatus(bool);
// Restoring.
- void requestFederationRestore(const char *label,
+ void requestFederationRestore(std::string label,
TypeException &e);
void federateRestoreStatus(bool status, TypeException &e);
void requestFederationRestoreStatus(bool status,
@@ -100,7 +100,7 @@
Handle _numero_federation ;
FederateHandle federate ;
bool _fin_execution ;
- char* _FEDid ;
+ std::string _FEDid ;
private:
Communications *comm ;
@@ -123,4 +123,4 @@
#endif // _CERTI_RTIA_FEDERATION_MANAGEMENT
-// $Id: FederationManagement.hh,v 3.22 2008/04/29 13:11:14 erk Exp $
+// $Id: FederationManagement.hh,v 3.23 2008/05/29 12:20:33 rousse Exp $
Index: RTIA/ObjectManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/ObjectManagement.cc,v
retrieving revision 3.45
retrieving revision 3.46
diff -u -b -r3.45 -r3.46
--- RTIA/ObjectManagement.cc 27 May 2008 12:26:53 -0000 3.45
+++ RTIA/ObjectManagement.cc 29 May 2008 12:20:33 -0000 3.46
@@ -109,7 +109,7 @@
ValueLengthPair *valueArray,
UShort attribArraySize,
FederationTime theTime,
- const char *theTag,
+ std::string theTag,
TypeException &e)
{
NM_Update_Attribute_Values req;
@@ -171,7 +171,7 @@
AttributeHandle *attribArray,
ValueLengthPair *valueArray,
UShort attribArraySize,
- const char *theTag,
+ std::string theTag,
TypeException &e)
{
NM_Update_Attribute_Values req;
@@ -285,7 +285,7 @@
ParameterLengthPair *valueArray,
UShort paramArraySize,
FederationTime theTime,
- const char *theTag,
+ std::string theTag,
RegionHandle region,
TypeException &e)
{
@@ -340,7 +340,7 @@
ParameterHandle *paramArray,
ParameterLengthPair *valueArray,
UShort paramArraySize,
- const char *theTag,
+ std::string theTag,
RegionHandle region,
TypeException &e)
{
@@ -424,7 +424,7 @@
EventRetractionHandle
ObjectManagement::deleteObject(ObjectHandle theObjectHandle,
FederationTime theTime,
- const char *theTag,
+ std::string theTag,
TypeException &e)
{
NM_Delete_Object req;
@@ -451,7 +451,7 @@
//! deleteObject without time
void
ObjectManagement::deleteObject(ObjectHandle theObjectHandle,
- const char *theTag,
+ std::string theTag,
TypeException &e)
{
NM_Delete_Object req;
@@ -818,3 +818,4 @@
}
}} // namespace certi/rtia
\ No newline at end of file
+
Index: RTIA/ObjectManagement.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/ObjectManagement.hh,v
retrieving revision 3.20
retrieving revision 3.21
diff -u -b -r3.20 -r3.21
--- RTIA/ObjectManagement.hh 13 Mar 2008 14:39:19 -0000 3.20
+++ RTIA/ObjectManagement.hh 29 May 2008 12:20:33 -0000 3.21
@@ -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: ObjectManagement.hh,v 3.20 2008/03/13 14:39:19 siron Exp $
+// $Id: ObjectManagement.hh,v 3.21 2008/05/29 12:20:33 rousse Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_RTIA_OM
@@ -57,14 +57,14 @@
ValueLengthPair *valueArray,
UShort attribArraySize,
FederationTime theTime,
- const char *theTag,
+ std::string theTag,
TypeException &e);
void updateAttributeValues(ObjectHandle theObjectHandle,
AttributeHandle *attribArray,
ValueLengthPair *valueArray,
UShort attribArraySize,
- const char *theTag,
+ std::string theTag,
TypeException &e);
void discoverObject(ObjectHandle theObjectHandle,
@@ -96,7 +96,7 @@
ParameterLengthPair *valueArray,
UShort paramArraySize,
FederationTime theTime,
- const char *theTag,
+ std::string theTag,
RegionHandle,
TypeException &e);
@@ -105,7 +105,7 @@
ParameterHandle *paramArray,
ParameterLengthPair *valueArray,
UShort paramArraySize,
- const char *theTag,
+ std::string theTag,
RegionHandle,
TypeException &e);
@@ -127,11 +127,11 @@
EventRetractionHandle deleteObject(ObjectHandle theObjectHandle,
FederationTime theTime,
- const char *theTag,
+ std::string theTag,
TypeException &e);
void deleteObject(ObjectHandle theObjectHandle,
- const char *theTag,
+ std::string theTag,
TypeException &e);
void removeObject(ObjectHandle theObjectHandle,
@@ -229,4 +229,4 @@
#endif // _CERTI_RTIA_OM
-// $Id: ObjectManagement.hh,v 3.20 2008/03/13 14:39:19 siron Exp $
+// $Id: ObjectManagement.hh,v 3.21 2008/05/29 12:20:33 rousse Exp $
Index: RTIA/OwnershipManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/OwnershipManagement.cc,v
retrieving revision 3.13
retrieving revision 3.14
diff -u -b -r3.13 -r3.14
--- RTIA/OwnershipManagement.cc 26 Apr 2008 14:59:41 -0000 3.13
+++ RTIA/OwnershipManagement.cc 29 May 2008 12:20:33 -0000 3.14
@@ -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: OwnershipManagement.cc,v 3.13 2008/04/26 14:59:41 erk Exp $
+// $Id: OwnershipManagement.cc,v 3.14 2008/05/29 12:20:33 rousse Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -129,7 +129,7 @@
negotiatedAttributeOwnershipDivestiture(ObjectHandle theObject,
AttributeHandle *attribArray,
UShort attribArraySize,
- const char *theTag,
+ std::string theTag,
TypeException &e)
{
@@ -252,7 +252,7 @@
attributeOwnershipAcquisition(ObjectHandle theObject,
AttributeHandle *attribArray,
UShort attribArraySize,
- const char *theTag,
+ std::string theTag,
TypeException &e)
{
NM_Attribute_Ownership_Acquisition req;
@@ -433,7 +433,7 @@
AttributeHandle *the_attributes,
UShort the_size,
FederateHandle,
- char *the_tag,
+ std::string the_tag,
TypeException &)
{
Message req;
@@ -453,7 +453,7 @@
requestAttributeOwnershipRelease(ObjectHandle the_object,
AttributeHandle *the_attributes,
UShort the_size,
- char *the_tag,
+ std::string the_tag,
TypeException &)
{
Message req;
@@ -504,4 +504,4 @@
}} // namespace certi/rtia
-// $Id: OwnershipManagement.cc,v 3.13 2008/04/26 14:59:41 erk Exp $
+// $Id: OwnershipManagement.cc,v 3.14 2008/05/29 12:20:33 rousse Exp $
Index: RTIA/OwnershipManagement.hh
===================================================================
RCS file: /sources/certi/certi/RTIA/OwnershipManagement.hh,v
retrieving revision 3.6
retrieving revision 3.7
diff -u -b -r3.6 -r3.7
--- RTIA/OwnershipManagement.hh 18 May 2004 13:18:52 -0000 3.6
+++ RTIA/OwnershipManagement.hh 29 May 2008 12:20:33 -0000 3.7
@@ -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: OwnershipManagement.hh,v 3.6 2004/05/18 13:18:52 breholee Exp $
+// $Id: OwnershipManagement.hh,v 3.7 2008/05/29 12:20:33 rousse Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_RTIA_OWM
@@ -74,7 +74,7 @@
negotiatedAttributeOwnershipDivestiture(ObjectHandle theObject,
AttributeHandle *attribArray,
UShort attribArraySize,
- const char *theTag,
+ std::string theTag,
TypeException &e);
void
cancelnegotiatedAttributeOwnershipDivestiture(ObjectHandle theObject,
@@ -112,7 +112,7 @@
AttributeHandle *attribArray,
UShort attribArraySize,
FederateHandle theOwner,
- char *theTag,
+ std::string theTag,
TypeException &e);
void
@@ -125,14 +125,14 @@
attributeOwnershipAcquisition(ObjectHandle theObject,
AttributeHandle *attribArray,
UShort attribArraySize,
- const char *theTag,
+ std::string theTag,
TypeException &e);
void
requestAttributeOwnershipRelease(ObjectHandle theObject,
AttributeHandle *attribArray,
UShort attribArraySize,
- char *theTag,
+ std::string theTag,
TypeException &e);
void
@@ -162,4 +162,4 @@
#endif // _CERTI_RTIA_OWM
-// $Id: OwnershipManagement.hh,v 3.6 2004/05/18 13:18:52 breholee Exp $
+// $Id: OwnershipManagement.hh,v 3.7 2008/05/29 12:20:33 rousse Exp $
Index: RTIA/RTIA.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA.cc,v
retrieving revision 3.20
retrieving revision 3.21
diff -u -b -r3.20 -r3.21
--- RTIA/RTIA.cc 5 May 2008 09:47:20 -0000 3.20
+++ RTIA/RTIA.cc 29 May 2008 12:20:34 -0000 3.21
@@ -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: RTIA.cc,v 3.20 2008/05/05 09:47:20 erk Exp $
+// $Id: RTIA.cc,v 3.21 2008/05/29 12:20:34 rousse Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -64,7 +64,7 @@
// BUG: TCP link destroyed ?
// Remove temporary file (if not yet done)
- if ( fm->_FEDid != NULL)
+ if ( fm->_FEDid.c_str() != NULL)
{
if ( fm->_FEDid[0] != '\0' )
{
@@ -77,7 +77,7 @@
else
{
std::cout<<"*** W ** Removing temporary file "<<fm->_FEDid<<" on
RTIA stop."<<std::endl;
- std::remove(fm->_FEDid);
+ std::remove(fm->_FEDid.c_str());
}
fm->_FEDid[0] = '\0' ;
}
@@ -197,4 +197,4 @@
}} // namespace certi/rtia
-// $Id: RTIA.cc,v 3.20 2008/05/05 09:47:20 erk Exp $
+// $Id: RTIA.cc,v 3.21 2008/05/29 12:20:34 rousse Exp $
Index: RTIA/RTIA_federate.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA_federate.cc,v
retrieving revision 3.79
retrieving revision 3.80
diff -u -b -r3.79 -r3.80
--- RTIA/RTIA_federate.cc 27 May 2008 12:26:53 -0000 3.79
+++ RTIA/RTIA_federate.cc 29 May 2008 12:20:34 -0000 3.80
@@ -129,8 +129,7 @@
D.Out(pdTrace,
"Receiving Message from Federate, type CreateFederation.");
// Store FEDid for future usage (JOIN_FEDERATION_EXECUTION) into fm
- fm->_FEDid = new char[strlen(req->getFEDid())+1] ;
- strcpy(fm->_FEDid, req->getFEDid()) ;
+ fm->_FEDid = req->getFEDid() ;
fm->createFederationExecution(req->getFederationName(), e);
if ( e == e_RTIinternalError )
{
@@ -1434,3 +1433,4 @@
}
}} // namespace certi/rtia
\ No newline at end of file
+
Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.86
retrieving revision 3.87
diff -u -b -r3.86 -r3.87
--- RTIG/Federation.cc 12 May 2008 12:17:02 -0000 3.86
+++ RTIG/Federation.cc 29 May 2008 12:20:34 -0000 3.87
@@ -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.86 2008/05/12 12:17:02 erk Exp $
+// $Id: Federation.cc,v 3.87 2008/05/29 12:20:34 rousse Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -1608,6 +1608,7 @@
RestoreInProgress,
RTIinternalError)
{
+ G.Out(pdGendoc,"enter Federation::updateAttributeValues with time");
// It may throw FederateNotExecutionMember.
this->check(federate);
@@ -1618,6 +1619,7 @@
D.Out(pdRegister,
"Federation %d: Federate %d updated attributes of Object %d.",
handle, federate, id);
+ G.Out(pdGendoc,"exit Federation::updateAttributeValues with time");
}
// ----------------------------------------------------------------------------
@@ -1638,6 +1640,7 @@
RestoreInProgress,
RTIinternalError)
{
+ G.Out(pdGendoc,"enter Federation::updateAttributeValues without time");
// It may throw FederateNotExecutionMember.
this->check(federate);
@@ -1648,6 +1651,7 @@
D.Out(pdRegister,
"Federation %d: Federate %d updated attributes of Object %d.",
handle, federate, id);
+ G.Out(pdGendoc,"exit Federation::updateAttributeValues without time");
}
// ----------------------------------------------------------------------------
//! Update the current time of a regulator federate.
@@ -2273,5 +2277,5 @@
}} // namespace certi/rtig
-// $Id: Federation.cc,v 3.86 2008/05/12 12:17:02 erk Exp $
+// $Id: Federation.cc,v 3.87 2008/05/29 12:20:34 rousse Exp $
Index: RTIG/RTIG.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG.cc,v
retrieving revision 3.43
retrieving revision 3.44
diff -u -b -r3.43 -r3.44
--- RTIG/RTIG.cc 22 May 2008 12:20:21 -0000 3.43
+++ RTIG/RTIG.cc 29 May 2008 12:20:35 -0000 3.44
@@ -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: RTIG.cc,v 3.43 2008/05/22 12:20:21 erk Exp $
+// $Id: RTIG.cc,v 3.44 2008/05/29 12:20:35 rousse Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -85,7 +85,7 @@
Socket*
RTIG::chooseProcessingMethod(Socket *link, NetworkMessage *msg)
{
- G.Out(pdGendoc,"enter RTIG::chooseProcessingMethod type %d
(%s)",msg->getType(),msg->getName().c_str());
+ G.Out(pdGendoc,"enter RTIG::chooseProcessingMethod type
(%s)",msg->getName().c_str());
// This may throw a security error.
if ( msg->getType() != NetworkMessage::DESTROY_FEDERATION_EXECUTION)
socketServer.checkMessage(link->returnSocket(), msg);
@@ -990,4 +990,4 @@
}} // namespace certi/rtig
-// $Id: RTIG.cc,v 3.43 2008/05/22 12:20:21 erk Exp $
+// $Id: RTIG.cc,v 3.44 2008/05/29 12:20:35 rousse Exp $
Index: RTIG/RTIG_processing.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG_processing.cc,v
retrieving revision 3.70
retrieving revision 3.71
diff -u -b -r3.70 -r3.71
--- RTIG/RTIG_processing.cc 23 May 2008 12:37:22 -0000 3.70
+++ RTIG/RTIG_processing.cc 29 May 2008 12:20:35 -0000 3.71
@@ -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: RTIG_processing.cc,v 3.70 2008/05/23 12:37:22 erk Exp $
+// $Id: RTIG_processing.cc,v 3.71 2008/05/29 12:20:35 rousse Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -789,6 +789,7 @@
void
RTIG::processUpdateAttributeValues(Socket *link, NetworkMessage *req)
{
+ G.Out(pdGendoc,"enter RTIG::processUpdateAttributeValues");
ValueLengthPair *ValueArray = NULL ;
auditServer << "ObjID = " << req->object
@@ -834,6 +835,7 @@
rep.setTag(req->getTag());
rep.send(link); // send answer to RTIA
+ G.Out(pdGendoc,"exit RTIG::processUpdateAttributeValues");
}
// ----------------------------------------------------------------------------
@@ -1427,4 +1429,4 @@
}} // namespace certi/rtig
-// $Id: RTIG_processing.cc,v 3.70 2008/05/23 12:37:22 erk Exp $
+// $Id: RTIG_processing.cc,v 3.71 2008/05/29 12:20:35 rousse Exp $
Index: include/certi.hh
===================================================================
RCS file: /sources/certi/certi/include/certi.hh,v
retrieving revision 3.27
retrieving revision 3.28
diff -u -b -r3.27 -r3.28
--- include/certi.hh 28 Apr 2008 17:14:53 -0000 3.27
+++ include/certi.hh 29 May 2008 12:20:35 -0000 3.28
@@ -16,7 +16,7 @@
// License along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: certi.hh,v 3.27 2008/04/28 17:14:53 erk Exp $
+// $Id: certi.hh,v 3.28 2008/05/29 12:20:35 rousse Exp $
// ----------------------------------------------------------------------------
#ifndef CERTI_HH_INCLUDED
@@ -92,19 +92,15 @@
// Deprecated HLA macros still in use
#define MAX_BYTES_PER_VALUE 500
-#define MAX_FEDERATE_NAME_LENGTH 64
+//#define MAX_FEDERATE_NAME_LENGTH 64
#undef MAX_USER_TAG_LENGTH
#define MAX_USER_TAG_LENGTH 64
#undef MAX_ATTRIBUTES_PER_CLASS
#define MAX_ATTRIBUTES_PER_CLASS 50
#define MAX_BYTES_PER_VALUETYPE 128
-#undef MAX_PARAMETERS_PER_CLASS
-#define MAX_PARAMETERS_PER_CLASS 50
+//#undef MAX_PARAMETERS_PER_CLASS
+//#define MAX_PARAMETERS_PER_CLASS 50
-// next used in MessageBody constructor with no size
-// EN. change from 500-->536 because HeaderStruct is 36
-// see MessageBody code for reason
-#define BUFFER_SIZE_DEFAULT 536
// next used in RTIG::processIncomingMessage method
#define BUFFER_EXCEPTION_REASON_SIZE 256
@@ -385,4 +381,4 @@
(uint64_t) CERTI_INT64_CONSTANT(0xff00000000000000U)) >> 56)))
#endif // CERTI_HH_INCLUDED
-// $Id: certi.hh,v 3.27 2008/04/28 17:14:53 erk Exp $
+// $Id: certi.hh,v 3.28 2008/05/29 12:20:35 rousse Exp $
Index: libCERTI/BasicMessage.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/BasicMessage.cc,v
retrieving revision 3.11
retrieving revision 3.12
diff -u -b -r3.11 -r3.12
--- libCERTI/BasicMessage.cc 29 Apr 2008 08:33:05 -0000 3.11
+++ libCERTI/BasicMessage.cc 29 May 2008 12:20:35 -0000 3.12
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: BasicMessage.cc,v 3.11 2008/04/29 08:33:05 erk Exp $
+// $Id: BasicMessage.cc,v 3.12 2008/05/29 12:20:35 rousse Exp $
// ----------------------------------------------------------------------------
@@ -128,22 +128,22 @@
format: list of ranges. Range format: lower bound, upper bound.
*/
void
-BasicMessage::writeExtents(MessageBody &body) const
+BasicMessage::writeExtents(MessageBuffer& msgBuffer) const
{
D[pdDebug] << "Write " << extents.size() << " extent(s)" << endl ;
- body.writeLongInt(extents.size());
+ msgBuffer.write_int64(extents.size());
if (extents.size() > 0) {
int n = extents[0].size();
- body.writeLongInt(n);
+ msgBuffer.write_int64(n);
D[pdDebug] << "Extent with " << n << " range(s)" << endl ;
for (unsigned int i = 0 ; i < extents.size(); ++i) {
const Extent &e = extents[i] ;
for (int h = 1 ; h <= n ; ++h) {
- body.writeLongInt(e.getRangeLowerBound(h));
- body.writeLongInt(e.getRangeUpperBound(h));
+ msgBuffer.write_int64(e.getRangeLowerBound(h));
+ msgBuffer.write_int64(e.getRangeUpperBound(h));
}
}
}
@@ -155,21 +155,21 @@
\sa BasicMessage::writeExtents, Extent
*/
void
-BasicMessage::readExtents(const MessageBody &body)
+BasicMessage::readExtents(MessageBuffer& msgBuffer)
{
- long nb_extents = body.readLongInt();
+ long nb_extents = msgBuffer.read_int64();
D[pdDebug] << "Read " << nb_extents << " extent(s)" << endl ;
extents.clear();
if (nb_extents > 0) {
extents.reserve(nb_extents);
- long nb_dimensions = body.readLongInt();
+ long nb_dimensions = msgBuffer.read_int64();
D[pdDebug] << "Extent with " << nb_dimensions << " range(s)" << endl ;
for (long i = 0 ; i < nb_extents ; ++i) {
Extent e(nb_dimensions);
for (long h = 1 ; h <= nb_dimensions ; ++h) {
- e.setRangeLowerBound(h, body.readLongInt());
- e.setRangeUpperBound(h, body.readLongInt());
+ e.setRangeLowerBound(h, msgBuffer.read_int64());
+ e.setRangeUpperBound(h, msgBuffer.read_int64());
}
extents.push_back(e);
}
@@ -178,24 +178,24 @@
// ----------------------------------------------------------------------------
void
-BasicMessage::writeRegions(MessageBody &body)
+BasicMessage::writeRegions(MessageBuffer& msgBuffer)
{
long n = regions.size();
- body.writeLongInt(n);
+ msgBuffer.write_int64(n);
for (int i = 0 ; i < n ; ++i) {
- body.writeLongInt(regions[i]);
+ msgBuffer.write_int64(regions[i]);
}
}
// ----------------------------------------------------------------------------
void
-BasicMessage::readRegions(const MessageBody &body)
+BasicMessage::readRegions(MessageBuffer& msgBuffer)
{
- long n = body.readLongInt();
+ long n = msgBuffer.read_int64();
regions.clear();
regions.reserve(n);
for (int i = 0; i < n; ++i) {
- regions.push_back(body.readLongInt());
+ regions.push_back(msgBuffer.read_int64());
}
}
@@ -225,4 +225,4 @@
} // namespace certi
-// $Id: BasicMessage.cc,v 3.11 2008/04/29 08:33:05 erk Exp $
+// $Id: BasicMessage.cc,v 3.12 2008/05/29 12:20:35 rousse Exp $
Index: libCERTI/BasicMessage.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/BasicMessage.hh,v
retrieving revision 3.9
retrieving revision 3.10
diff -u -b -r3.9 -r3.10
--- libCERTI/BasicMessage.hh 29 Apr 2008 08:33:05 -0000 3.9
+++ libCERTI/BasicMessage.hh 29 May 2008 12:20:36 -0000 3.10
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: BasicMessage.hh,v 3.9 2008/04/29 08:33:05 erk Exp $
+// $Id: BasicMessage.hh,v 3.10 2008/05/29 12:20:36 rousse Exp $
// ----------------------------------------------------------------------------
#ifndef LIBCERTI_BASIC_MESSAGE
@@ -54,11 +54,11 @@
virtual void serialize(MessageBuffer& msgBuffer);
virtual void deserialize(MessageBuffer& msgBuffer);
- void readExtents(const MessageBody &);
- void writeExtents(MessageBody &) const ;
+ void readExtents(MessageBuffer& msgBuffer);
+ void writeExtents(MessageBuffer& msgBuffer) const ;
- void readRegions(const MessageBody &body);
- void writeRegions(MessageBody &body);
+ void readRegions(MessageBuffer& msgBuffer);
+ void writeRegions(MessageBuffer& msgBuffer);
std::vector<Extent> extents ;
std::vector<RegionHandle> regions ;
@@ -75,4 +75,4 @@
#endif // LIBCERTI_BASIC_MESSAGE
-// $Id: BasicMessage.hh,v 3.9 2008/04/29 08:33:05 erk Exp $
+// $Id: BasicMessage.hh,v 3.10 2008/05/29 12:20:36 rousse Exp $
Index: libCERTI/Message.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message.cc,v
retrieving revision 3.52
retrieving revision 3.53
diff -u -b -r3.52 -r3.53
--- libCERTI/Message.cc 7 May 2008 16:00:20 -0000 3.52
+++ libCERTI/Message.cc 29 May 2008 12:20:36 -0000 3.53
@@ -42,7 +42,7 @@
exception = e_NO_EXCEPTION ;
exceptionReason[0] = '\0' ;
federateName[0] = '\0' ;
- federationName = NULL ;
+ //federationName = NULL ;is now a string then...
tag[0] = '\0' ;
name[0] = '\0' ;
label[0] = '\0' ;
@@ -66,7 +66,7 @@
dimension = 0 ;
number = 0 ;
region = 0 ;
- FEDid = NULL ;
+ //FEDid = NULL ;now string
for ( int i=0 ; i<MAX_ATTRIBUTES_PER_CLASS ; i++ )
{
valueArray[i].length = 0 ;
@@ -141,28 +141,16 @@
@param NewLabel copied (strcpy) into Message label (NULL label is stored
as an empty string)
*/
void
-Message::setLabel(const char *NewLabel)
+Message::setLabel(std::string NewLabel)
{
- if ( NewLabel )
- {
- if (strlen(NewLabel) > MAX_USER_TAG_LENGTH)
- throw ValueLengthExceeded("Label too long to fit in Message.");
- strcpy(label, NewLabel);
- }
- else
- {
- strcpy(label, "") ;
- }
+ label = NewLabel ;
}
// ----------------------------------------------------------------------------
void
Message::setName(const char *NewName)
{
- if (strlen(NewName) > MAX_USER_TAG_LENGTH)
- throw ValueLengthExceeded("Name too long to fit in Message.");
-
- strcpy(name, NewName);
+ name = NewName ;
}
// ----------------------------------------------------------------------------
@@ -334,7 +322,7 @@
if (strlen(the_reason) > MAX_EXCEPTION_REASON_LENGTH)
throw ValueLengthExceeded("Exception reason too long to fit in"
" Message.");
- strcpy(exceptionReason, the_reason);
+ exceptionReason = the_reason;
}
// ----------------------------------------------------------------------------
@@ -512,10 +500,9 @@
// ----------------------------------------------------------------------------
//! Sets the federation name.
-void Message::setFederationName(const char *NewNomFederation)
+void Message::setFederationName(std::string NewNomFederation)
{
- federationName = new char [strlen(NewNomFederation)+1] ;
- strcpy(federationName, NewNomFederation);
+ federationName = NewNomFederation ;
}
@@ -523,12 +510,9 @@
// setFederateName
//
void
-Message::setFederateName(const char *NewNomFedere)
+Message::setFederateName(std::string NewNomFedere)
{
- if (strlen(NewNomFedere) > MAX_FEDERATE_NAME_LENGTH)
- throw ValueLengthExceeded("NomFedere too long to fit in Message.");
-
- strcpy(federateName, NewNomFedere);
+ federateName = NewNomFedere ;
}
// ----------------------------------------------------------------------------
@@ -537,17 +521,9 @@
@param new_tag tag (NULL tag is stored as an empty string)
*/
void
-Message::setTag(const char *new_tag)
+Message::setTag(std::string new_tag)
{
- if (new_tag) {
- if (strlen(new_tag) > MAX_USER_TAG_LENGTH) {
- throw ValueLengthExceeded("Tag too long to fit in Message.");
- }
- strcpy(tag, new_tag);
- }
- else {
- strcpy(tag, "");
- }
+ tag = new_tag ;
}
// ----------------------------------------------------------------------------
@@ -579,10 +555,9 @@
// setFEDid
//
void
-Message::setFEDid(const char *NewFEDid)
+Message::setFEDid(std::string NewFEDid)
{
- FEDid = new char [strlen(NewFEDid)+1] ;
- strcpy(FEDid, NewFEDid);
+ FEDid = NewFEDid;
}
// ----------------------------------------------------------------------------
@@ -597,11 +572,10 @@
lookahead = msg.lookahead ;
exception = msg.exception ;
- strcpy(exceptionReason, msg.exceptionReason);
- strcpy(federateName, msg.federateName);
+ exceptionReason = msg.exceptionReason;
+ federateName = msg.federateName ;
- federationName = new char[strlen(msg.federationName)+1] ;
- strcpy(federationName, msg.federationName);
+ federationName = msg.federationName ;
federate = msg.federate ;
resignAction = msg.resignAction ;
@@ -621,8 +595,8 @@
minTickTime = msg.minTickTime ;
maxTickTime = msg.maxTickTime ;
- strcpy(tag, msg.tag);
- strcpy(name, msg.name);
+ tag = msg.tag ;
+ name = msg.name ;
transport = msg.transport ;
order = msg.order ;
@@ -630,7 +604,7 @@
eventRetraction.theSerialNumber = msg.eventRetraction.theSerialNumber ;
eventRetraction.sendingFederate = msg.eventRetraction.sendingFederate ;
- strcpy(label, msg.label);
+ label = msg.label ;
handleArraySize = msg.handleArraySize ;
@@ -644,8 +618,7 @@
memcpy(valueArray[i].value, msg.valueArray[i].value,
msg.valueArray[i].length );
}
- FEDid = new char [strlen(msg.FEDid)+1] ;
- strcpy(FEDid, msg.FEDid) ;
+ FEDid = msg.FEDid ;
return *this ;
}
@@ -659,17 +632,17 @@
printf(" -- MESSAGE - %s -", s);
if ( type == CREATE_FEDERATION_EXECUTION )
printf("CREATE_FEDERATION_EXECUTION : federationName %s : filename %s
federateHandle %ld \n",
-
((federationName==NULL)?"empty":federationName),((FEDid==NULL)?"empty":FEDid),federate)
;
+
((federationName.c_str()==NULL)?"empty":federationName.c_str()),((FEDid.c_str()==NULL)?"empty":FEDid.c_str()),federate)
;
if ( type == DESTROY_FEDERATION_EXECUTION )
printf("DESTROY_FEDERATION_EXECUTION : federation %s : federate %ld\n",
- ((federationName==NULL)?"empty":federationName),federate) ;
+
((federationName.c_str()==NULL)?"empty":federationName.c_str()),federate) ;
else if ( type == JOIN_FEDERATION_EXECUTION )
printf("JOIN_FEDERATION_EXECUTION : federate number %ld federation name
%s federate name %s\n",
-
federate,((federationName==NULL)?"empty":federationName),federateName) ;
+
federate,((federationName.c_str()==NULL)?"empty":federationName.c_str()),federateName.c_str())
;
else if (type == FEDERATE_SAVE_COMPLETE )
- printf("FEDERATE_SAVE_COMPLETE : federationName %s : federatehandle
%ld \n",federationName,federate);
+ printf("FEDERATE_SAVE_COMPLETE : federationName %s : federatehandle
%ld \n",federationName.c_str(),federate);
else if (type == FEDERATE_RESTORE_COMPLETE )
- printf("FEDERATE_RESTORE_COMPLETE : federationName %s : federatehandle
%ld \n",federationName,federate);
+ printf("FEDERATE_RESTORE_COMPLETE : federationName %s : federatehandle
%ld \n",federationName.c_str(),federate);
else if (type == REQUEST_OBJECT_ATTRIBUTE_VALUE_UPDATE )
printf("REQUEST_OBJECT_ATTRIBUTE_VALUE_UPDATE : \n");
else
@@ -679,7 +652,7 @@
printf("NO_EXCEPTION ");
else
printf(" exception=%d: ",exception);
- printf(" reason=%s: ",((exceptionReason==NULL)?"empty":exceptionReason));
+ printf(" reason=%s:
",((exceptionReason.c_str()==NULL)?"empty":exceptionReason.c_str()));
printf(" objectClass=%ld: ", objectClass);
printf(" interactionClass=%ld:\n", interactionClass);
printf(" attribute=%ld:\n", attribute);
Index: libCERTI/Message.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message.hh,v
retrieving revision 3.44
retrieving revision 3.45
diff -u -b -r3.44 -r3.45
--- libCERTI/Message.hh 27 May 2008 07:51:55 -0000 3.44
+++ libCERTI/Message.hh 29 May 2008 12:20:37 -0000 3.45
@@ -256,12 +256,18 @@
* Serialize the message into a buffer
*/
virtual void serialize(MessageBuffer& msgBuffer);
+ /**
+ * DeSerialize the message from a buffer
+ */
+ virtual void deserialize(MessageBuffer& msgBuffer);
+ void send(SocketUN* socket, MessageBuffer& msgBuffer) throw
(NetworkError, NetworkSignal);
+ void receive(SocketUN* socket, MessageBuffer& msgBuffer) throw
(NetworkError, NetworkSignal);
void trace(const char* context);
// Read and Write NetworkMessage Objects to and from Socket objects.
- void write(SocketUN *Socket) throw (NetworkError, NetworkSignal);
+ void write(SocketUN *Socket, MessageBuffer& msgBuffer) throw
(NetworkError, NetworkSignal);
void read(SocketUN *Socket) throw (NetworkError, NetworkSignal);
// -- Attribute Access Methods
@@ -291,8 +297,8 @@
// containing the actual Attrib/Param values. You must FREE this structure.
ValueLengthPair *getValueArray();
- const char *getLabel() const { return label ; };
- void setLabel(const char *new_label);
+ std::string getLabel() const { return label ; };
+ void setLabel(std::string new_label);
//const char *getName() const { return name ; };
const std::string getName() const {return name;}
@@ -301,14 +307,14 @@
DimensionHandle getDimension() const { return dimension ; };
void setDimension(DimensionHandle);
- const char *getFederationName() const { return federationName ; };
- void setFederationName(const char *federation_name);
+ std::string getFederationName() const { return federationName ; };
+ void setFederationName(std::string federation_name);
- const char *getFederateName() const { return federateName ; };
- void setFederateName(const char *federate_name);
+ std::string getFederateName() const { return federateName ; };
+ void setFederateName(std::string federate_name);
- const char *getTag() const { return tag ; };
- void setTag(const char *new_tag);
+ std::string getTag() const { return tag ; };
+ void setTag(std::string new_tag);
SpaceHandle getSpace() const { return space ; };
void setSpace(SpaceHandle);
@@ -400,16 +406,17 @@
void setException(TypeException, const char *the_reason = "\0");
TypeException getExceptionType() const { return exception ; };
- const char *getExceptionReason() const { return exceptionReason ; };
+ const char *getExceptionReason() const { return exceptionReason.c_str() ;
};
- const char *getFEDid() const { return FEDid ; };
- void setFEDid(const char *FEDid);
+ std::string getFEDid() const { return FEDid ; };
+ void setFEDid(std::string FEDid);
// Public attributes
Type type ;
protected:
TypeException exception ;
- char exceptionReason[MAX_EXCEPTION_REASON_LENGTH + 1] ;
+ //char exceptionReason[MAX_EXCEPTION_REASON_LENGTH + 1] ;
+ std::string exceptionReason;
RTIfedTime fed_time;
bool boolean ;
@@ -437,6 +444,7 @@
RTI::TickTime maxTickTime;
public:
+
// used for both Attributes and Parameters arrays.
UShort handleArraySize ;
AttributeHandle handleArray[MAX_ATTRIBUTES_PER_CLASS] ;
@@ -447,33 +455,14 @@
private:
- /**
- * True is the message is dated
- * When a message is dated the date is transmitted
- * over the network, when not dated the date is not sent.
- */
- bool _isDated;
- /**
- * True is the message contains a label
- * When a message is labelled the label is transmitted
- * over the network, when not labelled the label is not sent.
- */
- bool _isLabelled;
- /**
- * True is the message contains a tag
- * When a message is tagged the tag is transmitted
- * over the network, when not tagged the tag is not sent.
- */
- bool _isTagged;
-
// Read a Message Body from a Socket. Should be called after
// ReadHeader.
- void readBody(SocketUN *Socket);
+ void readBody(MessageBuffer &msgBuffer);
// Read a Header from a socket, and process it to read its
// content. Return RTI_TRUE if the ReadBody Method has to be
// called.
- bool readHeader(SocketUN *Socket);
+ bool readHeader(MessageBuffer &msgBuffer);
// The message is written onto the socket by WriteHeader if no
// body is required, or by WriteBody is a body has been required
@@ -481,37 +470,38 @@
// Prepare and write a Body to a socket. Should be called after
// WriteHeader.
- void writeBody(SocketUN *Socket);
+ void writeBody(MessageBuffer &msgBuffer);
// Prepare and Write a Header to a Socket, and return RTI_TRUE if
// the WriteBody method has to be called.
- bool writeHeader(SocketUN *Socket);
+ bool writeHeader(MessageBuffer &msgBuffer);
// -- Other Private Read Methods --
- void readHandleArray(MessageBody &);
- void readLabel(MessageBody &);
- void readName(MessageBody &);
- void readFederationName(MessageBody &);
- void readFederateName(MessageBody &);
- void readResignAction(MessageBody &);
- void readTag(MessageBody &);
- void readValueArray(MessageBody &);
- void readFEDid(MessageBody &);
+ void readHandleArray(MessageBuffer &msgBuffer);
+ void readLabel(MessageBuffer &msgBuffer);
+ void readName(MessageBuffer &msgBuffer);
+ void readFederationName(MessageBuffer &msgBuffer);
+ void readFederateName(MessageBuffer &msgBuffer);
+ void readResignAction(MessageBuffer &msgBuffer);
+ void readTag(MessageBuffer &msgBuffer);
+ void readValueArray(MessageBuffer &msgBuffer);
+ void readFEDid(MessageBuffer &msgBuffer);
// -- Other Private Write Methods --
- void writeHandleArray(MessageBody &);
- void writeResignAction(MessageBody &);
- void writeValueArray(MessageBody &);
- void writeFEDid(MessageBody &);
- void writeFederationName(MessageBody &);
+ void writeHandleArray(MessageBuffer &msgBuffer);
+ void writeResignAction(MessageBuffer &msgBuffer);
+ void writeValueArray(MessageBuffer &msgBuffer);
+ void writeFEDid(MessageBuffer &msgBuffer);
+ void writeFederationName(MessageBuffer &msgBuffer);
MessageHeader header ;
- char label[MAX_USER_TAG_LENGTH + 1] ;
- char name[MAX_USER_TAG_LENGTH + 1] ;
- char federateName[MAX_FEDERATE_NAME_LENGTH + 1] ;
- char *federationName ;
- char tag[MAX_USER_TAG_LENGTH + 1] ;
- char *FEDid ;
+ std::string label ;
+ std::string name ;
+ std::string federateName ;
+ std::string federationName ;
+
+ std::string tag ;
+ std::string FEDid ;
ValueLengthPair valueArray[MAX_ATTRIBUTES_PER_CLASS] ;
};
Index: libCERTI/MessageBody.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/MessageBody.cc,v
retrieving revision 3.17
retrieving revision 3.18
diff -u -b -r3.17 -r3.18
--- libCERTI/MessageBody.cc 24 Apr 2008 15:41:48 -0000 3.17
+++ libCERTI/MessageBody.cc 29 May 2008 12:20:37 -0000 3.18
@@ -17,169 +17,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: MessageBody.cc,v 3.17 2008/04/24 15:41:48 erk Exp $
+// $Id: MessageBody.cc,v 3.18 2008/05/29 12:20:37 rousse Exp $
// ----------------------------------------------------------------------------
#include "MessageBody.hh"
-#include <cassert>
-namespace certi {
-/// Constructor. Created MessageBody is empty, buffer size 0
-MessageBody::MessageBody()
-{
-wPtr= rPtr= 0; //Init Read/Write Pointer
-buffer= (unsigned char*)malloc(bSize= BUFFER_SIZE_DEFAULT);
-}
-
-/// Constructor, with an initial buffer address@hidden n Buffer size
-MessageBody::MessageBody(size_t n)
-{
-wPtr= rPtr= 0; //Init Read/Write Pointer
-buffer= (unsigned char*)malloc(bSize= n);
-}
-
-/// Release
-MessageBody::~MessageBody()
-{
-if (buffer) free(buffer);
-}
-
-/// Get the size of the buffer. @return buffer size
-size_t MessageBody::size() const { return wPtr;}
-
-/// Get buffer pointer. @return buffer pointer.
-const unsigned char *MessageBody::getBuffer() const { return &(buffer[0]);}
-unsigned char *MessageBody::getBufferModeRW() { return
&(buffer[0]);}
-
-// ----------------------------------------------------------------------------
-void MessageBody::sGetB(char *pData, unsigned int reqSize)
-{//Read a block : char[0..R..W..]
-
-if (reqSize > (wPtr - rPtr))
- throw RTIinternalError("[sGetB] Bloc too long for storage.");
-else
- memcpy(pData,&buffer[rPtr],reqSize); rPtr+= reqSize;
-}
-
-// ----------------------------------------------------------------------------
-void MessageBody::sGetS(char *pData, unsigned int storeSize)
-{//Read a string : char[NN.R..W..] NN: message length
-
-unsigned int bufSize = readShortInt();
-if (bufSize > storeSize)
- throw RTIinternalError("[sGetS] String in Message too long for
storage.");
-else if (bufSize > 0)
- sGetB(pData, bufSize);
-pData[bufSize]= 0;
-}
-
-// ----------------------------------------------------------------------------
-void MessageBody::sPutS(char *pData)
-{//Write a string into Buffer
-assert(pData != NULL);
-unsigned short dataSize= strlen(pData);
-
-if ((dataSize + sizeof(unsigned short)) < bSize)
- {//Put a string : write length [NN] + string
- *this << dataSize;
- sPutB(pData,dataSize);
- }
-else
- throw RTIinternalError("[sPutS] String in Message too long for
storage.");
-}
-
-// ----------------------------------------------------------------------------
-void MessageBody::sPutB(char *pData, unsigned int storeSize)
-{//Write a block
-
-if (storeSize < (bSize - wPtr))
- {
- memcpy(&buffer[wPtr],pData,storeSize);
- wPtr+= storeSize;
- }
-else
- throw RTIinternalError("[sPutB] String in Message too long for
storage.");
-}
-
-// ----------------------------------------------------------------------------
-unsigned long MessageBody::readLongInt() const
-{
-unsigned long result;
-*(me()) >> result;
-return result;
-}
-
-unsigned short MessageBody::readShortInt() const
-{
-unsigned short result;
-*(me()) >> result;
-return result;
-}
-
-// ----------------------------------------------------------------------------
-MessageBody &MessageBody::operator<<(unsigned long val)
-{
-assert(val <= 4294967295U);
-#ifdef HOST_IS_BIG_ENDIAN
- buffer[wPtr++]= (char)(0x000000FF & (val >> 24));
- buffer[wPtr++]= (char)(0x000000FF & (val >> 16));
- buffer[wPtr++]= (char)(0x000000FF & (val >> 8));
- buffer[wPtr++]= (char)(0x000000FF & val);
-#else
- buffer[wPtr++]= (char)(0x000000FF & val);
- buffer[wPtr++]= (char)(0x000000FF & (val >> 8));
- buffer[wPtr++]= (char)(0x000000FF & (val >> 16));
- buffer[wPtr++]= (char)(0x000000FF & (val >> 24));
-#endif
-
-return *this ;
-}
-
-MessageBody &MessageBody::operator<<(unsigned short val)
-{
-//assert(val <= 4294967295U);
-#ifdef HOST_IS_BIG_ENDIAN
- buffer[wPtr++]= (char)0x000000FF & (val >> 8);
- buffer[wPtr++]= (char)0x000000FF & val;
-#else
- buffer[wPtr++]= (char)(0x000000FF & val);
- buffer[wPtr++]= (char)(0x000000FF & (val >> 8));
-#endif
-
-return *this ;
-}
-
-// ----------------------------------------------------------------------------
-const MessageBody &MessageBody::operator>>(unsigned long &val)
-{
-#ifdef HOST_IS_BIG_ENDIAN
- val = (unsigned long) (buffer[rPtr++] << 24);
- val|= (unsigned long) (buffer[rPtr++] << 16);
- val|= (unsigned long) (buffer[rPtr++] << 8);
- val|= (unsigned long) buffer[rPtr++];
-#else
- val = (unsigned long) buffer[rPtr++];
- val|= (unsigned long) (buffer[rPtr++] << 8);
- val|= (unsigned long) (buffer[rPtr++] << 16);
- val|= (unsigned long) (buffer[rPtr++] << 24);
-#endif
-return *this ;
-}
-
-const MessageBody &MessageBody::operator>>(unsigned short &val)
-{
-#ifdef HOST_IS_BIG_ENDIAN
- val = (unsigned short) (buffer[rPtr++] << 8);
- val|= (unsigned short) buffer[rPtr++];
-#else
- val = (unsigned short) buffer[rPtr++];
- val|= (unsigned short) (buffer[rPtr++] << 8);
-#endif
-return *this ;
-}
-
-} // certi
-
-// $Id: MessageBody.cc,v 3.17 2008/04/24 15:41:48 erk Exp $
+// $Id: MessageBody.cc,v 3.18 2008/05/29 12:20:37 rousse Exp $
Index: libCERTI/MessageBody.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/MessageBody.hh,v
retrieving revision 3.15
retrieving revision 3.16
diff -u -b -r3.15 -r3.16
--- libCERTI/MessageBody.hh 11 Dec 2007 16:44:20 -0000 3.15
+++ libCERTI/MessageBody.hh 29 May 2008 12:20:37 -0000 3.16
@@ -16,7 +16,7 @@
// License along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: MessageBody.hh,v 3.15 2007/12/11 16:44:20 rousse Exp $
+// $Id: MessageBody.hh,v 3.16 2008/05/29 12:20:37 rousse Exp $
// ----------------------------------------------------------------------------
#ifndef LIBCERTI_MESSAGE_BODY_HH
@@ -27,64 +27,7 @@
#include <cstring>
#include <vector>
-namespace certi {
-
-// ============================================================================
-/**
- * MessageBody is a class managing a char buffer for Message exchange.
- * It provides member functions to read and write integers and strings.
- * To read the contents of a MessageBody, juste read the elements in
- * the order they were written.
- */
-/* FIXME EN. shouldn't we use just that need strstream? */
-class MessageBody
-{
-public:
- MessageBody();
- MessageBody(size_t);
- ~MessageBody();
-
- size_t size() const ; //Buffer size
(char)
-
- const unsigned char *getBuffer() const ;
- unsigned char *getBufferModeRW();
-
-
//--------------------------------------------------------------------------------------OUT
- MessageBody &operator<<(unsigned long); //Write Buffer
- MessageBody &operator<<(unsigned short);
-
- void writeString(char *data) {
sPutS(data);};
- void writeBlock(char *block, unsigned short size) { sPutB(block,
size);};
- void writeLongInt(unsigned long data) { *this <<
data;};
- void writeShortInt(unsigned short data) { *this <<
data;};
-
-
//--------------------------------------------------------------------------------------IN
- const MessageBody &operator>>(unsigned long &); //Read Buffer
- const MessageBody &operator>>(unsigned short &);
-
- void readString(char *data, unsigned short size) { sGetS(data, size);};
- void readBlock(char *block, unsigned short size) { sGetB(block, size);};
- unsigned long readLongInt() const;
- unsigned short readShortInt() const;
- void addToWritePointer(unsigned int nbWritten) {wPtr+=nbWritten;};
-
-private:
- // FIXME is this reasonable?
- MessageBody* me() const { return const_cast<MessageBody*>(this);}
- void sGetS(char *pData, unsigned int storeSize);
- void sGetB(char *pData, unsigned int reqSize);
-
- void sPutS(char *pData);
- void sPutB(char *pData, unsigned int storeSize);
-
- unsigned char *buffer; //Buffer
- unsigned int wPtr; //Write Pointer
- unsigned int rPtr; //Read Pointer
- unsigned int bSize; //Buffer Size
-};
-
-} // certi
#endif // LIBCERTI_MESSAGE_BODY_HH
-// $Id: MessageBody.hh,v 3.15 2007/12/11 16:44:20 rousse Exp $
+// $Id: MessageBody.hh,v 3.16 2008/05/29 12:20:37 rousse Exp $
Index: libCERTI/Message_R.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message_R.cc,v
retrieving revision 3.23
retrieving revision 3.24
diff -u -b -r3.23 -r3.24
--- libCERTI/Message_R.cc 22 May 2008 12:20:20 -0000 3.23
+++ libCERTI/Message_R.cc 29 May 2008 12:20:37 -0000 3.24
@@ -17,7 +17,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: Message_R.cc,v 3.23 2008/05/22 12:20:20 erk Exp $
+// $Id: Message_R.cc,v 3.24 2008/05/29 12:20:37 rousse Exp $
// ----------------------------------------------------------------------------
@@ -33,40 +33,59 @@
static PrettyDebug G("GENDOC",__FILE__);
// ----------------------------------------------------------------------------
-//! Read NetworkMessage Objects from Socket objects.
void
-Message::read(SocketUN *socket)
- throw (NetworkError, NetworkSignal)
-{
- // G.Out(pdGendoc,"enter Message::read");
- bool has_body = readHeader(socket);
-
- if (has_body)
- readBody(socket);
- // G.Out(pdGendoc,"exit Message::read");
-}
+Message::receive(SocketUN* socket, MessageBuffer &msgBuffer) throw
(NetworkError, NetworkSignal) {
+ G.Out(pdGendoc,"enter Message::receive");
+ /* 0- Reset receive buffer */
+ /* FIXME this reset may not be necessary since we do
+ * raw-receive + assume-size
+ */
+ msgBuffer.reset();
+ /* 1- Read 'reserved bytes' header from socket */
+ //D.Out(pdDebug,"Reading %d 'reserved' bytes",msgBuffer.reservedBytes);
+ socket->receive(static_cast<const unsigned char *>(msgBuffer(0)),
msgBuffer.reservedBytes);
+ //msgBuffer.show(msgBuffer(0),5);fflush(stdout);
+ /* 2- update (assume) complete message size from reserved bytes */
+ msgBuffer.assumeSizeFromReservedBytes();
+ D.Out(pdDebug,"Got a MsgBuffer of size %d bytes (including %d
reserved)",msgBuffer.size(),msgBuffer.reservedBytes);
+ /* 3- receive the rest of the message */
+ socket->receive(static_cast<const unsigned char
*>(msgBuffer(msgBuffer.reservedBytes)),msgBuffer.size()-msgBuffer.reservedBytes);
+ /* 4- deserialize the message
+ * This is a polymorphic call
+ * which may specialized in a daughter class
+ */
+ deserialize(msgBuffer);
+ G.Out(pdGendoc,"exit Message::receive");
+} /* end of receive */
+
+void Message::deserialize(MessageBuffer& msgBuffer) {
+ G.Out(pdGendoc,"enter Message::deserialize");
+ /* We serialize the common Message part
+ * ALL Messages will contain the following
+ */
+ D[pdDebug] << "Deserialize <" << getName().c_str()<<">"<<std::endl;
+ readHeader(msgBuffer);
+ readBody(msgBuffer) ;
+ G.Out(pdGendoc,"exit Message::deserialize");
+} /* end of deserialize */
// ----------------------------------------------------------------------------
//! Read a Message Body from a Socket, should be called after ReadHeader.
void
-Message::readBody(SocketUN *socket)
+Message::readBody(MessageBuffer &msgBuffer)
{
- // G.Out(pdGendoc,"enter Message::readBody");
-
- assert(header.bodySize > 0);
-
- MessageBody body(header.bodySize);
+ G.Out(pdGendoc,"enter Message::readBody");
// 1. Read Body from socket.
- socket->receive(body.getBuffer(), header.bodySize);
+ //socket->receive(body.getBuffer(), header.bodySize);
// FIXME EN: we must update the write pointer of the
// MessageBody because we have just written
// on it using direct pointer access !! (nasty usage)
- body.addToWritePointer(header.bodySize);
+ //body.addToWritePointer(header.bodySize);
// 3. Read informations from Message Body according to message type.
- if (header.exception != e_NO_EXCEPTION) {
- body.readString(exceptionReason, MAX_EXCEPTION_REASON_LENGTH);
+ if (exception != e_NO_EXCEPTION) {
+ exceptionReason = msgBuffer.read_string();
}
else {
@@ -74,39 +93,39 @@
//D.Mes(pdMessage, 'M', header.type);
this->trace("RTIG::chooseProcessingMethod ");
- switch(header.type) {
+ switch(type) {
// Body contains federationName, FEDid
// Note : relevant only on federate request
case CREATE_FEDERATION_EXECUTION:
- readFederationName(body);
- readFEDid(body) ;
+ readFederationName(msgBuffer);
+ readFEDid(msgBuffer) ;
break ;
// Body contains federationName
case DESTROY_FEDERATION_EXECUTION:
- readFederationName(body);
+ readFederationName(msgBuffer);
break ;
// Body contains label,tag,boolean and maybe
// handleArraySize,handleArray
case REGISTER_FEDERATION_SYNCHRONIZATION_POINT:
- readLabel(body);
- readTag(body);
- boolean = body.readLongInt();
+ readLabel(msgBuffer);
+ readTag(msgBuffer);
+ boolean = msgBuffer.read_bool();
// boolean true means federates set exists
if ( boolean )
{
- handleArraySize = body.readShortInt();
- readHandleArray(body);
+ handleArraySize = msgBuffer.read_int16();
+ readHandleArray(msgBuffer);
}
break ;
// Body contains label,tag
case ANNOUNCE_SYNCHRONIZATION_POINT:
case REQUEST_FEDERATION_RESTORE_FAILED:
- readLabel(body);
- readTag(body);
+ readLabel(msgBuffer);
+ readTag(msgBuffer);
break ;
// Body contains label
@@ -116,25 +135,25 @@
case FEDERATION_SYNCHRONIZED:
case REQUEST_FEDERATION_RESTORE:
case REQUEST_FEDERATION_RESTORE_SUCCEEDED:
- readLabel(body);
+ readLabel(msgBuffer);
break ;
// Body contains federate,label
case INITIATE_FEDERATE_RESTORE:
- federate = body.readShortInt();
- readLabel(body);
+ federate = msgBuffer.read_int16();
+ readLabel(msgBuffer);
break ;
// Body contains label
case INITIATE_FEDERATE_SAVE:
- readLabel(body);
+ readLabel(msgBuffer);
break ;
// Body contains label, boolean
case REQUEST_FEDERATION_SAVE:
- readLabel(body);
+ readLabel(msgBuffer);
// boolean true means with time (in the header)
- boolean = body.readLongInt();
+ boolean = msgBuffer.read_bool();
break ;
// Body contains objectClass
@@ -142,23 +161,23 @@
case UNSUBSCRIBE_OBJECT_CLASS:
case START_REGISTRATION_FOR_OBJECT_CLASS:
case STOP_REGISTRATION_FOR_OBJECT_CLASS:
- objectClass = body.readLongInt();
+ objectClass = msgBuffer.read_int64();
break;
// Body contains object,attribute,tag
case IS_ATTRIBUTE_OWNED_BY_FEDERATE:
case QUERY_ATTRIBUTE_OWNERSHIP:
- object = body.readLongInt();
- attribute = body.readShortInt();
- readTag(body);
+ object = msgBuffer.read_int64();
+ attribute = msgBuffer.read_int16();
+ readTag(msgBuffer);
break ;
// Body contains object,attribute,federate
case ATTRIBUTE_IS_NOT_OWNED:
case INFORM_ATTRIBUTE_OWNERSHIP:
- object = body.readLongInt();
- attribute = body.readShortInt();
- federate = body.readShortInt();
+ object = msgBuffer.read_int64();
+ attribute = msgBuffer.read_int16();
+ federate = msgBuffer.read_int16();
break ;
// Body contains object,handleArraySize,HandleArray,tag
@@ -166,10 +185,10 @@
case REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION:
case ATTRIBUTE_OWNERSHIP_ACQUISITION:
case REQUEST_ATTRIBUTE_OWNERSHIP_RELEASE:
- object = body.readLongInt();
- handleArraySize = body.readShortInt();
- readHandleArray(body);
- readTag(body);
+ object = msgBuffer.read_int64();
+ handleArraySize = msgBuffer.read_int16();
+ readHandleArray(msgBuffer);
+ readTag(msgBuffer);
break ;
// Body contains object,handleArraySize,HandleArray
@@ -182,104 +201,104 @@
case CANCEL_ATTRIBUTE_OWNERSHIP_ACQUISITION:
case CONFIRM_ATTRIBUTE_OWNERSHIP_ACQUISITION_CANCELLATION:
case ATTRIBUTE_OWNERSHIP_DIVESTITURE_NOTIFICATION:
- object = body.readLongInt();
- handleArraySize = body.readShortInt();
- readHandleArray(body);
+ object = msgBuffer.read_int64();
+ handleArraySize = msgBuffer.read_int16();
+ readHandleArray(msgBuffer);
break ;
// Body contains object,region,boolean,handleArraySize,handleArray
case DDM_ASSOCIATE_REGION:
- object = body.readLongInt();
- region = body.readLongInt();
- boolean = body.readLongInt();
- handleArraySize = body.readShortInt();
- readHandleArray(body);
+ object = msgBuffer.read_int64();
+ region = msgBuffer.read_int64();
+ boolean = msgBuffer.read_bool();
+ handleArraySize = msgBuffer.read_int16();
+ readHandleArray(msgBuffer);
break ;
// Body contains objectClass,object,tag,handleArraySize,handleArray,
// regions
case DDM_REGISTER_OBJECT:
- objectClass = body.readLongInt();
- object = body.readLongInt();
- readTag(body);
- handleArraySize = body.readShortInt();
- readHandleArray(body);
- readRegions(body);
+ objectClass = msgBuffer.read_int64();
+ object = msgBuffer.read_int64();
+ readTag(msgBuffer);
+ handleArraySize = msgBuffer.read_int16();
+ readHandleArray(msgBuffer);
+ readRegions(msgBuffer);
break ;
// Body contains objectClass,region,boolean,handleArraySize,
// handleArray
case DDM_SUBSCRIBE_ATTRIBUTES:
- objectClass = body.readLongInt();
- region = body.readLongInt();
- boolean = body.readLongInt();
- handleArraySize = body.readShortInt();
- readHandleArray(body);
+ objectClass = msgBuffer.read_int64();
+ region = msgBuffer.read_int64();
+ boolean = msgBuffer.read_bool();
+ handleArraySize = msgBuffer.read_int16();
+ readHandleArray(msgBuffer);
break ;
// Body contains object,region
case DDM_UNASSOCIATE_REGION:
- object = body.readLongInt();
- region = body.readLongInt();
+ object = msgBuffer.read_int64();
+ region = msgBuffer.read_int64();
break ;
// Body contains objectClass,region
case DDM_UNSUBSCRIBE_ATTRIBUTES:
- objectClass = body.readLongInt();
- region = body.readLongInt();
+ objectClass = msgBuffer.read_int64();
+ region = msgBuffer.read_int64();
break ;
// Body contains interactionClass,region,boolean
case DDM_SUBSCRIBE_INTERACTION:
case DDM_UNSUBSCRIBE_INTERACTION:
- interactionClass = body.readLongInt();
- region = body.readLongInt();
- boolean = body.readLongInt();
+ interactionClass = msgBuffer.read_int64();
+ region = msgBuffer.read_int64();
+ boolean = msgBuffer.read_bool();
break ;
// Body contains objectClass,attribute,space
case GET_ATTRIBUTE_SPACE_HANDLE:
- objectClass = body.readLongInt();
- attribute = body.readLongInt();
- space = body.readLongInt();
+ objectClass = msgBuffer.read_int64();
+ attribute = msgBuffer.read_int64();
+ space = msgBuffer.read_int64();
break ;
// Body contains space,number,region
case DDM_CREATE_REGION:
- space = body.readLongInt();
- number = body.readLongInt();
- region = body.readLongInt();
+ space = msgBuffer.read_int64();
+ number = msgBuffer.read_int64();
+ region = msgBuffer.read_int64();
break ;
// Body contains interactionClass,space
case GET_INTERACTION_SPACE_HANDLE:
- interactionClass = body.readLongInt();
- space = body.readLongInt();
+ interactionClass = msgBuffer.read_int64();
+ space = msgBuffer.read_int64();
break ;
// Body contains federate,Federationname,FederateName
// Note : federate relevant on RTIA answer only
case JOIN_FEDERATION_EXECUTION:
- federate = body.readShortInt();
- readFederationName(body);
- readFederateName(body);
+ federate = msgBuffer.read_int16();
+ readFederationName(msgBuffer);
+ readFederateName(msgBuffer);
break ;
// federationTime got from header
// Body contains objectClass,handleArraySize,HandleArray
case PUBLISH_OBJECT_CLASS:
case SUBSCRIBE_OBJECT_CLASS_ATTRIBUTES:
- objectClass = body.readLongInt();
- handleArraySize = body.readShortInt();
- readHandleArray(body);
+ objectClass = msgBuffer.read_int64();
+ handleArraySize = msgBuffer.read_int16();
+ readHandleArray(msgBuffer);
break ;
// federationTime got from header
// Body contains objectClass,object,name
case REGISTER_OBJECT_INSTANCE:
- objectClass = body.readLongInt();
- object = body.readLongInt();
- readName(body);
+ objectClass = msgBuffer.read_int64();
+ object = msgBuffer.read_int64();
+ readName(msgBuffer);
break ;
// FederationTime (or zero) yet got from header
@@ -288,38 +307,38 @@
// boolean (true with time, false without time)
case UPDATE_ATTRIBUTE_VALUES:
case REFLECT_ATTRIBUTE_VALUES:
- objectClass = body.readLongInt();
- handleArraySize = body.readShortInt();
- object = body.readLongInt();
- readTag(body);
- readHandleArray(body);
- readValueArray(body);
- readResignAction(body);
- boolean = body.readLongInt();
+ objectClass = msgBuffer.read_int64();
+ handleArraySize = msgBuffer.read_int16();
+ object = msgBuffer.read_int64();
+ readTag(msgBuffer);
+ readHandleArray(msgBuffer);
+ readValueArray(msgBuffer);
+ readResignAction(msgBuffer);
+ boolean = msgBuffer.read_bool();
break ;
// FederationTime yet got from header
// Body contains objectClass,object,tag,name,label,resignAction
case DISCOVER_OBJECT_INSTANCE:
- objectClass = body.readLongInt();
- object = body.readLongInt();
- readTag(body);
- readName(body);
- readLabel(body);
- readResignAction(body);
+ objectClass = msgBuffer.read_int64();
+ object = msgBuffer.read_int64();
+ readTag(msgBuffer);
+ readName(msgBuffer);
+ readLabel(msgBuffer);
+ readResignAction(msgBuffer);
break ;
// FederationTime yet put in header
// Body contains objectClass,object,tag,name,label,resignAction
case DELETE_OBJECT_INSTANCE:
case REMOVE_OBJECT_INSTANCE:
- objectClass = body.readLongInt();
- object = body.readLongInt();
- readTag(body);
- readName(body);
- readLabel(body);
- readResignAction(body);
- boolean = body.readLongInt();
+ objectClass = msgBuffer.read_int64();
+ object = msgBuffer.read_int64();
+ readTag(msgBuffer);
+ readName(msgBuffer);
+ readLabel(msgBuffer);
+ readResignAction(msgBuffer);
+ boolean = msgBuffer.read_bool();
break ;
// Body contains object
@@ -332,31 +351,31 @@
case GET_OBJECT_CLASS_NAME:
case GET_ATTRIBUTE_HANDLE:
case GET_ATTRIBUTE_NAME:
- objectClass = body.readLongInt();
- readName(body);
- attribute = body.readShortInt();
+ objectClass = msgBuffer.read_int64();
+ readName(msgBuffer);
+ attribute = msgBuffer.read_int16();
break ;
// FederationTime yet got from header
// Body contains object,objectClass
case GET_OBJECT_CLASS:
- object = body.readLongInt();
- objectClass = body.readLongInt();
+ object = msgBuffer.read_int64();
+ objectClass = msgBuffer.read_int64();
break ;
// Body contains name,space
case GET_SPACE_HANDLE:
case GET_SPACE_NAME:
- this->readName(body);
- this->space = body.readLongInt();
+ this->readName(msgBuffer);
+ this->space = msgBuffer.read_int64();
break ;
// Body contains name,dimension,space
case GET_DIMENSION_HANDLE:
case GET_DIMENSION_NAME:
- this->readName(body);
- this->dimension = body.readLongInt();
- this->space = body.readLongInt();
+ this->readName(msgBuffer);
+ this->dimension = msgBuffer.read_int64();
+ this->space = msgBuffer.read_int64();
break ;
case SEND_INTERACTION:
@@ -364,14 +383,14 @@
// Body contains interactionClass,handleArraySize,tag,handleArray,
// valueArray,region,resignAction,boolean
// boolean true means with time, false without time
- interactionClass = body.readLongInt();
- handleArraySize = body.readShortInt();
- readTag(body);
- readHandleArray(body);
- readValueArray(body);
- region = body.readLongInt();
- readResignAction(body);
- boolean = body.readLongInt();
+ interactionClass = msgBuffer.read_int64();
+ handleArraySize = msgBuffer.read_int16();
+ readTag(msgBuffer);
+ readHandleArray(msgBuffer);
+ readValueArray(msgBuffer);
+ region = msgBuffer.read_int64();
+ readResignAction(msgBuffer);
+ boolean = msgBuffer.read_bool();
break ;
// Body contains interactionClass,name,parameter
@@ -379,50 +398,50 @@
case GET_INTERACTION_CLASS_NAME:
case GET_PARAMETER_HANDLE:
case GET_PARAMETER_NAME:
- interactionClass = body.readLongInt();
- readName(body);
- parameter = body.readShortInt();
+ interactionClass = msgBuffer.read_int64();
+ readName(msgBuffer);
+ parameter = msgBuffer.read_int16();
break ;
// Body contains handleArraySize,transport,order,object,HandleArray
case CHANGE_ATTRIBUTE_TRANSPORTATION_TYPE:
case CHANGE_ATTRIBUTE_ORDER_TYPE:
- handleArraySize = body.readShortInt();
- transport = body.readLongInt();
- order = body.readLongInt();
- object = body.readLongInt();
- readHandleArray(body);
+ handleArraySize = msgBuffer.read_int64();
+ transport = msgBuffer.read_int64();
+ order = msgBuffer.read_int64();
+ object = msgBuffer.read_int64();
+ readHandleArray(msgBuffer);
break ;
// Body contains interactionClass,transport,order
case CHANGE_INTERACTION_TRANSPORTATION_TYPE:
case CHANGE_INTERACTION_ORDER_TYPE:
- interactionClass = body.readLongInt();
- transport = body.readLongInt();
- order = body.readLongInt();
+ interactionClass = msgBuffer.read_int64();
+ transport = msgBuffer.read_int64();
+ order = msgBuffer.read_int64();
break;
// Body contains region,extents
case DDM_MODIFY_REGION:
- region = body.readLongInt();
- readExtents(body);
+ region = msgBuffer.read_int64();
+ readExtents(msgBuffer);
break ;
// Body contains region
case DDM_DELETE_REGION:
- region = body.readLongInt();
+ region = msgBuffer.read_int64();
break ;
// Body contains object,name
case GET_OBJECT_INSTANCE_HANDLE:
case GET_OBJECT_INSTANCE_NAME:
- object = body.readLongInt();
- readName(body);
+ object = msgBuffer.read_int64();
+ readName(msgBuffer);
break;
// Body contains resignAction
case RESIGN_FEDERATION_EXECUTION:
- readResignAction(body);
+ readResignAction(msgBuffer);
break;
// Body contains interactionClass
@@ -432,7 +451,7 @@
case UNSUBSCRIBE_INTERACTION_CLASS:
case TURN_INTERACTIONS_ON:
case TURN_INTERACTIONS_OFF:
- interactionClass = body.readLongInt();
+ interactionClass = msgBuffer.read_int64();
break ;
// Body contains boolean
@@ -440,47 +459,46 @@
case DISABLE_TIME_REGULATION:
case ENABLE_TIME_CONSTRAINED:
case DISABLE_TIME_CONSTRAINED:
- boolean = body.readLongInt();
+ boolean = msgBuffer.read_bool();
break ;
// Body contains boolean, TickTime, TickTime
case TICK_REQUEST:
- boolean = body.readLongInt();
- body.readBlock((char *)&minTickTime, sizeof(minTickTime));
- body.readBlock((char *)&maxTickTime, sizeof(maxTickTime));
+ boolean = msgBuffer.read_bool();
+ msgBuffer.read_bytes((char *)&minTickTime, sizeof(minTickTime));
+ msgBuffer.read_bytes((char *)&maxTickTime, sizeof(maxTickTime));
break ;
// Body contains objectClass, handleArraySize,
// handleArray
case REQUEST_CLASS_ATTRIBUTE_VALUE_UPDATE:
- objectClass = body.readLongInt();
- handleArraySize = body.readShortInt();
- readHandleArray(body);
+ objectClass = msgBuffer.read_int64();
+ handleArraySize = msgBuffer.read_int16();
+ readHandleArray(msgBuffer);
break;
// Body contains object,handleArraySize,
// handleArray
case REQUEST_OBJECT_ATTRIBUTE_VALUE_UPDATE:
- object = body.readLongInt();
- handleArraySize = body.readShortInt();
- readHandleArray(body);
+ object = msgBuffer.read_int64();
+ handleArraySize = msgBuffer.read_int16();
+ readHandleArray(msgBuffer);
break;
case PROVIDE_ATTRIBUTE_VALUE_UPDATE:
- object = body.readLongInt();
- handleArraySize = body.readShortInt();
- readHandleArray(body);
+ object = msgBuffer.read_int64();
+ handleArraySize = msgBuffer.read_int16();
+ readHandleArray(msgBuffer);
break ;
-
// -- Default Handler --
default:
- D.Out(pdExcept, "Unknown Type %d in ReadBody.", header.type);
- throw RTIinternalError("Message: Unknown Type for Body(Read).");
+ G.Out(pdGendoc,"exit Message::readBody with nothing to do");
+
}
}
- // G.Out(pdGendoc,"exit Message::readBody");
+ G.Out(pdGendoc,"exit Message::readBody");
}
// ----------------------------------------------------------------------------
@@ -488,18 +506,17 @@
RTI_TRUE if the ReadBody Method has to be called.
*/
bool
-Message::readHeader(SocketUN *socket)
+Message::readHeader(MessageBuffer &msgBuffer)
{
- // G.Out(pdGendoc,"enter Message::readHeader");
+ G.Out(pdGendoc,"enter Message::readHeader");
// 1- Read Header from Socket
- socket->receive((const unsigned char *) &header, sizeof(MessageHeader));
+ //socket->receive((const unsigned char *) &header, sizeof(MessageHeader));
// 2- Parse Header
-
- type = header.type ;
- exception = header.exception ;
- setFederationTime(header.date);
+ type = (Type)msgBuffer.read_int32() ;
+ exception = (TypeException)msgBuffer.read_int32();
+ setFederationTime(msgBuffer.read_double());
// If the message carry an exception, the Body will only contain the
// exception reason.
@@ -507,7 +524,7 @@
if (exception != e_NO_EXCEPTION)
{
- // G.Out(pdGendoc,"exit Message::readHeader carrying an exception");
+ G.Out(pdGendoc,"exit Message::readHeader carrying an exception");
return true ;
}
@@ -658,104 +675,91 @@
// Warning : FederationTime has been modified (needs validation)
case MODIFY_LOOKAHEAD:
case QUERY_LOOKAHEAD:
- lookahead = header.date ;
+ // we get another time but is the lookahead
+ lookahead = msgBuffer.read_double();
fed_time.setZero();
break ;
default:
- D.Out(pdExcept, "Unknown type %d in ReadHeader.", header.type);
- // G.Out(pdGendoc,"exit Message::readHeader on RTIinternalError
unknown type");
+ D.Out(pdExcept, "Unknown type %d in ReadHeader.", type);
+ G.Out(pdGendoc,"exit Message::readHeader on RTIinternalError unknown
type");
throw RTIinternalError("Message: Received unknown Header type.");
}
// 4- Return depends on body
- // G.Out(pdGendoc,"exit Message::readHeader");
+ G.Out(pdGendoc,"exit Message::readHeader");
- return header.bodySize != 0 ;
+ //return header.bodySize != 0 ;
+ return 0 ;
}
// ----------------------------------------------------------------------------
void
-Message::readHandleArray(MessageBody &body)
+Message::readHandleArray(MessageBuffer &msgBuffer)
{
- body.readBlock((char *) handleArray, handleArraySize *
sizeof(AttributeHandle));
+ msgBuffer.read_bytes((char *) handleArray, handleArraySize *
sizeof(AttributeHandle));
}
// ----------------------------------------------------------------------------
void
-Message::readLabel(MessageBody &body)
+Message::readLabel(MessageBuffer &msgBuffer)
{
- body.readString(label, MAX_USER_TAG_LENGTH);
+ label = msgBuffer.read_string() ;
}
// ----------------------------------------------------------------------------
void
-Message::readName(MessageBody &body)
+Message::readName(MessageBuffer &msgBuffer)
{
- body.readString(name, MAX_USER_TAG_LENGTH);
+ name = msgBuffer.read_string();
}
// ----------------------------------------------------------------------------
void
-Message::readFederationName(MessageBody &body)
+Message::readFederationName(MessageBuffer &msgBuffer)
{
- short federationNameSize ;
-
- federationNameSize = body.readShortInt() ;
- federationName = new char[federationNameSize+1] ;
- if ( federationNameSize == 0 )
- federationName[0] = '\0' ;
- else
- body.readString(federationName,federationNameSize);
-
+ federationName = msgBuffer.read_string() ;
}
// ----------------------------------------------------------------------------
void
-Message::readFederateName(MessageBody &body)
+Message::readFederateName(MessageBuffer &msgBuffer)
{
- body.readString(federateName, MAX_FEDERATE_NAME_LENGTH);
+ federateName = msgBuffer.read_string() ;
}
// ----------------------------------------------------------------------------
void
-Message::readResignAction(MessageBody &)
+Message::readResignAction(MessageBuffer &msgBuffer)
{
// BUG: Should do something.
}
// ----------------------------------------------------------------------------
void
-Message::readTag(MessageBody &body)
+Message::readTag(MessageBuffer &msgBuffer)
{
- body.readString(tag, MAX_USER_TAG_LENGTH);
+ tag = msgBuffer.read_string();
}
// ----------------------------------------------------------------------------
void
-Message::readFEDid(MessageBody &body)
+Message::readFEDid(MessageBuffer &msgBuffer)
{
- short FEDidSize ;
-
- FEDidSize = body.readShortInt() ;
- FEDid = new char[FEDidSize+1] ;
- if ( FEDidSize == 0 )
- FEDid[0] = '\0' ;
- else
- body.readString(FEDid,FEDidSize);
+ FEDid = msgBuffer.read_string();
}
// ----------------------------------------------------------------------------
//! readValueArray.
void
-Message::readValueArray(MessageBody &body)
+Message::readValueArray(MessageBuffer &msgBuffer)
{
// valueArray contains length and value
-// so we have to read length and then value with a readBlock
+// so we have to read length and then value with a read_bytes
for (int i = 0 ; i < handleArraySize ; i ++)
{
- valueArray[i].length = body.readLongInt() ;
- body.readBlock((char *) valueArray[i].value, valueArray[i].length);
+ valueArray[i].length = msgBuffer.read_int64() ;
+ msgBuffer.read_bytes((char *) valueArray[i].value,
valueArray[i].length);
}
}
@@ -769,4 +773,4 @@
} // namespace certi
-// $Id: Message_R.cc,v 3.23 2008/05/22 12:20:20 erk Exp $
+// $Id: Message_R.cc,v 3.24 2008/05/29 12:20:37 rousse Exp $
Index: libCERTI/Message_W.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message_W.cc,v
retrieving revision 3.27
retrieving revision 3.28
diff -u -b -r3.27 -r3.28
--- libCERTI/Message_W.cc 27 May 2008 07:51:55 -0000 3.27
+++ libCERTI/Message_W.cc 29 May 2008 12:20:38 -0000 3.28
@@ -17,7 +17,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: Message_W.cc,v 3.27 2008/05/27 07:51:55 rousse Exp $
+// $Id: Message_W.cc,v 3.28 2008/05/29 12:20:38 rousse Exp $
// ----------------------------------------------------------------------------
@@ -32,131 +32,116 @@
static PrettyDebug D("RTIA_MSG","Message::");
static PrettyDebug G("GENDOC",__FILE__);
+//-----------------------------------------------------------------------------
+void
+Message::send(SocketUN *socket, MessageBuffer &msgBuffer) throw (NetworkError,
NetworkSignal) {
+ G.Out(pdGendoc,"enter Message::send");
+ /* 0- reset send buffer */
+ msgBuffer.reset();
+ /* 1- serialize the message
+ * This is a polymorphic call
+ * which may specialized in a daughter class
+ */
+ serialize(msgBuffer);
+ /* 2- update message buffer 'reserved bytes' header */
+ msgBuffer.updateReservedBytes();
+ D.Out(pdDebug,"Sending <%s> whose buffer has <%u>
bytes",getName().c_str(),msgBuffer.size());
+ //msgBuf.show(msgBuffer(0),5);
+ /* 3- effectively send the raw message to socket */
+ socket->send(static_cast<unsigned char*>(msgBuffer(0)),
msgBuffer.size());
+ G.Out(pdGendoc,"exit Message::send");
+} /* end of send */
+
// ----------------------------------------------------------------------------
void Message::serialize(MessageBuffer& msgBuffer) {
G.Out(pdGendoc,"enter Message::serialize");
- /* We serialize the common Network messages part
- * ALL Network Message will contain the following
+ /* We serialize the common messages part
+ * ALL Message will contain the following
*/
if ((type==NOT_USED) || (type==LAST)) {
throw RTIinternalError("Invalid message type (not a valid
type);");
}
D.Out(pdDebug, "Serialize <%s>", getName().c_str());
- /* type of message */
- msgBuffer.write_int32(type);
- msgBuffer.write_int32(exception);
+ writeHeader(msgBuffer);
+ writeBody(msgBuffer);
/*
* "builtin" Optional part
* The subclass may chose in the constructor the variable part.
* isDated may be chosen on Message instance basis
* (same message may Dated or Not Dated)
*/
- msgBuffer.write_bool(_isDated);
- if (_isDated) {
- msgBuffer.write_double(getFederationTime());
- D.Out(pdDebug, "Sent Message date is <%f>",getFederationTime()
);
- }
- msgBuffer.write_bool(_isLabelled);
- if (_isLabelled) {
- msgBuffer.write_string(label);
- }
- msgBuffer.write_bool(_isTagged);
- if (_isTagged) {
- msgBuffer.write_string(tag);
- }
G.Out(pdGendoc,"exit Message::serialize");
} /* end of serialize */
-
-// ----------------------------------------------------------------------------
-//! Write NetworkMessage Objects to Socket objects.
-void
-Message::write(SocketUN *socket)
- throw (NetworkError, NetworkSignal)
-{
- // G.Out(pdGendoc,"enter Message::write");
- bool result ;
- result = writeHeader(socket);
- if (result)
- writeBody(socket);
- // G.Out(pdGendoc,"exit Message::write");
-}
-
// ----------------------------------------------------------------------------
/*! Prepare and write a Body to a socket, should be called after WriteHeader.
The message is written onto the socket by WriteHeader if no body is
required, or by WriteBody is a body has been required by WriteHeader.
*/
void
-Message::writeBody(SocketUN *socket)
+Message::writeBody(MessageBuffer &msgBuffer)
{
- MessageBody body ;
- // G.Out(pdGendoc,"enter Message::writeBody type %d",header.type);
- // 0- Copy the Header at the beginning of the Body, in order to
- // make a single Socket->Emettre call while sending both.
- // WARNING: As the Body size is not known yet, we will have to
- // change it in the copy also!
- body.writeBlock((char *) &header, sizeof(MessageHeader));
+ G.Out(pdGendoc,"enter Message::writeBody type %d",type);
// If the message carry an exception, the Body will only contain the
// exception reason.
- if (header.exception != e_NO_EXCEPTION) {
- body.writeString(exceptionReason);
+ if (exception != e_NO_EXCEPTION) {
+ msgBuffer.write_string(exceptionReason);
}
else {
// 1- Prepare Body Structure according to Message type
- switch(header.type) {
+ switch(type) {
// Body contains federationName,FEDid
case CREATE_FEDERATION_EXECUTION:
- writeFederationName(body);
- writeFEDid(body);
+ writeFederationName(msgBuffer);
+ writeFEDid(msgBuffer);
break ;
// Body contains federationName
case DESTROY_FEDERATION_EXECUTION:
- writeFederationName(body);
+ writeFederationName(msgBuffer);
break ;
// Body contains label,tag,boolean and maybe
// handleArraySize,handleArray
case REGISTER_FEDERATION_SYNCHRONIZATION_POINT:
- body.writeString(label);
- body.writeString(tag);
- body.writeLongInt(boolean);
+ msgBuffer.write_string(label);
+ msgBuffer.write_string(tag);
+ msgBuffer.write_bool(boolean);
// boolean true means federates set exists
if ( boolean )
{
- body.writeShortInt(handleArraySize);
- writeHandleArray(body);
+ msgBuffer.write_int16(handleArraySize);
+ writeHandleArray(msgBuffer);
}
break ;
// RFS needs label and boolean in the body and time in the header
case REQUEST_FEDERATION_SAVE:
- body.writeString(label);
- body.writeLongInt(boolean);
+ msgBuffer.write_string(label);
+ msgBuffer.write_bool(boolean);
break;
// Body contains label
case INITIATE_FEDERATE_SAVE:
- body.writeString(label);
+ msgBuffer.write_string(label);
break;
// Body contains federate,label
case INITIATE_FEDERATE_RESTORE:
- body.writeShortInt(federate);
- body.writeString(label);
+ msgBuffer.write_int16(federate);
+ msgBuffer.write_string(label);
break;
// Body contains label,tag
case ANNOUNCE_SYNCHRONIZATION_POINT:
case REQUEST_FEDERATION_RESTORE_FAILED:
- body.writeString(label);
- body.writeString(tag);
+ msgBuffer.write_string(label);
+ msgBuffer.write_string(tag);
break ;
// Body contains label (i.e. String)
@@ -166,7 +151,7 @@
case FEDERATION_SYNCHRONIZED:
case REQUEST_FEDERATION_RESTORE:
case REQUEST_FEDERATION_RESTORE_SUCCEEDED:
- body.writeString(label);
+ msgBuffer.write_string(label);
break ;
// Body contains objectClass
@@ -174,23 +159,23 @@
case UNSUBSCRIBE_OBJECT_CLASS:
case START_REGISTRATION_FOR_OBJECT_CLASS:
case STOP_REGISTRATION_FOR_OBJECT_CLASS:
- body.writeLongInt(objectClass);
+ msgBuffer.write_int64(objectClass);
break;
// Body contains object,attribute,tag
case IS_ATTRIBUTE_OWNED_BY_FEDERATE:
case QUERY_ATTRIBUTE_OWNERSHIP:
- body.writeLongInt(object);
- body.writeShortInt(attribute);
- body.writeString(tag);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_int16(attribute);
+ msgBuffer.write_string(tag);
break ;
// Body contains object,attribute,federate
case ATTRIBUTE_IS_NOT_OWNED:
case INFORM_ATTRIBUTE_OWNERSHIP:
- body.writeLongInt(object);
- body.writeShortInt(attribute);
- body.writeShortInt(federate);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_int16(attribute);
+ msgBuffer.write_int16(federate);
break ;
// Body contains object,handleArraySize,HandleArray,tag
@@ -198,10 +183,10 @@
case REQUEST_ATTRIBUTE_OWNERSHIP_ASSUMPTION:
case ATTRIBUTE_OWNERSHIP_ACQUISITION:
case REQUEST_ATTRIBUTE_OWNERSHIP_RELEASE:
- body.writeLongInt(object);
- body.writeShortInt(handleArraySize);
- writeHandleArray(body);
- body.writeString(tag);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_int16(handleArraySize);
+ writeHandleArray(msgBuffer);
+ msgBuffer.write_string(tag);
break ;
// Body contains object,handleArraySize,HandleArray
@@ -214,121 +199,121 @@
case ATTRIBUTE_OWNERSHIP_RELEASE_RESPONSE:
case CANCEL_ATTRIBUTE_OWNERSHIP_ACQUISITION:
case CONFIRM_ATTRIBUTE_OWNERSHIP_ACQUISITION_CANCELLATION:
- body.writeLongInt(object);
- body.writeShortInt(handleArraySize);
- writeHandleArray(body);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_int16(handleArraySize);
+ writeHandleArray(msgBuffer);
break ;
// Body contains object,handleArraySize,
// handleArray
case REQUEST_OBJECT_ATTRIBUTE_VALUE_UPDATE:
- body.writeLongInt(object);
- body.writeShortInt(handleArraySize);
- writeHandleArray(body);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_int16(handleArraySize);
+ writeHandleArray(msgBuffer);
break ;
// Body contains object,handleArraySize,
// handleArray
case PROVIDE_ATTRIBUTE_VALUE_UPDATE:
- body.writeLongInt(object);
- body.writeShortInt(handleArraySize);
- writeHandleArray(body);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_int16(handleArraySize);
+ writeHandleArray(msgBuffer);
break ;
// Body contains object,region,boolean,handleArraySize,handleArray
case DDM_ASSOCIATE_REGION:
- body.writeLongInt(object);
- body.writeLongInt(region);
- body.writeLongInt(boolean);
- body.writeShortInt(handleArraySize);
- writeHandleArray(body);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_int64(region);
+ msgBuffer.write_bool(boolean);
+ msgBuffer.write_int16(handleArraySize);
+ writeHandleArray(msgBuffer);
break ;
// Body contains objectClass,object,tag,handleArraySize,handleArray,
// regions
case DDM_REGISTER_OBJECT:
- body.writeLongInt(objectClass);
- body.writeLongInt(object);
- body.writeString(tag);
- body.writeShortInt(handleArraySize);
- writeHandleArray(body);
- writeRegions(body);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_string(tag);
+ msgBuffer.write_int16(handleArraySize);
+ writeHandleArray(msgBuffer);
+ writeRegions(msgBuffer);
break ;
// Body contains objectClass,region,boolean,handleArraySize,
// handleArray
case DDM_SUBSCRIBE_ATTRIBUTES:
- body.writeLongInt(objectClass);
- body.writeLongInt(region);
- body.writeLongInt(boolean);
- body.writeShortInt(handleArraySize);
- writeHandleArray(body);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_int64(region);
+ msgBuffer.write_bool(boolean);
+ msgBuffer.write_int16(handleArraySize);
+ writeHandleArray(msgBuffer);
break ;
// Body contains object,region
case DDM_UNASSOCIATE_REGION:
- body.writeLongInt(object);
- body.writeLongInt(region);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_int64(region);
break ;
// Body contains objectClass,region
case DDM_UNSUBSCRIBE_ATTRIBUTES:
- body.writeLongInt(objectClass);
- body.writeLongInt(region);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_int64(region);
break ;
// Body contains interactionClass,region,boolean
case DDM_SUBSCRIBE_INTERACTION:
case DDM_UNSUBSCRIBE_INTERACTION:
- body.writeLongInt(interactionClass);
- body.writeLongInt(region);
- body.writeLongInt(boolean);
+ msgBuffer.write_int64(interactionClass);
+ msgBuffer.write_int64(region);
+ msgBuffer.write_bool(boolean);
break ;
// Body contains objectClass,attribute,space
case GET_ATTRIBUTE_SPACE_HANDLE:
- body.writeLongInt(objectClass);
- body.writeLongInt(attribute);
- body.writeLongInt(space);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_int64(attribute);
+ msgBuffer.write_int64(space);
break ;
// Body contains space,number,region
case DDM_CREATE_REGION:
- body.writeLongInt(space) ;
- body.writeLongInt(number);
- body.writeLongInt(region);
+ msgBuffer.write_int64(space) ;
+ msgBuffer.write_int64(number);
+ msgBuffer.write_int64(region);
break ;
// Body contains interactionClass,space
case GET_INTERACTION_SPACE_HANDLE:
- body.writeLongInt(interactionClass);
- body.writeLongInt(space);
+ msgBuffer.write_int64(interactionClass);
+ msgBuffer.write_int64(space);
break ;
// Body contains federate,federationName,federateName
// Note : federate relevant on RTIA answer only
case JOIN_FEDERATION_EXECUTION:
- body.writeShortInt(federate);
- writeFederationName(body);
- body.writeString(federateName);
+ msgBuffer.write_int16(federate);
+ writeFederationName(msgBuffer);
+ msgBuffer.write_string(federateName);
break ;
// FederationTime yet put in header
// Body contains objectClass,handleArraySize,HandleArray
case PUBLISH_OBJECT_CLASS:
case SUBSCRIBE_OBJECT_CLASS_ATTRIBUTES:
- body.writeLongInt(objectClass);
- body.writeShortInt(handleArraySize);
- writeHandleArray(body);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_int16(handleArraySize);
+ writeHandleArray(msgBuffer);
break ;
// FederationTime yet put in header
// Body contains objectClass,object,name
case REGISTER_OBJECT_INSTANCE:
- body.writeLongInt(objectClass);
- body.writeLongInt(object);
- body.writeString(name);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_string(name);
break ;
// FederationTime (or zero) yet put in header
@@ -337,43 +322,43 @@
// boolean (true with time, false without time)
case UPDATE_ATTRIBUTE_VALUES:
case REFLECT_ATTRIBUTE_VALUES:
- body.writeLongInt(objectClass);
- body.writeShortInt(handleArraySize);
- body.writeLongInt(object);
- body.writeString(tag);
- writeHandleArray(body);
- writeValueArray(body);
- writeResignAction(body);
- body.writeLongInt(boolean);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_int16(handleArraySize);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_string(tag);
+ writeHandleArray(msgBuffer);
+ writeValueArray(msgBuffer);
+ writeResignAction(msgBuffer);
+ msgBuffer.write_bool(boolean);
break ;
// FederationTime yet put in header
// Body contains objectClass,object,tag,name,label,resignAction
case DISCOVER_OBJECT_INSTANCE:
- body.writeLongInt(objectClass);
- body.writeLongInt(object);
- body.writeString(tag);
- body.writeString(name);
- body.writeString(label);
- writeResignAction(body);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_string(tag);
+ msgBuffer.write_string(name);
+ msgBuffer.write_string(label);
+ writeResignAction(msgBuffer);
break ;
// FederationTime yet put in header
// Body contains objectClass,object,tag,name,label,resignAction
case DELETE_OBJECT_INSTANCE:
case REMOVE_OBJECT_INSTANCE:
- body.writeLongInt(objectClass);
- body.writeLongInt(object);
- body.writeString(tag);
- body.writeString(name);
- body.writeString(label);
- writeResignAction(body);
- body.writeLongInt(boolean);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_string(tag);
+ msgBuffer.write_string(name);
+ msgBuffer.write_string(label);
+ writeResignAction(msgBuffer);
+ msgBuffer.write_bool(boolean);
break ;
// Body contains object
case LOCAL_DELETE_OBJECT_INSTANCE:
- body.writeLongInt(object);
+ msgBuffer.write_int64(object);
break;
// FederationTime yet put in header
@@ -382,31 +367,31 @@
case GET_OBJECT_CLASS_NAME:
case GET_ATTRIBUTE_HANDLE:
case GET_ATTRIBUTE_NAME:
- body.writeLongInt(objectClass);
- body.writeString(name);
- body.writeShortInt(attribute);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_string(name);
+ msgBuffer.write_int16(attribute);
break ;
// FederationTime yet put in header
// Body contains object,objectClass
case GET_OBJECT_CLASS:
- body.writeLongInt(object);
- body.writeLongInt(objectClass);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_int64(objectClass);
break;
// Body contains name,space
case GET_SPACE_HANDLE:
case GET_SPACE_NAME:
- body.writeString(name);
- body.writeLongInt(space);
+ msgBuffer.write_string(name);
+ msgBuffer.write_int64(space);
break ;
// Body contains name,dimension,space
case GET_DIMENSION_HANDLE:
case GET_DIMENSION_NAME:
- body.writeString(name);
- body.writeLongInt(dimension);
- body.writeLongInt(space);
+ msgBuffer.write_string(name);
+ msgBuffer.write_int64(dimension);
+ msgBuffer.write_int64(space);
break ;
// Body contains interactionClass,handleArraySize,tag,handleArray,
@@ -414,14 +399,14 @@
// and boolean (true with time, false without time)
case SEND_INTERACTION:
case RECEIVE_INTERACTION:
- body.writeLongInt(interactionClass);
- body.writeShortInt(handleArraySize);
- body.writeString(tag);
- writeHandleArray(body);
- writeValueArray(body);
- body.writeLongInt(region);
- writeResignAction(body);
- body.writeLongInt(boolean);
+ msgBuffer.write_int64(interactionClass);
+ msgBuffer.write_int16(handleArraySize);
+ msgBuffer.write_string(tag);
+ writeHandleArray(msgBuffer);
+ writeValueArray(msgBuffer);
+ msgBuffer.write_int64(region);
+ writeResignAction(msgBuffer);
+ msgBuffer.write_bool(boolean);
break ;
// Body contains interactionClass,name,parameter
@@ -429,50 +414,50 @@
case GET_INTERACTION_CLASS_NAME:
case GET_PARAMETER_HANDLE:
case GET_PARAMETER_NAME:
- body.writeLongInt(interactionClass);
- body.writeString(name);
- body.writeShortInt(parameter);
+ msgBuffer.write_int64(interactionClass);
+ msgBuffer.write_string(name);
+ msgBuffer.write_int16(parameter);
break ;
// Body contains handleArraySize,transport,order,object,HandleArray
case CHANGE_ATTRIBUTE_TRANSPORTATION_TYPE:
case CHANGE_ATTRIBUTE_ORDER_TYPE:
- body.writeShortInt(handleArraySize);
- body.writeLongInt(transport);
- body.writeLongInt(order);
- body.writeLongInt(object);
- writeHandleArray(body);
+ msgBuffer.write_int16(handleArraySize);
+ msgBuffer.write_int64(transport);
+ msgBuffer.write_int64(order);
+ msgBuffer.write_int64(object);
+ writeHandleArray(msgBuffer);
break ;
// Body contains interactionClass,transport,order
case CHANGE_INTERACTION_TRANSPORTATION_TYPE:
case CHANGE_INTERACTION_ORDER_TYPE:
- body.writeLongInt(interactionClass);
- body.writeLongInt(transport);
- body.writeLongInt(order);
+ msgBuffer.write_int64(interactionClass);
+ msgBuffer.write_int64(transport);
+ msgBuffer.write_int64(order);
break ;
// Body contains region,extents
case DDM_MODIFY_REGION:
- body.writeLongInt(region);
- writeExtents(body);
+ msgBuffer.write_int64(region);
+ writeExtents(msgBuffer);
break ;
// Body contains region
case DDM_DELETE_REGION:
- body.writeLongInt(region);
+ msgBuffer.write_int64(region);
break ;
// Body contains object,name
case GET_OBJECT_INSTANCE_HANDLE:
case GET_OBJECT_INSTANCE_NAME :
- body.writeLongInt(object);
- body.writeString(name);
+ msgBuffer.write_int64(object);
+ msgBuffer.write_string(name);
break;
// Body contains ResignAction
case RESIGN_FEDERATION_EXECUTION:
- writeResignAction(body);
+ writeResignAction(msgBuffer);
break;
// Body contains interactionClass
@@ -482,7 +467,7 @@
case UNSUBSCRIBE_INTERACTION_CLASS:
case TURN_INTERACTIONS_ON:
case TURN_INTERACTIONS_OFF:
- body.writeLongInt(interactionClass);
+ msgBuffer.write_int64(interactionClass);
break ;
// Body contains boolean
@@ -490,52 +475,39 @@
case DISABLE_TIME_REGULATION:
case ENABLE_TIME_CONSTRAINED:
case DISABLE_TIME_CONSTRAINED:
- body.writeLongInt(boolean);
+ msgBuffer.write_bool(boolean);
break ;
// Body contains boolean, TickTime, TickTime
case TICK_REQUEST:
- body.writeLongInt(boolean);
- body.writeBlock((char *)&minTickTime, sizeof(minTickTime));
- body.writeBlock((char *)&maxTickTime, sizeof(maxTickTime));
+ msgBuffer.write_bool(boolean);
+ msgBuffer.write_bytes((char *)&minTickTime, sizeof(minTickTime));
+ msgBuffer.write_bytes((char *)&maxTickTime, sizeof(maxTickTime));
break ;
// Body contains objectClass, handleArray
case REQUEST_CLASS_ATTRIBUTE_VALUE_UPDATE:
- body.writeLongInt(objectClass);
- body.writeShortInt(handleArraySize);
- writeHandleArray(body);
+ msgBuffer.write_int64(objectClass);
+ msgBuffer.write_int16(handleArraySize);
+ writeHandleArray(msgBuffer);
break;
// -- Default Handler --
default:
- D.Out(pdExcept, "Unknown type %d in Writebody.", header.type);
- throw RTIinternalError("Message: Unknown type for body.");
+ // Nothing to do
+ G.Out(pdGendoc,"exit Message::writeBody with nothing to do");
}
}
-
- // 2- Set Header.bodySize
-
- // Body Size does not include the copy of the Header!
- header.bodySize = body.size() - sizeof(MessageHeader);
-
- // Put the real Body Size in the copy of the Header.
- (reinterpret_cast<MessageHeader *>(body.getBufferModeRW()))->bodySize =
header.bodySize ;
-
- // 3- Write Header to socket, then write Body to socket.
- // socket->send((void *) &Header, sizeof(MessageHeader));
- // G.Out(pdGendoc," Message::writeBody ======> send Message");
- socket->send(body.getBuffer(), body.size());
- // G.Out(pdGendoc,"exit Message::writeBody");
+ G.Out(pdGendoc,"exit Message::writeBody");
}
// ----------------------------------------------------------------------------
void
-Message::writeHandleArray(MessageBody &body)
+Message::writeHandleArray(MessageBuffer &msgBuffer)
{
- body.writeBlock((char *) handleArray, handleArraySize *
sizeof(AttributeHandle));
+ msgBuffer.write_bytes( (char *)handleArray,(unsigned int)(handleArraySize
* sizeof(AttributeHandle))) ;
}
// ----------------------------------------------------------------------------
@@ -545,25 +517,21 @@
required, or by WriteBody is a body has been required by WriteHeader.
*/
bool
-Message::writeHeader(SocketUN *socket)
+Message::writeHeader(MessageBuffer &msgBuffer)
{
- // G.Out(pdGendoc,"enter Message::writeHeader");
- // 1- Clear Header
- memset((void *) &header, '\0', sizeof(MessageHeader));
+ G.Out(pdGendoc,"enter Message::writeHeader");
- // 2- Fill Header
// header contains type,exception and federationTime
// Note sometimes federationTime is not useful.
- header.type = this->type ;
- header.exception = this->exception ;
- header.date = getFederationTime();
+ msgBuffer.write_int32(this->type) ;
+ msgBuffer.write_int32(this->exception);
+ msgBuffer.write_double(getFederationTime());
// If the message carry an exception, the Body will only contain the
// exception reason.
D.Out(pdDebug,"Sent message type <%d> ",type);
if (exception != e_NO_EXCEPTION) {
- header.bodySize = 1 ;
- // G.Out(pdGendoc,"exit Message::writeHeader carrying exception");
+ G.Out(pdGendoc,"exit Message::writeHeader carrying exception");
return true ;
}
@@ -643,7 +611,7 @@
case REQUEST_CLASS_ATTRIBUTE_VALUE_UPDATE:
case PROVIDE_ATTRIBUTE_VALUE_UPDATE:
case TICK_REQUEST:
- header.bodySize = 1 ;
+ //header.bodySize = 1 ;
break ;
// ------- federationTime (relevant or zero) depending on boolean value
@@ -653,11 +621,12 @@
case REFLECT_ATTRIBUTE_VALUES:
case SEND_INTERACTION:
case RECEIVE_INTERACTION:
- if ( ! boolean )
- {
- header.date = 0 ;
- }
- header.bodySize = 1 ;
+ //if ( ! boolean )
+ //{
+ //msgBuffer.write_double(0);
+ //header.date = 0 ;
+ //}
+ //header.bodySize = 1 ;
break ;
// ------- federationTime useful
@@ -682,7 +651,7 @@
case GET_DIMENSION_NAME:
case GET_OBJECT_INSTANCE_HANDLE:
case GET_OBJECT_INSTANCE_NAME:
- header.bodySize = 1 ;
+ //header.bodySize = 1 ;
break ;
// --------------------- BODY EMPTY ----------------------------
@@ -702,7 +671,7 @@
case ENABLE_ASYNCHRONOUS_DELIVERY:
case DISABLE_ASYNCHRONOUS_DELIVERY:
case TICK_REQUEST_NEXT:
- header.bodySize = 0 ;
+ //header.bodySize = 0 ;
break ;
// ------- federationTime useful
@@ -716,72 +685,71 @@
case TIME_ADVANCE_GRANT:
case TIME_REGULATION_ENABLED:
case TIME_CONSTRAINED_ENABLED:
- header.bodySize = 0 ;
+ //header.bodySize = 0 ;
break ;
// federationTime yet put in header
// We store lookahead in place
case MODIFY_LOOKAHEAD:
case QUERY_LOOKAHEAD:
- header.date = lookahead ;
- header.bodySize = 0 ;
+ //header.date = lookahead ;
+ // we store another time but is the lookahead
+ msgBuffer.write_double(lookahead);
+ //header.bodySize = 0 ;
break ;
// -- Default Handler --
default:
- D.Out(pdExcept, "Unknown type %d in WriteHeader.", header.type);
- throw RTIinternalError("Message: Unknown type for Header.");
+ // Nothing to do
+ G.Out(pdGendoc,"exit Message::writeHeader with nothing to do");
+ return 0;
}
// 4- If Header.bodySize = 0, send message and return RTI_FALSE,
// Else send nothing(will be done by WriteBody), and return RTI_TRUE.
- if (header.bodySize == 0)
- socket->send((const unsigned char *) &header, sizeof(MessageHeader));
+ //if (header.bodySize == 0)
+ //socket->send((const unsigned char *) &header, sizeof(MessageHeader));
- // G.Out(pdGendoc,"exit Message::writeHeader");
- return header.bodySize != 0 ;
+ G.Out(pdGendoc,"exit Message::writeHeader");
+ //return header.bodySize != 0 ;
+ return 0;
}
// ---------------------------------------------------------------
void
-Message::writeResignAction(MessageBody &)
+Message::writeResignAction(MessageBuffer &msgBuffer)
{
//assert(false);
}
// ---------------------------------------------------------------
void
-Message::writeFEDid(MessageBody &body)
+Message::writeFEDid(MessageBuffer &msgBuffer)
{
- body.writeShortInt(strlen(FEDid));
- body.writeString(FEDid);
+ msgBuffer.write_string(FEDid) ;
}
// ---------------------------------------------------------------
void
-Message::writeFederationName(MessageBody &body)
+Message::writeFederationName(MessageBuffer &msgBuffer)
{
- body.writeShortInt(strlen(federationName));
- if ( strlen(federationName) != 0 )
- {
- body.writeString(federationName);
- }
+ msgBuffer.write_string(federationName) ;
}
// ---------------------------------------------------------------------------
void
-Message::writeValueArray(MessageBody &body)
+Message::writeValueArray(MessageBuffer &msgBuffer)
{
// length and value are stored into valueArray
- // so we have to write length and then value with a writeBlock
+ // so we have to write length and then value with a write_bytes
for (int i = 0 ; i < handleArraySize ; i ++)
{
- body.writeLongInt(valueArray[i].length) ;
- body.writeBlock(valueArray[i].value, valueArray[i].length) ;
+ msgBuffer.write_int64(valueArray[i].length) ;
+ msgBuffer.write_bytes(valueArray[i].value, valueArray[i].length) ;
}
}
} // namespace certi
-// $Id: Message_W.cc,v 3.27 2008/05/27 07:51:55 rousse Exp $
+// $Id: Message_W.cc,v 3.28 2008/05/29 12:20:38 rousse Exp $
Index: libCERTI/ObjectClass.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.cc,v
retrieving revision 3.44
retrieving revision 3.45
diff -u -b -r3.44 -r3.45
--- libCERTI/ObjectClass.cc 13 May 2008 13:03:49 -0000 3.44
+++ libCERTI/ObjectClass.cc 29 May 2008 12:20:38 -0000 3.45
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClass.cc,v 3.44 2008/05/13 13:03:49 rousse Exp $
+// $Id: ObjectClass.cc,v 3.45 2008/05/29 12:20:38 rousse Exp $
// ----------------------------------------------------------------------------
#include "Object.hh"
@@ -323,7 +323,7 @@
ObjectClass::deleteInstance(FederateHandle the_federate,
ObjectHandle the_object,
FederationTime theTime,
- const char *the_tag)
+ std::string the_tag)
throw (DeletePrivilegeNotHeld,
ObjectNotKnown,
RTIinternalError)
@@ -391,7 +391,7 @@
ObjectClassBroadcastList *
ObjectClass::deleteInstance(FederateHandle the_federate,
ObjectHandle the_object,
- const char *the_tag)
+ std::string the_tag)
throw (DeletePrivilegeNotHeld,
ObjectNotKnown,
RTIinternalError)
@@ -1810,4 +1810,4 @@
} // namespace certi
-// $Id: ObjectClass.cc,v 3.44 2008/05/13 13:03:49 rousse Exp $
+// $Id: ObjectClass.cc,v 3.45 2008/05/29 12:20:38 rousse Exp $
Index: libCERTI/ObjectClass.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClass.hh,v
retrieving revision 3.32
retrieving revision 3.33
diff -u -b -r3.32 -r3.33
--- libCERTI/ObjectClass.hh 26 Apr 2008 14:59:40 -0000 3.32
+++ libCERTI/ObjectClass.hh 29 May 2008 12:20:38 -0000 3.33
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClass.hh,v 3.32 2008/04/26 14:59:40 erk Exp $
+// $Id: ObjectClass.hh,v 3.33 2008/05/29 12:20:38 rousse Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_OBJECT_CLASS_HH
@@ -177,14 +177,14 @@
ObjectClassBroadcastList *deleteInstance(FederateHandle theFederateHandle,
ObjectHandle theObjectHandle,
FederationTime theTime,
- const char *theUserTag)
+ std::string theUserTag)
throw (DeletePrivilegeNotHeld,
ObjectNotKnown,
RTIinternalError);
ObjectClassBroadcastList *deleteInstance(FederateHandle theFederateHandle,
ObjectHandle theObjectHandle,
- const char *theUserTag)
+ std::string theUserTag)
throw (DeletePrivilegeNotHeld,
ObjectNotKnown,
RTIinternalError);
@@ -260,4 +260,4 @@
#endif // _CERTI_OBJECT_CLASS_HH
-// $Id: ObjectClass.hh,v 3.32 2008/04/26 14:59:40 erk Exp $
+// $Id: ObjectClass.hh,v 3.33 2008/05/29 12:20:38 rousse Exp $
Index: libCERTI/ObjectClassSet.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClassSet.cc,v
retrieving revision 3.34
retrieving revision 3.35
diff -u -b -r3.34 -r3.35
--- libCERTI/ObjectClassSet.cc 13 May 2008 13:03:50 -0000 3.34
+++ libCERTI/ObjectClassSet.cc 29 May 2008 12:20:38 -0000 3.35
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClassSet.cc,v 3.34 2008/05/13 13:03:50 rousse Exp $
+// $Id: ObjectClassSet.cc,v 3.35 2008/05/29 12:20:38 rousse Exp $
// ----------------------------------------------------------------------------
// Project
@@ -137,7 +137,7 @@
ObjectClassSet::deleteObject(FederateHandle federate,
ObjectHandle object,
FederationTime theTime,
- const char *tag)
+ std::string tag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError)
{
// It may throw ObjectNotKnown
@@ -179,7 +179,7 @@
void
ObjectClassSet::deleteObject(FederateHandle federate,
ObjectHandle object,
- const char *tag)
+ std::string tag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError)
{
// It may throw ObjectNotKnown
@@ -843,4 +843,4 @@
} // namespace certi
-// $Id: ObjectClassSet.cc,v 3.34 2008/05/13 13:03:50 rousse Exp $
+// $Id: ObjectClassSet.cc,v 3.35 2008/05/29 12:20:38 rousse Exp $
Index: libCERTI/ObjectClassSet.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectClassSet.hh,v
retrieving revision 3.26
retrieving revision 3.27
diff -u -b -r3.26 -r3.27
--- libCERTI/ObjectClassSet.hh 5 Dec 2007 12:29:40 -0000 3.26
+++ libCERTI/ObjectClassSet.hh 29 May 2008 12:20:39 -0000 3.27
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: ObjectClassSet.hh,v 3.26 2007/12/05 12:29:40 approx Exp $
+// $Id: ObjectClassSet.hh,v 3.27 2008/05/29 12:20:39 rousse Exp $
// ----------------------------------------------------------------------------
#ifndef _CERTI_OBJECT_CLASS_SET_HH
@@ -93,12 +93,12 @@
void deleteObject(FederateHandle theFederateHandle,
ObjectHandle theObjectHandle,
FederationTime theTime,
- const char *theTag)
+ std::string theTag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError);
void deleteObject(FederateHandle theFederateHandle,
ObjectHandle theObjectHandle,
- const char *theTag)
+ std::string theTag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError);
void registerObjectInstance(FederateHandle, Object *, ObjectClassHandle)
@@ -210,4 +210,4 @@
#endif // _CERTI_OBJECT_CLASS_SET_HH
-// $Id: ObjectClassSet.hh,v 3.26 2007/12/05 12:29:40 approx Exp $
+// $Id: ObjectClassSet.hh,v 3.27 2008/05/29 12:20:39 rousse Exp $
Index: libCERTI/ObjectSet.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectSet.cc,v
retrieving revision 3.19
retrieving revision 3.20
diff -u -b -r3.19 -r3.20
--- libCERTI/ObjectSet.cc 26 Apr 2008 14:59:40 -0000 3.19
+++ libCERTI/ObjectSet.cc 29 May 2008 12:20:39 -0000 3.20
@@ -175,7 +175,7 @@
void
ObjectSet::deleteObjectInstance(FederateHandle,
ObjectHandle the_object,
- const char *)
+ std::string the_tag)
throw (ObjectNotKnown,
DeletePrivilegeNotHeld,
FederateNotExecutionMember,
@@ -458,4 +458,4 @@
}
} // namespace certi
-// $Id: ObjectSet.cc,v 3.19 2008/04/26 14:59:40 erk Exp $
+// $Id: ObjectSet.cc,v 3.20 2008/05/29 12:20:39 rousse Exp $
Index: libCERTI/ObjectSet.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/ObjectSet.hh,v
retrieving revision 3.10
retrieving revision 3.11
diff -u -b -r3.10 -r3.11
--- libCERTI/ObjectSet.hh 28 Feb 2008 14:47:59 -0000 3.10
+++ libCERTI/ObjectSet.hh 29 May 2008 12:20:39 -0000 3.11
@@ -74,7 +74,7 @@
throw (ObjectAlreadyRegistered, ConcurrentAccessAttempted,
SaveInProgress, RestoreInProgress, RTIinternalError);
- void deleteObjectInstance(FederateHandle, ObjectHandle, const char *)
+ void deleteObjectInstance(FederateHandle, ObjectHandle, std::string tag)
throw (ObjectNotKnown, DeletePrivilegeNotHeld,
FederateNotExecutionMember, ConcurrentAccessAttempted,
SaveInProgress, RestoreInProgress, RTIinternalError);
Index: libCERTI/RootObject.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/RootObject.cc,v
retrieving revision 3.32
retrieving revision 3.33
diff -u -b -r3.32 -r3.33
--- libCERTI/RootObject.cc 28 Feb 2008 14:47:59 -0000 3.32
+++ libCERTI/RootObject.cc 29 May 2008 12:20:39 -0000 3.33
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RootObject.cc,v 3.32 2008/02/28 14:47:59 rousse Exp $
+// $Id: RootObject.cc,v 3.33 2008/05/29 12:20:39 rousse Exp $
// ----------------------------------------------------------------------------
#include "Object.hh"
@@ -260,7 +260,7 @@
RootObject::deleteObjectInstance(FederateHandle the_federate,
ObjectHandle the_object,
FederationTime theTime,
- const char *the_tag)
+ std::string the_tag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError)
{
ObjectClasses->deleteObject(the_federate, the_object, theTime, the_tag);
@@ -271,7 +271,7 @@
void
RootObject::deleteObjectInstance(FederateHandle the_federate,
ObjectHandle the_object,
- const char *the_tag)
+ std::string the_tag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError)
{
ObjectClasses->deleteObject(the_federate, the_object, the_tag);
@@ -344,4 +344,4 @@
} // namespace certi
-// $Id: RootObject.cc,v 3.32 2008/02/28 14:47:59 rousse Exp $
+// $Id: RootObject.cc,v 3.33 2008/05/29 12:20:39 rousse Exp $
Index: libCERTI/RootObject.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/RootObject.hh,v
retrieving revision 3.27
retrieving revision 3.28
diff -u -b -r3.27 -r3.28
--- libCERTI/RootObject.hh 28 Feb 2008 14:47:59 -0000 3.27
+++ libCERTI/RootObject.hh 29 May 2008 12:20:39 -0000 3.28
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RootObject.hh,v 3.27 2008/02/28 14:47:59 rousse Exp $
+// $Id: RootObject.hh,v 3.28 2008/05/29 12:20:39 rousse Exp $
// ----------------------------------------------------------------------------
#ifndef LIBCERTI_ROOT_OBJECT
@@ -92,10 +92,10 @@
throw (ObjectNotKnown);
void deleteObjectInstance(FederateHandle, ObjectHandle,
- FederationTime theTime, const char *)
+ FederationTime theTime, std::string theTag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError);
- void deleteObjectInstance(FederateHandle, ObjectHandle, const char *)
+ void deleteObjectInstance(FederateHandle, ObjectHandle, std::string theTag)
throw (DeletePrivilegeNotHeld, ObjectNotKnown, RTIinternalError);
void killFederate(FederateHandle) throw (RTIinternalError);
@@ -126,4 +126,4 @@
#endif // LIBCERTI_ROOT_OBJECT
-// $Id: RootObject.hh,v 3.27 2008/02/28 14:47:59 rousse Exp $
+// $Id: RootObject.hh,v 3.28 2008/05/29 12:20:39 rousse Exp $
Index: libRTI/RTIambPrivateRefs.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambPrivateRefs.cc,v
retrieving revision 3.12
retrieving revision 3.13
diff -u -b -r3.12 -r3.13
--- libRTI/RTIambPrivateRefs.cc 23 Apr 2008 07:36:02 -0000 3.12
+++ libRTI/RTIambPrivateRefs.cc 29 May 2008 12:20:40 -0000 3.13
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RTIambPrivateRefs.cc,v 3.12 2008/04/23 07:36:02 siron Exp $
+// $Id: RTIambPrivateRefs.cc,v 3.13 2008/05/29 12:20:40 rousse Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -64,7 +64,7 @@
D.Out(pdDebug, "sending request to RTIA.");
try {
- req->write(socketUn);
+ req->send(socketUn,msgBufSend);
}
catch (NetworkError) {
std::cerr << "libRTI: exception: NetworkError (write)" << std::endl ;
@@ -75,7 +75,7 @@
// waiting RTI reply.
try {
- rep->read(socketUn);
+ rep->receive(socketUn,msgBufReceive);
}
catch (NetworkError) {
std::cerr << "libRTI: exception: NetworkError (read)" << std::endl ;
@@ -539,4 +539,4 @@
}
}
-// $Id: RTIambPrivateRefs.cc,v 3.12 2008/04/23 07:36:02 siron Exp $
+// $Id: RTIambPrivateRefs.cc,v 3.13 2008/05/29 12:20:40 rousse Exp $
Index: libRTI/RTIambPrivateRefs.hh
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambPrivateRefs.hh,v
retrieving revision 3.4
retrieving revision 3.5
diff -u -b -r3.4 -r3.5
--- libRTI/RTIambPrivateRefs.hh 27 Nov 2007 08:55:55 -0000 3.4
+++ libRTI/RTIambPrivateRefs.hh 29 May 2008 12:20:40 -0000 3.5
@@ -19,12 +19,13 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RTIambPrivateRefs.hh,v 3.4 2007/11/27 08:55:55 erk Exp $
+// $Id: RTIambPrivateRefs.hh,v 3.5 2008/05/29 12:20:40 rousse Exp $
// ----------------------------------------------------------------------------
#include "RTI.hh"
#include "Message.hh"
#include "RootObject.hh"
+#include "MessageBuffer.hh"
using namespace certi ;
@@ -53,6 +54,7 @@
RootObject *_theRootObj ;
SocketUN *socketUn ;
+ MessageBuffer msgBufSend,msgBufReceive ;
};
-// $Id: RTIambPrivateRefs.hh,v 3.4 2007/11/27 08:55:55 erk Exp $
+// $Id: RTIambPrivateRefs.hh,v 3.5 2008/05/29 12:20:40 rousse Exp $
Index: libRTI/RTIambassador.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambassador.cc,v
retrieving revision 3.81
retrieving revision 3.82
diff -u -b -r3.81 -r3.82
--- libRTI/RTIambassador.cc 27 May 2008 07:51:55 -0000 3.81
+++ libRTI/RTIambassador.cc 29 May 2008 12:20:40 -0000 3.82
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RTIambassador.cc,v 3.81 2008/05/27 07:51:55 rousse Exp $
+// $Id: RTIambassador.cc,v 3.82 2008/05/29 12:20:40 rousse Exp $
// ----------------------------------------------------------------------------
@@ -248,7 +248,8 @@
vers_RTI.setMaxTickTime(maximum);
try {
- vers_RTI.write(privateRefs->socketUn);
+ //vers_RTI.write(privateRefs->socketUn);
+ vers_RTI.send(privateRefs->socketUn,privateRefs->msgBufSend);
}
catch (NetworkError) {
cout << "tick 1." << endl ;
@@ -260,7 +261,7 @@
// Read response(s) from the local RTIA until Message::TICK_REQUEST is
received.
while (1) {
try {
- vers_Fed.read(privateRefs->socketUn);
+ vers_Fed.receive(privateRefs->socketUn,privateRefs->msgBufReceive);
}
catch (NetworkError) {
cout << "tick 2." << endl ;
@@ -287,19 +288,19 @@
// Otherwise, the RTI calls a FederateAmbassador service.
case Message::SYNCHRONIZATION_POINT_REGISTRATION_SUCCEEDED:
-
privateRefs->fed_amb->synchronizationPointRegistrationSucceeded(vers_Fed.getLabel());
+
privateRefs->fed_amb->synchronizationPointRegistrationSucceeded((vers_Fed.getLabel()).c_str());
break ;
case Message::ANNOUNCE_SYNCHRONIZATION_POINT:
-
privateRefs->fed_amb->announceSynchronizationPoint(vers_Fed.getLabel(),vers_Fed.getTag());
+
privateRefs->fed_amb->announceSynchronizationPoint((vers_Fed.getLabel()).c_str(),(vers_Fed.getTag()).c_str());
break ;
case Message::FEDERATION_SYNCHRONIZED:
-
privateRefs->fed_amb->federationSynchronized(vers_Fed.getLabel());
+
privateRefs->fed_amb->federationSynchronized((vers_Fed.getLabel()).c_str());
break ;
case Message::INITIATE_FEDERATE_SAVE:
-
privateRefs->fed_amb->initiateFederateSave(vers_Fed.getLabel());
+
privateRefs->fed_amb->initiateFederateSave((vers_Fed.getLabel()).c_str());
break ;
case Message::FEDERATION_SAVED:
@@ -308,12 +309,12 @@
case Message::REQUEST_FEDERATION_RESTORE_SUCCEEDED:
privateRefs->fed_amb->requestFederationRestoreSucceeded(
- vers_Fed.getLabel());
+ (vers_Fed.getLabel()).c_str());
break ;
case Message::REQUEST_FEDERATION_RESTORE_FAILED:
-
privateRefs->fed_amb->requestFederationRestoreFailed(vers_Fed.getLabel(),
- vers_Fed.getTag());
+
privateRefs->fed_amb->requestFederationRestoreFailed((vers_Fed.getLabel()).c_str(),
+
(vers_Fed.getTag()).c_str());
break ;
case Message::FEDERATION_RESTORE_BEGUN:
@@ -321,7 +322,7 @@
break ;
case Message::INITIATE_FEDERATE_RESTORE:
-
privateRefs->fed_amb->initiateFederateRestore(vers_Fed.getLabel(),
+
privateRefs->fed_amb->initiateFederateRestore((vers_Fed.getLabel()).c_str(),
vers_Fed.getFederate());
break ;
@@ -366,13 +367,13 @@
reflectAttributeValues(vers_Fed.getObject(),
*attributes,
vers_Fed.getFedTime(),
- vers_Fed.getTag(),
+ (vers_Fed.getTag()).c_str(),
vers_Fed.getEventRetraction());
else
privateRefs->fed_amb->
reflectAttributeValues(vers_Fed.getObject(),
*attributes,
- vers_Fed.getTag());
+ (vers_Fed.getTag()).c_str());
delete attributes ;
} break ;
@@ -384,13 +385,13 @@
vers_Fed.getInteractionClass(),
*parameters,
vers_Fed.getFedTime(),
- vers_Fed.getTag(),
+ (vers_Fed.getTag()).c_str(),
vers_Fed.getEventRetraction());
else
privateRefs->fed_amb->receiveInteraction(
vers_Fed.getInteractionClass(),
*parameters,
- vers_Fed.getTag());
+ (vers_Fed.getTag()).c_str());
delete parameters ;
} break ;
@@ -400,13 +401,13 @@
privateRefs->fed_amb->removeObjectInstance(
vers_Fed.getObject(),
vers_Fed.getFedTime(),
- vers_Fed.getTag(),
+ (vers_Fed.getTag()).c_str(),
vers_Fed.getEventRetraction());
}
else {
privateRefs->fed_amb->removeObjectInstance(
vers_Fed.getObject(),
- vers_Fed.getTag());
+ (vers_Fed.getTag()).c_str());
}
} break ;
@@ -427,7 +428,7 @@
privateRefs->fed_amb->
requestAttributeOwnershipAssumption(vers_Fed.getObject(),
*attributeSet,
- vers_Fed.getTag());
+
(vers_Fed.getTag()).c_str());
delete attributeSet ;
} break ;
@@ -437,7 +438,7 @@
privateRefs->fed_amb->requestAttributeOwnershipRelease(
vers_Fed.getObject(),
*attributeSet,
- vers_Fed.getTag());
+ (vers_Fed.getTag()).c_str());
delete attributeSet ;
} break ;
@@ -514,7 +515,7 @@
tick_next.type = Message::TICK_REQUEST_NEXT;
try {
- tick_next.write(privateRefs->socketUn);
+ tick_next.send(privateRefs->socketUn, privateRefs->msgBufSend);
}
catch (NetworkError) {
cout << "tick 3." << endl ;
@@ -1665,7 +1666,7 @@
privateRefs->executeService(&req, &rep);
- return ((strcmp(rep.getTag(), "RTI_TRUE") == 0) ? RTI_TRUE : RTI_FALSE);
+ return ((strcmp((rep.getTag()).c_str(), "RTI_TRUE") == 0) ? RTI_TRUE :
RTI_FALSE);
}
// ----------------------------------------------------------------------------
@@ -2958,4 +2959,4 @@
privateRefs->executeService(&req, &rep);
}
-// $Id: RTIambassador.cc,v 3.81 2008/05/27 07:51:55 rousse Exp $
+// $Id: RTIambassador.cc,v 3.82 2008/05/29 12:20:40 rousse Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi RTIA/Communications.cc RTIA/Communication...,
certi-cvs <=