[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi RTIA/RTIA_network.cc RTIA/TimeManagement.... [br_DEV_N
From: |
certi-cvs |
Subject: |
[certi-cvs] certi RTIA/RTIA_network.cc RTIA/TimeManagement.... [br_DEV_NoCircularRef] |
Date: |
Mon, 05 Jan 2009 13:34:53 +0000 |
CVSROOT: /sources/certi
Module name: certi
Branch: br_DEV_NoCircularRef
Changes by: Petr Gotthard <gotthardp> 09/01/05 13:34:53
Modified files:
RTIA : RTIA_network.cc TimeManagement.cc
RTIG : Federation.cc RTIG.cc RTIG_processing.cc
include : RTI.hh certi.hh fedtime.hh
libCERTI : CMakeLists.txt Exception.cc FedTime.cc GAV.cc
GAV.hh LBTS.cc LBTS.hh Message.cc Message.hh
Message_W.cc NetworkMessage.hh
NetworkMessage_RW.cc
libRTI : CMakeLists.txt RTIambPrivateRefs.cc
RTIambPrivateRefs.hh RTIambassador.cc
RTItypesImp.hh
Added files:
libCERTI : FedTimeD.hh
libRTI : RTIfedTime.cc
Log message:
Bug #24930: Implemented a separate FedTime for libCERTI.
The implementation is not complete. Next step: Integration into Windows.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/RTIA_network.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.30&r2=3.30.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/RTIA/TimeManagement.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.45&r2=3.45.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.102&r2=3.102.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.54&r2=3.54.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/RTIG_processing.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.80&r2=3.80.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/include/RTI.hh?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.15&r2=3.15.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/include/certi.hh?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.38&r2=3.38.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/include/fedtime.hh?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.12&r2=3.12.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/CMakeLists.txt?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=1.23&r2=1.23.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Exception.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.17&r2=3.17.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/FedTime.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.15&r2=3.15.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/GAV.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.18&r2=3.18.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/GAV.hh?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.13&r2=3.13.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/LBTS.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.12&r2=3.12.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/LBTS.hh?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.8&r2=3.8.8.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.62&r2=3.62.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message.hh?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.54&r2=3.54.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Message_W.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.39&r2=3.39.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/NetworkMessage.hh?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.44&r2=3.44.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/NetworkMessage_RW.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.52&r2=3.52.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/FedTimeD.hh?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/CMakeLists.txt?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=1.10&r2=1.10.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambPrivateRefs.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.16&r2=3.16.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambPrivateRefs.hh?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.7&r2=3.7.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIambassador.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.101&r2=3.101.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTItypesImp.hh?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&r1=3.1&r2=3.1.4.1
http://cvs.savannah.gnu.org/viewcvs/certi/libRTI/RTIfedTime.cc?cvsroot=certi&only_with_tag=br_DEV_NoCircularRef&rev=1.1.2.1
Patches:
Index: RTIA/RTIA_network.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/RTIA_network.cc,v
retrieving revision 3.30
retrieving revision 3.30.4.1
diff -u -b -r3.30 -r3.30.4.1
--- RTIA/RTIA_network.cc 20 Nov 2008 18:21:55 -0000 3.30
+++ RTIA/RTIA_network.cc 5 Jan 2009 13:34:49 -0000 3.30.4.1
@@ -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_network.cc,v 3.30 2008/11/20 18:21:55 approx Exp $
+// $Id: RTIA_network.cc,v 3.30.4.1 2009/01/05 13:34:49 gotthardp Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -52,7 +52,7 @@
{
D.Out(pdTrace,
"Receving Message from RTIG, type
NetworkMessage::MESSAGE_NULL(%f).",
- msg->getDate());
+ msg->getDate().getTime());
tm->update(msg->federate, msg->getDate());
delete msg ;
@@ -368,4 +368,4 @@
}} // namespace certi/rtia
-// $Id: RTIA_network.cc,v 3.30 2008/11/20 18:21:55 approx Exp $
+// $Id: RTIA_network.cc,v 3.30.4.1 2009/01/05 13:34:49 gotthardp Exp $
Index: RTIA/TimeManagement.cc
===================================================================
RCS file: /sources/certi/certi/RTIA/TimeManagement.cc,v
retrieving revision 3.45
retrieving revision 3.45.4.1
diff -u -b -r3.45 -r3.45.4.1
--- RTIA/TimeManagement.cc 18 Sep 2008 14:41:27 -0000 3.45
+++ RTIA/TimeManagement.cc 5 Jan 2009 13:34:49 -0000 3.45.4.1
@@ -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: TimeManagement.cc,v 3.45 2008/09/18 14:41:27 gotthardp Exp $
+// $Id: TimeManagement.cc,v 3.45.4.1 2009/01/05 13:34:49 gotthardp Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -107,11 +107,11 @@
comm->sendMessage(&msg);
lastNullMessageDate = heure_logique ;
- D.Out(pdDebug, "NULL message sent (Time = %f).", heure_logique) ;
+ D.Out(pdDebug, "NULL message sent (Time = %f).",
heure_logique.getTime()) ;
}
else {
D.Out(pdExcept, "NULL message not sent (Time = %f, Last = %f).",
- heure_logique, lastNullMessageDate);
+ heure_logique.getTime(), lastNullMessageDate.getTime());
}
}
@@ -497,11 +497,7 @@
_type_granted_state = AFTER_TAR_OR_NER ; // will be
- // FIXME Erk-->Pierre
- // We were changing lookahead value to epsilon
- // when doing zero lookahead I'd rather handle
- // _any_ near-to-zero lookahead as ZERO_LK
- if (0==RTIfedTime::fcmp(_lookahead_courant,0.0)) {
+ if (_lookahead_courant == 0.0) {
_type_granted_state = AFTER_TAR_OR_NER_WITH_ZERO_LK ;
}
@@ -572,7 +568,7 @@
else
dateMNET = (_LBTS <= dateTSO ? _LBTS : dateTSO) ;
- D.Out(pdRegister, "Minimum Next Event Time : %f.", dateMNET);
+ D.Out(pdRegister, "Minimum Next Event Time : %f.", dateMNET.getTime());
return dateMNET ;
}
@@ -597,7 +593,7 @@
if (_est_regulateur)
sendNullMessage(_heure_courante);
- D.Out(pdRegister, "New Lookahead : %f.", _lookahead_courant);
+ D.Out(pdRegister, "New Lookahead : %f.", _lookahead_courant.getTime());
}
}
@@ -680,7 +676,7 @@
// Modifier lookahead courant
_lookahead_courant = the_lookahead;
D.Out(pdDebug,
- "New lookahead = %f",_lookahead_courant);
+ "New lookahead = %f",_lookahead_courant.getTime());
// faudrait peut etre remplacer heure courante par le temps en parametre
msg.setDate(_heure_courante + _lookahead_courant);
@@ -722,35 +718,23 @@
bool
TimeManagement::testValidTime(FederationTime theTime)
{
- int compareResult;
- // FIXME Erk-->Pierre
- // We should use RTIfedTime object and not _plain_ double
- // value
if (_avancee_en_cours == PAS_D_AVANCEE) {
if (_type_granted_state == AFTER_TAR_OR_NER_WITH_ZERO_LK) {
- compareResult = RTIfedTime::fcmp(theTime,_heure_courante);
- // if theTime <= _heure_courante
- if (compareResult==-1 || compareResult==0)
+ if (theTime <= _heure_courante)
return false;
}
else { // AFTER_TAR_OR_NER or AFTER_TARA_OR_NARA
- compareResult = RTIfedTime::fcmp(theTime,_heure_courante +
_lookahead_courant);
- // if theTime < _heure_courante + _lookahead_courant
- if (compareResult == -1)
+ if (theTime < _heure_courante + _lookahead_courant)
return false;
}
}
else {
if (_type_granted_state == AFTER_TAR_OR_NER_WITH_ZERO_LK) {
- compareResult = RTIfedTime::fcmp(theTime,date_avancee);
- // if theTime <= date_avancee
- if (compareResult==-1 || compareResult==0)
+ if (theTime <= date_avancee)
return false;
}
else { // AFTER_TAR_OR_NER or AFTER_TARA_OR_NARA
- compareResult = RTIfedTime::fcmp(theTime,date_avancee +
_lookahead_courant);
- // if (theTime < date_avancee + _lookahead_courant)
- if (compareResult == -1)
+ if (theTime < date_avancee + _lookahead_courant)
return false;
}
}
@@ -838,9 +822,9 @@
if (_est_contraint) {
// give a TSO message.
if (_LBTS == std::numeric_limits<double>::infinity())
- D.Out(pdDebug, "Logical time : %f, LBTS : infini.", date_avancee);
+ D.Out(pdDebug, "Logical time : %f, LBTS : infini.",
date_avancee.getTime());
else
- D.Out(pdDebug, "Logical time : %f, LBTS : %lf.", date_avancee,
_LBTS);
+ D.Out(pdDebug, "Logical time : %f, LBTS : %lf.",
date_avancee.getTime(), _LBTS.getTime());
min = (_LBTS<date_avancee)?(_LBTS):(date_avancee);
msg = queues->giveTsoMessage(min, msg_donne, msg_restant);
@@ -849,10 +833,10 @@
// if LBTS allows to give a timeAdvanceGrant.
if (_LBTS == std::numeric_limits<double>::infinity())
D.Out(pdDebug, "Logical time : %f, LBTS : infini, lookahead :
%f.",
- date_avancee, _lookahead_courant);
+ date_avancee.getTime(), _lookahead_courant.getTime());
else
D.Out(pdDebug, "Logical time : %15.12f, LBTS : %15.12f,
lookahead : %f.",
- date_avancee, _LBTS, _lookahead_courant);
+ date_avancee.getTime(), _LBTS.getTime(),
_lookahead_courant.getTime());
if ((date_avancee < _LBTS) ||
((date_avancee == _LBTS) && (_avancee_en_cours == TARA))) {
@@ -895,7 +879,7 @@
req.setFederationTime(logical_time);
D.Out(pdRegister, "timeAdvanceGrant sent to federate (time = %f).",
- req.getFederationTime());
+ req.getFederationTime().getTime());
_tick_state = TICK_NEXT; // indicate the callback was processed
@@ -920,15 +904,13 @@
if (_avancee_en_cours != PAS_D_AVANCEE)
e = e_TimeAdvanceAlreadyInProgress ;
- /* logical_time <_heure_courante */
- if (RTIfedTime::fcmp(logical_time ,_heure_courante) < 0)
+ if (logical_time < _heure_courante)
e = e_FederationTimeAlreadyPassed ;
- /* logical_time < _heure_courante + _lookahead_courant */
- if (RTIfedTime::fcmp(logical_time , _heure_courante +
_lookahead_courant)<0) {
+ if (logical_time < _heure_courante + _lookahead_courant) {
D.Out(pdDebug,"InvalidFederation time lkahead=%f, current=%f,
requested=%f",
- _lookahead_courant,_heure_courante,logical_time);
+
_lookahead_courant.getTime(),_heure_courante.getTime(),logical_time.getTime());
e = e_InvalidFederationTime ;
}
@@ -936,11 +918,7 @@
_type_granted_state = AFTER_TAR_OR_NER ; // will be
- // FIXME Erk-->Pierre
- // We were changing lookahead value to epsilon
- // when doing zero lookahead I'd rather handle
- // _any_ near-to-zero lookahead as ZERO_LK
- if (0==RTIfedTime::fcmp(_lookahead_courant,0.0)) {
+ if (_lookahead_courant == 0.0) {
_type_granted_state = AFTER_TAR_OR_NER_WITH_ZERO_LK ;
}
@@ -951,7 +929,7 @@
date_avancee = logical_time ;
D.Out(pdTrace, "timeAdvanceRequest accepted (asked time=%f).",
- date_avancee);
+ date_avancee.getTime());
}
else {
D.Out(pdExcept, "timeAdvanceRequest refused (exception = %d).", e);
@@ -987,7 +965,7 @@
date_avancee = logical_time ;
D.Out(pdTrace, "timeAdvanceRequestAvailable accepted (asked time=%f).",
- date_avancee);
+ date_avancee.getTime());
}
else {
D.Out(pdExcept, "timeAdvanceRequestAvailable refused (exception =
%d).", e);
@@ -997,4 +975,4 @@
}} // namespaces
-// $Id: TimeManagement.cc,v 3.45 2008/09/18 14:41:27 gotthardp Exp $
+// $Id: TimeManagement.cc,v 3.45.4.1 2009/01/05 13:34:49 gotthardp Exp $
Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.102
retrieving revision 3.102.4.1
diff -u -b -r3.102 -r3.102.4.1
--- RTIG/Federation.cc 20 Nov 2008 18:21:55 -0000 3.102
+++ RTIG/Federation.cc 5 Jan 2009 13:34:49 -0000 3.102.4.1
@@ -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.102 2008/11/20 18:21:55 approx Exp $
+// $Id: Federation.cc,v 3.102.4.1 2009/01/05 13:34:49 gotthardp Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -712,7 +712,7 @@
federate.setRegulator(true);
D.Out(pdTerm, "Federation %d: Federate %d is now a regulator(Time=%f).",
- handle, federate_handle, time);
+ handle, federate_handle, time.getTime());
NM_Set_Time_Regulating msg ;
msg.exception = e_NO_EXCEPTION ;
@@ -1866,7 +1866,7 @@
}
D.Out(pdTerm, "Federation %d: Federate %d's new time is %f.",
- handle, federate_handle, time);
+ handle, federate_handle, time.getTime());
regulators.update(federate_handle, time);
@@ -2482,5 +2482,5 @@
}} // namespace certi/rtig
-// $Id: Federation.cc,v 3.102 2008/11/20 18:21:55 approx Exp $
+// $Id: Federation.cc,v 3.102.4.1 2009/01/05 13:34:49 gotthardp Exp $
Index: RTIG/RTIG.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG.cc,v
retrieving revision 3.54
retrieving revision 3.54.4.1
diff -u -b -r3.54 -r3.54.4.1
--- RTIG/RTIG.cc 7 Dec 2008 20:16:11 -0000 3.54
+++ RTIG/RTIG.cc 5 Jan 2009 13:34:49 -0000 3.54.4.1
@@ -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.54 2008/12/07 20:16:11 gotthardp Exp $
+// $Id: RTIG.cc,v 3.54.4.1 2009/01/05 13:34:49 gotthardp Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -205,7 +205,7 @@
case NetworkMessage::SET_TIME_REGULATING:
D.Out(pdTrace, "SetTimeRegulating du federe %u(date=%f).",
- msg->federate, msg->getDate());
+ msg->federate, msg->getDate().getTime());
auditServer.setLevel(8);
processSetTimeRegulating(link,
static_cast<NM_Set_Time_Regulating*>(msg));
break ;
@@ -1039,4 +1039,4 @@
}} // namespace certi/rtig
-// $Id: RTIG.cc,v 3.54 2008/12/07 20:16:11 gotthardp Exp $
+// $Id: RTIG.cc,v 3.54.4.1 2009/01/05 13:34:49 gotthardp Exp $
Index: RTIG/RTIG_processing.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/RTIG_processing.cc,v
retrieving revision 3.80
retrieving revision 3.80.4.1
diff -u -b -r3.80 -r3.80.4.1
--- RTIG/RTIG_processing.cc 7 Dec 2008 20:16:11 -0000 3.80
+++ RTIG/RTIG_processing.cc 5 Jan 2009 13:34:50 -0000 3.80.4.1
@@ -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.80 2008/12/07 20:16:11 gotthardp Exp $
+// $Id: RTIG_processing.cc,v 3.80.4.1 2009/01/05 13:34:50 gotthardp Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -520,7 +520,7 @@
G.Out(pdGendoc,"BEGIN ** SET TIME REGULATING **");
if (msg->isRegulator()) {
- auditServer << "ON at time " << msg->getDate();
+ auditServer << "ON at time " << msg->getDate().getTime();
federations.createRegulator(msg->federation,
msg->federate,
@@ -561,7 +561,7 @@
G.Out(pdGendoc,"BEGIN ** SET TIME CONSTRAINED **");
if (msg->isConstrained()) {
- auditServer << "ON at time " << msg->getDate();
+ auditServer << "ON at time " << msg->getDate().getTime();
federations.addConstrained(msg->federation,
msg->federate);
@@ -597,7 +597,7 @@
void
RTIG::processMessageNull(NetworkMessage *msg)
{
- auditServer << "Date " << msg->getDate() ;
+ auditServer << "Date " << msg->getDate().getTime();
// Catch all exceptions because RTIA does not expect an answer anyway.
try {
@@ -919,7 +919,7 @@
std::vector <AttributeValue_t> ValueArray ;
auditServer << "ObjID = " << req->object
- << ", Date = " << req->getDate() ;
+ << ", Date = " << req->getDate().getTime();
// Get Value Array
ValueArray = req->getAttribValueArray();
@@ -976,7 +976,7 @@
// Building Value Array
auditServer << "IntID = " << req->interactionClass
- << ", date = " << req->getDate() ;
+ << ", date = " << req->getDate().getTime();
values = req->getParamValueArray();
if ( req->isDated() )
@@ -1556,4 +1556,4 @@
}} // namespace certi/rtig
-// $Id: RTIG_processing.cc,v 3.80 2008/12/07 20:16:11 gotthardp Exp $
+// $Id: RTIG_processing.cc,v 3.80.4.1 2009/01/05 13:34:50 gotthardp Exp $
Index: include/RTI.hh
===================================================================
RCS file: /sources/certi/certi/include/RTI.hh,v
retrieving revision 3.15
retrieving revision 3.15.4.1
diff -u -b -r3.15 -r3.15.4.1
--- include/RTI.hh 10 Dec 2008 17:42:43 -0000 3.15
+++ include/RTI.hh 5 Jan 2009 13:34:50 -0000 3.15.4.1
@@ -1,5 +1,5 @@
// HLA 1.3 Header "RTI.hh"
-// $Id: RTI.hh,v 3.15 2008/12/10 17:42:43 gotthardp Exp $
+// $Id: RTI.hh,v 3.15.4.1 2009/01/05 13:34:50 gotthardp Exp $
#ifndef RTI_hh
#define RTI_hh
@@ -16,14 +16,14 @@
#else
#define RTI_EXPORT __declspec(dllimport)
#endif
- #if !defined(FEDTIME_EXPORT)
- #define FEDTIME_EXPORT
+ #if defined(FedTime_EXPORTS)
+ #define FEDTIME_EXPORT __declspec(dllexport)
+ #else
+ #define FEDTIME_EXPORT __declspec(dllimport)
#endif
#else
#define RTI_EXPORT
- #if !defined(FEDTIME_EXPORT)
#define FEDTIME_EXPORT
- #endif
#endif
#ifdef RTI_USES_STD_FSTREAM
Index: include/certi.hh
===================================================================
RCS file: /sources/certi/certi/include/certi.hh,v
retrieving revision 3.38
retrieving revision 3.38.4.1
diff -u -b -r3.38 -r3.38.4.1
--- include/certi.hh 10 Dec 2008 16:53:24 -0000 3.38
+++ include/certi.hh 5 Jan 2009 13:34:50 -0000 3.38.4.1
@@ -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.38 2008/12/10 16:53:24 erk Exp $
+// $Id: certi.hh,v 3.38.4.1 2009/01/05 13:34:50 gotthardp Exp $
// ----------------------------------------------------------------------------
#include <vector>
@@ -102,30 +102,29 @@
namespace certi {
-// RTI Shortcuts
-typedef RTI::AttributeHandle AttributeHandle ;
-typedef RTI::DimensionHandle DimensionHandle ;
-typedef RTI::EventRetractionHandle EventRetractionHandle ;
-typedef RTI::ExtentIndex ExtentIndex ;
-typedef RTI::FederateHandle FederateHandle ;
-typedef RTI::Handle Handle ;
-typedef RTI::InteractionClassHandle InteractionClassHandle ;
-typedef RTI::ObjectClassHandle ObjectClassHandle ;
-typedef RTI::ObjectHandle ObjectHandle ;
-typedef RTI::OrderType OrderType ;
-typedef RTI::ParameterHandle ParameterHandle ;
-typedef RTI::SpaceHandle SpaceHandle ;
-typedef RTI::TransportType TransportType ;
-typedef RTI::ULong ULong ;
-typedef RTI::UShort UShort ;
+typedef unsigned short UShort;
+typedef unsigned long ULong;
+typedef long Long;
+typedef ULong Handle;
+typedef Handle ObjectClassHandle;
+typedef Handle InteractionClassHandle;
+typedef ULong ExtentIndex;
+typedef Handle AttributeHandle;
+typedef Handle ParameterHandle;
+typedef Handle ObjectHandle;
+typedef Handle DimensionHandle;
+typedef Handle FederateHandle;
+typedef Handle OrderType;
+typedef Long SpaceHandle;
+typedef Handle TransportType;
+
+typedef RTI::EventRetractionHandle EventRetractionHandle;
-typedef RTI::Double FederationTime ;
typedef UShort ObjectHandlecount ;
typedef std::string ObjectName_t ;
typedef std::string AttributeValue_t;
typedef std::string ParameterValue_t;
-typedef RTI::Double FederationTimeDelta ;
enum ObjectRemovalReason {
OUT_OF_REGION = 1,
OBJECT_DELETED,
@@ -247,4 +246,4 @@
(uint64_t) CERTI_INT64_CONSTANT(0xff00000000000000U)) >> 56)))
#endif // CERTI_HH_INCLUDED
-// $Id: certi.hh,v 3.38 2008/12/10 16:53:24 erk Exp $
+// $Id: certi.hh,v 3.38.4.1 2009/01/05 13:34:50 gotthardp Exp $
Index: include/fedtime.hh
===================================================================
RCS file: /sources/certi/certi/include/fedtime.hh,v
retrieving revision 3.12
retrieving revision 3.12.4.1
diff -u -b -r3.12 -r3.12.4.1
--- include/fedtime.hh 10 Dec 2008 17:42:43 -0000 3.12
+++ include/fedtime.hh 5 Jan 2009 13:34:50 -0000 3.12.4.1
@@ -1,35 +1,16 @@
// HLA 1.3 Header "fedtime.hh"
-// $Id: fedtime.hh,v 3.12 2008/12/10 17:42:43 gotthardp Exp $
+// $Id: fedtime.hh,v 3.12.4.1 2009/01/05 13:34:50 gotthardp Exp $
#ifndef HLA_FEDTIME_HH
#define HLA_FEDTIME_HH
-#ifdef _WIN32
-#include <windows.h>
-#else
+#include "RTI.hh"
#include <sys/types.h>
#include <string.h>
-#endif
-
-#if defined(_WIN32)
- #if defined(FedTime_EXPORTS)
- #define FEDTIME_EXPORT __declspec(dllexport)
- #else
- #define FEDTIME_EXPORT __declspec(dllimport)
- #endif
-#else
- #define FEDTIME_EXPORT
-#endif
-
-#include "RTI.hh"
class FEDTIME_EXPORT RTIfedTime : public RTI::FedTime
{
public:
-
- static const double epsilon;
- static int fcmp(const double x1, const double x2);
-
RTIfedTime();
RTIfedTime(const RTI::Double &);
RTIfedTime(const RTI::FedTime &);
@@ -146,4 +127,4 @@
#endif // HLA_FEDTIME_HH
-// $Id: fedtime.hh,v 3.12 2008/12/10 17:42:43 gotthardp Exp $
+// $Id: fedtime.hh,v 3.12.4.1 2009/01/05 13:34:50 gotthardp Exp $
Index: libCERTI/CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/libCERTI/CMakeLists.txt,v
retrieving revision 1.23
retrieving revision 1.23.4.1
diff -u -b -r1.23 -r1.23.4.1
--- libCERTI/CMakeLists.txt 10 Dec 2008 16:53:24 -0000 1.23
+++ libCERTI/CMakeLists.txt 5 Jan 2009 13:34:50 -0000 1.23.4.1
@@ -64,6 +64,7 @@
)
SET(CERTI_TIME_SRCS
+FedTime.cc FedTimeD.hh
LBTS.cc
LBTS.hh
)
@@ -193,7 +194,10 @@
SET_TARGET_PROPERTIES(CERTI PROPERTIES PROJECT_LABEL LibCERTI)
-TARGET_LINK_LIBRARIES(CERTI ${LIBXML2_LIBRARIES} ${SOCKET_LIBRARY})
+TARGET_LINK_LIBRARIES(CERTI
+ ${LIBXML2_LIBRARIES}
+ ${GEN_LIBRARY}
+ ${SOCKET_LIBRARY})
IF (MINGW)
SET_TARGET_PROPERTIES(CERTI PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libCERTI.def")
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libCERTI.def
@@ -206,44 +210,7 @@
SET_TARGET_PROPERTIES(CERTI PROPERTIES VERSION 1.0.0 SOVERSION 1)
-##################################################################
-# Lib FedTime
-# A replacement lib FedTime may be provided by the user
-# CERTI is provided one. The lib FedTime depends on libRTI
-# since it inherits from the RTI::FedTime abstract class.
-##################################################################
-IF(CMAKE_COMPILER_IS_GNUCC)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long")
-ENDIF(CMAKE_COMPILER_IS_GNUCC)
-IF(CMAKE_COMPILER_IS_GNUCXX)
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
-ENDIF(CMAKE_COMPILER_IS_GNUCXX)
-
-INCLUDE_DIRECTORIES(../libHLA)
-SET(FEDTIME_SRCS
- FedTime.cc
- ${CMAKE_SOURCE_DIR}/include/fedtime.hh
-)
-
-SOURCE_GROUP("Source Files\\FedTime" FILES ${FEDTIME_SRCS})
-
-ADD_LIBRARY(FedTime
- ${FEDTIME_SRCS}
-)
-
-TARGET_LINK_LIBRARIES(FedTime RTI HLA)
-
-SET_TARGET_PROPERTIES(FedTime PROPERTIES PROJECT_LABEL LibFedTime)
-IF (MINGW)
- SET_TARGET_PROPERTIES(FedTime PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libFedTime.def")
- INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libFedTime.def
- DESTINATION lib)
-ENDIF (MINGW)
-
-SET_TARGET_PROPERTIES(FedTime PROPERTIES VERSION 1.0.0 SOVERSION 1)
-
-# Install rules for both libCERTI and libFedTime
-INSTALL(TARGETS CERTI FedTime
+INSTALL(TARGETS CERTI
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
Index: libCERTI/Exception.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Exception.cc,v
retrieving revision 3.17
retrieving revision 3.17.4.1
diff -u -b -r3.17 -r3.17.4.1
--- libCERTI/Exception.cc 7 Dec 2008 20:16:12 -0000 3.17
+++ libCERTI/Exception.cc 5 Jan 2009 13:34:50 -0000 3.17.4.1
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: Exception.cc,v 3.17 2008/12/07 20:16:12 gotthardp Exp $
+// $Id: Exception.cc,v 3.17.4.1 2009/01/05 13:34:50 gotthardp Exp $
// ----------------------------------------------------------------------------
#include "Exception.hh"
@@ -27,116 +27,118 @@
#include "PrettyDebug.hh"
#include <sstream>
+using namespace certi;
+
// static members for HLA Exceptions
-long certi::ArrayIndexOutOfBounds::_type = certi::e_ArrayIndexOutOfBounds ;
-long certi::AsynchronousDeliveryAlreadyDisabled::_type =
certi::e_AsynchronousDeliveryAlreadyDisabled ;
-long certi::AsynchronousDeliveryAlreadyEnabled::_type =
certi::e_AsynchronousDeliveryAlreadyEnabled ;
-long certi::AttributeAcquisitionWasNotRequested::_type =
certi::e_AttributeAcquisitionWasNotRequested ;
-long certi::AttributeAcquisitionWasNotCanceled::_type =
certi::e_AttributeAcquisitionWasNotCanceled ;
-long certi::AttributeAlreadyBeingAcquired::_type =
certi::e_AttributeAlreadyBeingAcquired ;
-long certi::AttributeAlreadyBeingDivested::_type =
certi::e_AttributeAlreadyBeingDivested ;
-long certi::AttributeAlreadyOwned::_type = certi::e_AttributeAlreadyOwned ;
-long certi::AttributeDivestitureWasNotRequested::_type =
certi::e_AttributeDivestitureWasNotRequested ;
-long certi::AttributeNotDefined::_type = certi::e_AttributeNotDefined ;
-long certi::AttributeNotKnown::_type = certi::e_AttributeNotKnown ;
-long certi::AttributeNotOwned::_type = certi::e_AttributeNotOwned ;
-long certi::AttributeNotPublished::_type = certi::e_AttributeNotPublished ;
-long certi::ConcurrentAccessAttempted::_type =
certi::e_ConcurrentAccessAttempted ;
-long certi::CouldNotDiscover::_type = certi::e_CouldNotDiscover ;
-long certi::CouldNotOpenFED::_type = certi::e_CouldNotOpenFED ;
-long certi::CouldNotRestore::_type = certi::e_CouldNotRestore ;
-long certi::DeletePrivilegeNotHeld::_type = certi::e_DeletePrivilegeNotHeld ;
-long certi::DimensionNotDefined::_type = certi::e_DimensionNotDefined ;
-long certi::EnableTimeConstrainedPending::_type =
certi::e_EnableTimeConstrainedPending ;
-long certi::EnableTimeConstrainedWasNotPending::_type =
certi::e_EnableTimeConstrainedWasNotPending ;
-long certi::EnableTimeRegulationPending::_type =
certi::e_EnableTimeRegulationPending ;
-long certi::EnableTimeRegulationWasNotPending::_type =
certi::e_EnableTimeRegulationWasNotPending ;
-long certi::ErrorReadingFED::_type = certi::e_ErrorReadingFED ;
-long certi::EventNotKnown::_type = certi::e_EventNotKnown ;
-long certi::FederateAlreadyExecutionMember::_type =
certi::e_FederateAlreadyExecutionMember ;
-long certi::FederateInternalError::_type = certi::e_FederateInternalError ;
-long certi::FederateLoggingServiceCalls::_type =
certi::e_FederateLoggingServiceCalls ;
-long certi::FederateNotExecutionMember::_type =
certi::e_FederateNotExecutionMember ;
-long certi::FederateOwnsAttributes::_type = certi::e_FederateOwnsAttributes ;
-long certi::FederateWasNotAskedToReleaseAttribute::_type =
certi::e_FederateWasNotAskedToReleaseAttribute ;
-long certi::FederatesCurrentlyJoined::_type =
certi::e_FederatesCurrentlyJoined ;
-long certi::FederationExecutionAlreadyExists::_type =
certi::e_FederationExecutionAlreadyExists ;
-long certi::FederationExecutionDoesNotExist::_type =
certi::e_FederationExecutionDoesNotExist ;
-long certi::FederationTimeAlreadyPassed::_type =
certi::e_FederationTimeAlreadyPassed ;
-long certi::HandleValuePairMaximumExceeded::_type =
certi::e_HandleValuePairMaximumExceeded ;
-long certi::InteractionClassNotDefined::_type =
certi::e_InteractionClassNotDefined ;
-long certi::InteractionClassNotKnown::_type =
certi::e_InteractionClassNotKnown ;
-long certi::InteractionClassNotPublished::_type =
certi::e_InteractionClassNotPublished ;
-long certi::InteractionClassNotSubscribed::_type =
certi::e_InteractionClassNotSubscribed ;
-long certi::InteractionParameterNotDefined::_type =
certi::e_InteractionParameterNotDefined ;
-long certi::InteractionParameterNotKnown::_type =
certi::e_InteractionParameterNotKnown ;
-long certi::InvalidExtents::_type = certi::e_InvalidExtents ;
-long certi::InvalidFederationTime::_type = certi::e_InvalidFederationTime ;
-long certi::InvalidHandleValuePairSetContext::_type =
certi::e_InvalidHandleValuePairSetContext ;
-long certi::InvalidLookahead::_type = certi::e_InvalidLookahead ;
-long certi::InvalidOrderingHandle::_type = certi::e_InvalidOrderingHandle ;
-long certi::InvalidRegionContext::_type = certi::e_InvalidRegionContext ;
-long certi::InvalidResignAction::_type = certi::e_InvalidResignAction ;
-long certi::InvalidRetractionHandle::_type = certi::e_InvalidRetractionHandle ;
-long certi::InvalidTransportationHandle::_type =
certi::e_InvalidTransportationHandle ;
-long certi::MemoryExhausted::_type = certi::e_MemoryExhausted ;
-long certi::NameNotFound::_type = certi::e_NameNotFound ;
-long certi::ObjectClassNotDefined::_type = certi::e_ObjectClassNotDefined ;
-long certi::ObjectClassNotKnown::_type = certi::e_ObjectClassNotKnown ;
-long certi::ObjectClassNotPublished::_type = certi::e_ObjectClassNotPublished ;
-long certi::ObjectClassNotSubscribed::_type =
certi::e_ObjectClassNotSubscribed ;
-long certi::ObjectNotKnown::_type = certi::e_ObjectNotKnown ;
-long certi::ObjectAlreadyRegistered::_type = certi::e_ObjectAlreadyRegistered ;
-long certi::OwnershipAcquisitionPending::_type =
certi::e_OwnershipAcquisitionPending ;
-long certi::RegionInUse::_type = certi::e_RegionInUse ;
-long certi::RegionNotKnown::_type = certi::e_RegionNotKnown ;
-long certi::RestoreInProgress::_type = certi::e_RestoreInProgress ;
-long certi::RestoreNotRequested::_type = certi::e_RestoreNotRequested ;
-long certi::RTIinternalError::_type = certi::e_RTIinternalError ;
-long certi::SpaceNotDefined::_type = certi::e_SpaceNotDefined ;
-long certi::SaveInProgress::_type = certi::e_SaveInProgress ;
-long certi::SaveNotInitiated::_type = certi::e_SaveNotInitiated ;
-long certi::SpecifiedSaveLabelDoesNotExist::_type =
certi::e_SpecifiedSaveLabelDoesNotExist ;
-long certi::SynchronizationPointLabelWasNotAnnounced::_type =
certi::e_SynchronizationPointLabelWasNotAnnounced ;
-long certi::TimeAdvanceAlreadyInProgress::_type =
certi::e_TimeAdvanceAlreadyInProgress ;
-long certi::TimeAdvanceWasNotInProgress::_type =
certi::e_TimeAdvanceWasNotInProgress ;
-long certi::TimeConstrainedAlreadyEnabled::_type =
certi::e_TimeConstrainedAlreadyEnabled ;
-long certi::TimeConstrainedWasNotEnabled::_type =
certi::e_TimeConstrainedWasNotEnabled ;
-long certi::TimeRegulationAlreadyEnabled::_type =
certi::e_TimeRegulationAlreadyEnabled ;
-long certi::TimeRegulationWasNotEnabled::_type =
certi::e_TimeRegulationWasNotEnabled ;
-long certi::UnableToPerformSave::_type = certi::e_UnableToPerformSave ;
-long certi::ValueCountExceeded::_type = certi::e_ValueCountExceeded ;
-long certi::ValueLengthExceeded::_type = certi::e_ValueLengthExceeded ;
+long ArrayIndexOutOfBounds::_type = e_ArrayIndexOutOfBounds ;
+long AsynchronousDeliveryAlreadyDisabled::_type =
e_AsynchronousDeliveryAlreadyDisabled ;
+long AsynchronousDeliveryAlreadyEnabled::_type =
e_AsynchronousDeliveryAlreadyEnabled ;
+long AttributeAcquisitionWasNotRequested::_type =
e_AttributeAcquisitionWasNotRequested ;
+long AttributeAcquisitionWasNotCanceled::_type =
e_AttributeAcquisitionWasNotCanceled ;
+long AttributeAlreadyBeingAcquired::_type = e_AttributeAlreadyBeingAcquired ;
+long AttributeAlreadyBeingDivested::_type = e_AttributeAlreadyBeingDivested ;
+long AttributeAlreadyOwned::_type = e_AttributeAlreadyOwned ;
+long AttributeDivestitureWasNotRequested::_type =
e_AttributeDivestitureWasNotRequested ;
+long AttributeNotDefined::_type = e_AttributeNotDefined ;
+long AttributeNotKnown::_type = e_AttributeNotKnown ;
+long AttributeNotOwned::_type = e_AttributeNotOwned ;
+long AttributeNotPublished::_type = e_AttributeNotPublished ;
+long ConcurrentAccessAttempted::_type = e_ConcurrentAccessAttempted ;
+long CouldNotDiscover::_type = e_CouldNotDiscover ;
+long CouldNotOpenFED::_type = e_CouldNotOpenFED ;
+long CouldNotRestore::_type = e_CouldNotRestore ;
+long DeletePrivilegeNotHeld::_type = e_DeletePrivilegeNotHeld ;
+long DimensionNotDefined::_type = e_DimensionNotDefined ;
+long EnableTimeConstrainedPending::_type = e_EnableTimeConstrainedPending ;
+long EnableTimeConstrainedWasNotPending::_type =
e_EnableTimeConstrainedWasNotPending ;
+long EnableTimeRegulationPending::_type = e_EnableTimeRegulationPending ;
+long EnableTimeRegulationWasNotPending::_type =
e_EnableTimeRegulationWasNotPending ;
+long ErrorReadingFED::_type = e_ErrorReadingFED ;
+long EventNotKnown::_type = e_EventNotKnown ;
+long FederateAlreadyExecutionMember::_type = e_FederateAlreadyExecutionMember ;
+long FederateInternalError::_type = e_FederateInternalError ;
+long FederateLoggingServiceCalls::_type = e_FederateLoggingServiceCalls ;
+long FederateNotExecutionMember::_type = e_FederateNotExecutionMember ;
+long FederateOwnsAttributes::_type = e_FederateOwnsAttributes ;
+long FederateWasNotAskedToReleaseAttribute::_type =
e_FederateWasNotAskedToReleaseAttribute ;
+long FederatesCurrentlyJoined::_type = e_FederatesCurrentlyJoined ;
+long FederationExecutionAlreadyExists::_type =
e_FederationExecutionAlreadyExists ;
+long FederationExecutionDoesNotExist::_type =
e_FederationExecutionDoesNotExist ;
+long FederationTimeAlreadyPassed::_type = e_FederationTimeAlreadyPassed ;
+long HandleValuePairMaximumExceeded::_type = e_HandleValuePairMaximumExceeded ;
+long InteractionClassNotDefined::_type = e_InteractionClassNotDefined ;
+long InteractionClassNotKnown::_type = e_InteractionClassNotKnown ;
+long InteractionClassNotPublished::_type = e_InteractionClassNotPublished ;
+long InteractionClassNotSubscribed::_type = e_InteractionClassNotSubscribed ;
+long InteractionParameterNotDefined::_type = e_InteractionParameterNotDefined ;
+long InteractionParameterNotKnown::_type = e_InteractionParameterNotKnown ;
+long InvalidExtents::_type = e_InvalidExtents ;
+long InvalidFederationTime::_type = e_InvalidFederationTime ;
+long InvalidHandleValuePairSetContext::_type =
e_InvalidHandleValuePairSetContext ;
+long InvalidLookahead::_type = e_InvalidLookahead ;
+long InvalidOrderingHandle::_type = e_InvalidOrderingHandle ;
+long InvalidRegionContext::_type = e_InvalidRegionContext ;
+long InvalidResignAction::_type = e_InvalidResignAction ;
+long InvalidRetractionHandle::_type = e_InvalidRetractionHandle ;
+long InvalidTransportationHandle::_type = e_InvalidTransportationHandle ;
+long MemoryExhausted::_type = e_MemoryExhausted ;
+long NameNotFound::_type = e_NameNotFound ;
+long ObjectClassNotDefined::_type = e_ObjectClassNotDefined ;
+long ObjectClassNotKnown::_type = e_ObjectClassNotKnown ;
+long ObjectClassNotPublished::_type = e_ObjectClassNotPublished ;
+long ObjectClassNotSubscribed::_type = e_ObjectClassNotSubscribed ;
+long ObjectNotKnown::_type = e_ObjectNotKnown ;
+long ObjectAlreadyRegistered::_type = e_ObjectAlreadyRegistered ;
+long OwnershipAcquisitionPending::_type = e_OwnershipAcquisitionPending ;
+long RegionInUse::_type = e_RegionInUse ;
+long RegionNotKnown::_type = e_RegionNotKnown ;
+long RestoreInProgress::_type = e_RestoreInProgress ;
+long RestoreNotRequested::_type = e_RestoreNotRequested ;
+long RTIinternalError::_type = e_RTIinternalError ;
+long SpaceNotDefined::_type = e_SpaceNotDefined ;
+long SaveInProgress::_type = e_SaveInProgress ;
+long SaveNotInitiated::_type = e_SaveNotInitiated ;
+long SpecifiedSaveLabelDoesNotExist::_type = e_SpecifiedSaveLabelDoesNotExist ;
+long SynchronizationPointLabelWasNotAnnounced::_type =
e_SynchronizationPointLabelWasNotAnnounced ;
+long TimeAdvanceAlreadyInProgress::_type = e_TimeAdvanceAlreadyInProgress ;
+long TimeAdvanceWasNotInProgress::_type = e_TimeAdvanceWasNotInProgress ;
+long TimeConstrainedAlreadyEnabled::_type = e_TimeConstrainedAlreadyEnabled ;
+long TimeConstrainedWasNotEnabled::_type = e_TimeConstrainedWasNotEnabled ;
+long TimeRegulationAlreadyEnabled::_type = e_TimeRegulationAlreadyEnabled ;
+long TimeRegulationWasNotEnabled::_type = e_TimeRegulationWasNotEnabled ;
+long UnableToPerformSave::_type = e_UnableToPerformSave ;
+long ValueCountExceeded::_type = e_ValueCountExceeded ;
+long ValueLengthExceeded::_type = e_ValueLengthExceeded ;
// TypeException managing (how to obtain TypeException from Exception name ?)
-long certi::FederateNotPublishing::_type = certi::e_FederateNotPublishing ;
-long certi::FederateNotSubscribing::_type = certi::e_FederateNotSubscribing ;
-long certi::InvalidObjectHandle::_type = certi::e_InvalidObjectHandle ;
-long certi::CouldNotOpenRID::_type = certi::e_CouldNotOpenRID ;
-long certi::ErrorReadingRID::_type = certi::e_ErrorReadingRID ;
-long certi::AttributeNotSubscribed::_type = certi::e_AttributeNotSubscribed ;
-long certi::FederationAlreadyPaused::_type = certi::e_FederationAlreadyPaused ;
-long certi::FederationNotPaused::_type = certi::e_FederationNotPaused ;
-long certi::SecurityError::_type = certi::e_SecurityError ;
-long certi::FederateAlreadyPaused::_type = certi::e_FederateAlreadyPaused ;
-long certi::FederateDoesNotExist::_type = certi::e_FederateDoesNotExist ;
-long certi::FederateNameAlreadyInUse::_type =
certi::e_FederateNameAlreadyInUse ;
-long certi::FederateNotPaused::_type = certi::e_FederateNotPaused ;
-long certi::IDsupplyExhausted::_type = certi::e_IDsupplyExhausted ;
-long certi::InvalidDivestitureCondition::_type =
certi::e_InvalidDivestitureCondition ;
-long certi::InvalidFederationTimeDelta::_type =
certi::e_InvalidFederationTimeDelta ;
-long certi::InvalidRoutingSpace::_type = certi::e_InvalidRoutingSpace ;
-long certi::NoPauseRequested::_type = certi::e_NoPauseRequested ;
-long certi::NoResumeRequested::_type = certi::e_NoResumeRequested ;
-long certi::TooManyIDsRequested::_type = certi::e_TooManyIDsRequested ;
-long certi::UnimplementedService::_type = certi::e_UnimplementedService ;
-long certi::UnknownLabel::_type = certi::e_UnknownLabel ;
-long certi::NetworkError::_type = certi::e_NetworkError ;
-long certi::NetworkSignal::_type = certi::e_NetworkSignal ;
+long FederateNotPublishing::_type = e_FederateNotPublishing ;
+long FederateNotSubscribing::_type = e_FederateNotSubscribing ;
+long InvalidObjectHandle::_type = e_InvalidObjectHandle ;
+long CouldNotOpenRID::_type = e_CouldNotOpenRID ;
+long ErrorReadingRID::_type = e_ErrorReadingRID ;
+long AttributeNotSubscribed::_type = e_AttributeNotSubscribed ;
+long FederationAlreadyPaused::_type = e_FederationAlreadyPaused ;
+long FederationNotPaused::_type = e_FederationNotPaused ;
+long SecurityError::_type = e_SecurityError ;
+long FederateAlreadyPaused::_type = e_FederateAlreadyPaused ;
+long FederateDoesNotExist::_type = e_FederateDoesNotExist ;
+long FederateNameAlreadyInUse::_type = e_FederateNameAlreadyInUse ;
+long FederateNotPaused::_type = e_FederateNotPaused ;
+long IDsupplyExhausted::_type = e_IDsupplyExhausted ;
+long InvalidDivestitureCondition::_type = e_InvalidDivestitureCondition ;
+long InvalidFederationTimeDelta::_type = e_InvalidFederationTimeDelta ;
+long InvalidRoutingSpace::_type = e_InvalidRoutingSpace ;
+long NoPauseRequested::_type = e_NoPauseRequested ;
+long NoResumeRequested::_type = e_NoResumeRequested ;
+long TooManyIDsRequested::_type = e_TooManyIDsRequested ;
+long UnimplementedService::_type = e_UnimplementedService ;
+long UnknownLabel::_type = e_UnknownLabel ;
+long NetworkError::_type = e_NetworkError ;
+long NetworkSignal::_type = e_NetworkSignal ;
static PrettyDebug PD_Exception("CERTI_EXCEPTION",__FILE__);
-const std::string certi::Exception::displayMe() const
+const std::string Exception::displayMe() const
{
std::stringstream msg;
@@ -158,4 +160,4 @@
PD_Exception[pdExcept] << msg.str().c_str();
return msg.str();
}
-// $Id: Exception.cc,v 3.17 2008/12/07 20:16:12 gotthardp Exp $
+// $Id: Exception.cc,v 3.17.4.1 2009/01/05 13:34:50 gotthardp Exp $
Index: libCERTI/FedTime.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/FedTime.cc,v
retrieving revision 3.15
retrieving revision 3.15.4.1
diff -u -b -r3.15 -r3.15.4.1
--- libCERTI/FedTime.cc 10 Dec 2008 16:53:24 -0000 3.15
+++ libCERTI/FedTime.cc 5 Jan 2009 13:34:50 -0000 3.15.4.1
@@ -17,241 +17,101 @@
// You should have received a copy of the GNU Lesser General Public
// 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: FedTime.cc,v 3.15.4.1 2009/01/05 13:34:50 gotthardp Exp $
// ----------------------------------------------------------------------------
#include <math.h>
-#include "certi.hh"
-#include "fedtime.hh"
-#include "HLAtypesIEEE1516.hh"
-
-#ifdef _WIN32
- #ifdef max
- #undef max
- #endif
-#endif
+#include "FedTimeD.hh"
-#include <algorithm>
#include <limits>
#include <sstream>
-#include <typeinfo>
-using std::stringstream ;
-
-typedef RTI::FedTime FedTime ;
-typedef RTI::Double Double ;
+using namespace certi;
namespace
{
-// ----------------------------------------------------------------------------
-/** FedTime to RTIfedTime reference cast
- */
-inline const RTIfedTime &
-rft(const FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- try {
- return dynamic_cast<const RTIfedTime &>(time);
- }
- catch (std::bad_cast) {
- throw RTI::InvalidFederationTime("Could not cast to RTIfedTime");
- }
-}
-
-inline bool
-is_infinity(const FedTime &time)
-{
- return const_cast<FedTime &>(time).isPositiveInfinity() == RTI::RTI_TRUE ;
-}
-
-/*
- fcmp
- Copyright (c) 1998-2000 Theodore C. Belding
- University of Michigan Center for the Study of Complex Systems
- <mailto:address@hidden>
- <http://fcmp.sourceforge.net>
-
- This file is part of the fcmp distribution. fcmp is free software;
- you can redistribute and modify it under the terms of the GNU Library
- General Public License (LGPL), version 2 or later. This software
- comes with absolutely no warranty. See the file COPYING for details
- and terms of copying.
-
- Description:
-
- Knuth's floating point comparison operators, from:
- Knuth, D. E. (1998). The Art of Computer Programming.
- Volume 2: Seminumerical Algorithms. 3rd ed. Addison-Wesley.
- Section 4.2.2, p. 233. ISBN 0-201-89684-2.
-
- Input parameters:
- x1, x2: numbers to be compared
- epsilon: determines tolerance
-
- epsilon should be carefully chosen based on the machine's precision,
- the observed magnitude of error, the desired precision, and the
- magnitude of the numbers to be compared. See the fcmp README file for
- more information.
-
- This routine may be used for both single-precision (float) and
- double-precision (double) floating-point numbers.
-
- Returns:
- -1 if x1 < x2
- 0 if x1 == x2
- 1 if x1 > x2
-*/
-
-inline int
-fcmp(double x1,double x2, double epsilon)
-{
- int exponent;
- double delta;
- double difference;
-
- /* Get exponent(max(fabs(x1), fabs(x2))) and store it in exponent. */
-
- /* If neither x1 nor x2 is 0, */
- /* this is equivalent to max(exponent(x1), exponent(x2)). */
-
- /* If either x1 or x2 is 0, its exponent returned by frexp would be 0, */
- /* which is much larger than the exponents of numbers close to 0 in */
- /* magnitude. But the exponent of 0 should be less than any number */
- /* whose magnitude is greater than 0. */
-
- /* So we only want to set exponent to 0 if both x1 and */
- /* x2 are 0. Hence, the following works for all x1 and x2. */
-
- frexp(fabs(x1) > fabs(x2) ? x1 : x2, &exponent);
-
- /* Do the comparison. */
-
- /* delta = epsilon * pow(2, exponent) */
-
- /* Form a neighborhood around x2 of size delta in either direction. */
- /* If x1 is within this delta neighborhood of x2, x1 == x2. */
- /* Otherwise x1 > x2 or x1 < x2, depending on which side of */
- /* the neighborhood x1 is on. */
-
- delta = ldexp(epsilon, exponent);
-
- difference = x1 - x2;
-
- if (difference > delta)
- return 1; /* x1 > x2 */
- else if (difference < -delta)
- return -1; /* x1 < x2 */
- else /* -delta <= difference <= delta */
- return 0; /* x1 == x2 */
-}
-
const char *infinity_str = "+inf" ;
} // anonymous namespace
// ----------------------------------------------------------------------------
-// FedTimeFactory
-RTI::FedTime *
-RTI::FedTimeFactory::makeZero()
- throw (RTI::MemoryExhausted)
-{
- return new RTIfedTime();
-}
-
-RTI::FedTime *
-RTI::FedTimeFactory::decode(const char *)
- throw (RTI::MemoryExhausted)
-{
- throw RTI::RTIinternalError("Not implemented");
-}
-
-// ----------------------------------------------------------------------------
// FedTime
-//FedTime::~FedTime()
-//{
-//}
-const double RTIfedTime::epsilon = std::numeric_limits<double>::epsilon();
+const double FedTime::epsilon = std::numeric_limits<double>::epsilon();
int
-RTIfedTime::fcmp(const double x1, const double x2) {
- return ::fcmp(x1,x2,RTIfedTime::epsilon);
+FedTime::fcmp(const double x1, const double x2) {
+ return certi::fcmp(x1,x2,FedTime::epsilon);
}
// ----------------------------------------------------------------------------
-// RTIfedTime
-RTIfedTime::RTIfedTime()
+// FedTime
+FedTime::FedTime()
: _fedTime(0),
_zero(0),
- _epsilon(RTIfedTime::epsilon),
+ _epsilon(FedTime::epsilon),
_positiveInfinity(std::numeric_limits<double>::infinity()) { }
-RTIfedTime::RTIfedTime(const RTI::Double &time)
+FedTime::FedTime(const double &time)
: _fedTime(time),
_zero(0),
- _epsilon(RTIfedTime::epsilon),
+ _epsilon(FedTime::epsilon),
_positiveInfinity(std::numeric_limits<double>::infinity()) { }
-RTIfedTime::RTIfedTime(const FedTime &time)
- : _fedTime(rft(time).getTime()),
- _zero(0),
- _epsilon(RTIfedTime::epsilon),
- _positiveInfinity(std::numeric_limits<double>::infinity()) { }
-
-// ----------------------------------------------------------------------------
-RTIfedTime::RTIfedTime(const RTIfedTime &time)
- : FedTime(),
- _fedTime(time._fedTime),
+FedTime::FedTime(const FedTime &time)
+ : _fedTime(time._fedTime),
_zero(time._zero),
_epsilon(time._epsilon),
_positiveInfinity(time._positiveInfinity) { }
// ----------------------------------------------------------------------------
-RTIfedTime::~RTIfedTime()
+FedTime::~FedTime()
{
}
// ----------------------------------------------------------------------------
void
-RTIfedTime::setZero()
+FedTime::setZero()
{
_fedTime = _zero;
}
// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::isZero()
+bool
+FedTime::isZero()
{
- return RTI::Boolean(_fedTime == _zero);
+ return bool(_fedTime == _zero);
}
// ----------------------------------------------------------------------------
void
-RTIfedTime::setEpsilon()
+FedTime::setEpsilon()
{
_fedTime = _epsilon;
}
// ----------------------------------------------------------------------------
void
-RTIfedTime::setPositiveInfinity()
+FedTime::setPositiveInfinity()
{
_fedTime = _positiveInfinity;
}
// ----------------------------------------------------------------------------
-inline RTI::Boolean
-RTIfedTime::isPositiveInfinity()
+inline bool
+FedTime::isPositiveInfinity() const
{
- return RTI::Boolean(_fedTime == _positiveInfinity);
+ return bool(_fedTime == _positiveInfinity);
}
// ----------------------------------------------------------------------------
int
-RTIfedTime::encodedLength() const
+FedTime::encodedLength() const
{
- // current implementation of RTIfedtime takes
+ // current implementation of FedTime takes
// four IEEE-754 double values.
return (sizeof(_fedTime)+
sizeof(_zero)+
@@ -261,20 +121,20 @@
// ----------------------------------------------------------------------------
void
-RTIfedTime::encode(char *buffer) const
+FedTime::encode(char *buffer) const
{
- libhla::HLAfloat64LE encoded_fedTime;
- encoded_fedTime = _fedTime;
- strncpy(buffer,(char*)&(encoded_fedTime),encoded_fedTime.__sizeof());
+// libhla::HLAfloat64LE encoded_fedTime;
+// encoded_fedTime = _fedTime;
+// strncpy(buffer,(char*)&(encoded_fedTime),encoded_fedTime.__sizeof());
}
// ----------------------------------------------------------------------------
int
-RTIfedTime::getPrintableLength() const
+FedTime::getPrintableLength() const
{
- stringstream s ;
+ std::stringstream s ;
- if (is_infinity(*this))
+ if (isPositiveInfinity())
s << infinity_str ;
else
s << _fedTime ;
@@ -284,11 +144,11 @@
// ----------------------------------------------------------------------------
void
-RTIfedTime::getPrintableString(char *str)
+FedTime::getPrintableString(char *str)
{
- stringstream s ;
+ std::stringstream s ;
- if (is_infinity(*this))
+ if (isPositiveInfinity())
s << infinity_str ;
else
s << _fedTime ;
@@ -299,127 +159,107 @@
// ----------------------------------------------------------------------------
FedTime &
-RTIfedTime::operator+=(const FedTime &time)
- throw (RTI::InvalidFederationTime)
+FedTime::operator+=(const FedTime &time)
{
- _fedTime += rft(time)._fedTime ;
+ _fedTime += time._fedTime ;
return *this;
}
// ----------------------------------------------------------------------------
FedTime &
-RTIfedTime::operator-=(const FedTime &time)
- throw (RTI::InvalidFederationTime)
+FedTime::operator-=(const FedTime &time)
{
- _fedTime -= rft(time)._fedTime ;
+ _fedTime -= time._fedTime ;
return *this;
}
// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator<=(const FedTime &time) const
- throw (RTI::InvalidFederationTime)
+bool
+FedTime::operator<=(const FedTime &time) const
{
if (const_cast<FedTime &>(time).isPositiveInfinity())
- return RTI::RTI_TRUE ;
- else if (is_infinity(*this))
- return RTI::RTI_FALSE ;
+ return true;
+ else if (isPositiveInfinity())
+ return false;
else
- return RTI::Boolean(::fcmp(_fedTime, rft(time)._fedTime, _epsilon) <=
0);
+ return bool(::fcmp(_fedTime, time._fedTime, _epsilon) <= 0);
}
// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator<(const FedTime &time) const
- throw (RTI::InvalidFederationTime)
+bool
+FedTime::operator<(const FedTime &time) const
{
- if (is_infinity(*this))
- return RTI::RTI_FALSE ;
+ if (isPositiveInfinity())
+ return false;
else
- return RTI::Boolean(is_infinity(time) || ::fcmp(_fedTime,
rft(time)._fedTime, _epsilon) < 0);
+ return bool(time.isPositiveInfinity() || ::fcmp(_fedTime,
time._fedTime, _epsilon) < 0);
}
// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator>=(const FedTime &time) const
- throw (RTI::InvalidFederationTime)
+bool
+FedTime::operator>=(const FedTime &time) const
{
- if (is_infinity(*this))
- return RTI::RTI_TRUE ;
- else if (is_infinity(time))
- return RTI::RTI_FALSE ;
+ if (isPositiveInfinity())
+ return true;
+ else if (time.isPositiveInfinity())
+ return false;
else
- return RTI::Boolean(::fcmp(_fedTime, rft(time)._fedTime, _epsilon) >=
0);
+ return bool(::fcmp(_fedTime, time._fedTime, _epsilon) >= 0);
}
// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator>(const FedTime &time) const
- throw (RTI::InvalidFederationTime)
+bool
+FedTime::operator>(const FedTime &time) const
{
- if (is_infinity(time))
- return RTI::RTI_FALSE ;
+ if (time.isPositiveInfinity())
+ return false;
else
- return RTI::Boolean(is_infinity(*this) || ::fcmp(_fedTime,
rft(time)._fedTime, _epsilon) > 0);
+ return bool(isPositiveInfinity() || ::fcmp(_fedTime, time._fedTime,
_epsilon) > 0);
}
// ----------------------------------------------------------------------------
-inline RTI::Boolean
-RTIfedTime::operator==(const FedTime &time) const
- throw (RTI::InvalidFederationTime)
+bool
+FedTime::operator==(const FedTime &time) const
{
- if (is_infinity(*this) && is_infinity(time))
- return RTI::RTI_TRUE ;
- else if (is_infinity(*this) || is_infinity(time))
- return RTI::RTI_FALSE ;
+ if (isPositiveInfinity() && time.isPositiveInfinity())
+ return true;
+ else if (isPositiveInfinity() || time.isPositiveInfinity())
+ return false;
else
- return RTI::Boolean(::fcmp(_fedTime, rft(time)._fedTime, _epsilon) ==
0);
-}
-
-// ----------------------------------------------------------------------------
-FedTime &
-RTIfedTime::operator=(const FedTime &time)
- throw (RTI::InvalidFederationTime)
-{
- _fedTime = rft(time)._fedTime ;
- return *this ;
+ return bool(::fcmp(_fedTime, time._fedTime, _epsilon) == 0);
}
// ----------------------------------------------------------------------------
-RTI::Double
-RTIfedTime::getTime() const
+double
+FedTime::getTime() const
{
return _fedTime ;
}
// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator==(const Double &time) const
- throw (RTI::InvalidFederationTime)
+bool
+FedTime::operator==(const double &time) const
{
- return RTI::Boolean(!is_infinity(*this) && ::fcmp(_fedTime, time,
_epsilon) == 0);
+ return bool(!isPositiveInfinity() && ::fcmp(_fedTime, time, _epsilon) ==
0);
}
// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator!=(const FedTime &time) const
- throw (RTI::InvalidFederationTime)
+bool
+FedTime::operator!=(const FedTime &time) const
{
- return RTI::Boolean(::fcmp(_fedTime, rft(time)._fedTime, _epsilon) != 0);
+ return bool(::fcmp(_fedTime, time._fedTime, _epsilon) != 0);
}
// ----------------------------------------------------------------------------
-RTI::Boolean
-RTIfedTime::operator!=(const Double &time) const
- throw (RTI::InvalidFederationTime)
+bool
+FedTime::operator!=(const double &time) const
{
- return RTI::Boolean(is_infinity(*this) || ::fcmp(_fedTime, time, _epsilon)
!= 0);
+ return bool(isPositiveInfinity() || ::fcmp(_fedTime, time, _epsilon) != 0);
}
// ----------------------------------------------------------------------------
FedTime &
-RTIfedTime::operator=(const RTIfedTime &time)
- throw (RTI::InvalidFederationTime)
+FedTime::operator=(const FedTime &time)
{
_fedTime = time._fedTime ;
return *this ;
@@ -427,170 +267,158 @@
// ----------------------------------------------------------------------------
FedTime &
-RTIfedTime::operator=(const Double &time)
- throw (RTI::InvalidFederationTime)
+FedTime::operator=(const double &time)
{
_fedTime = time ;
return *this ;
}
FedTime &
-RTIfedTime::operator*=(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
+FedTime::operator*=(const FedTime &time)
{
- _fedTime *= rft(time)._fedTime ;
+ _fedTime *= time._fedTime ;
return *this ;
}
FedTime &
-RTIfedTime::operator/=(const RTI::FedTime &time)
- throw (RTI::InvalidFederationTime)
+FedTime::operator/=(const FedTime &time)
{
- _fedTime /= rft(time)._fedTime ;
+ _fedTime /= time._fedTime ;
return *this ;
}
FedTime &
-RTIfedTime::operator+=(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
+FedTime::operator+=(const double &time)
{
_fedTime += time ;
return *this ;
}
FedTime &
-RTIfedTime::operator-=(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
+FedTime::operator-=(const double &time)
{
_fedTime -= time ;
return *this ;
}
FedTime &
-RTIfedTime::operator*=(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
+FedTime::operator*=(const double &time)
{
_fedTime *= time ;
return *this ;
}
FedTime &
-RTIfedTime::operator/=(const RTI::Double &time)
- throw (RTI::InvalidFederationTime)
+FedTime::operator/=(const double &time)
{
_fedTime /= time ;
return *this ;
}
// ----------------------------------------------------------------------------
-RTIfedTime
-RTIfedTime::operator+(const FedTime &time)
- throw (RTI::InvalidFederationTime)
+FedTime
+FedTime::operator+(const FedTime &time)
{
- RTIfedTime fedtime = _fedTime + rft(time)._fedTime ;
+ FedTime fedtime = _fedTime + time._fedTime ;
return fedtime ;
}
-RTIfedTime
-RTIfedTime::operator+(const Double &time)
- throw (RTI::InvalidFederationTime)
+FedTime
+FedTime::operator+(const double &time)
{
- RTIfedTime fedtime = _fedTime + time ;
+ FedTime fedtime = _fedTime + time ;
return fedtime ;
}
// ----------------------------------------------------------------------------
-RTIfedTime
-RTIfedTime::operator-(const FedTime &time)
- throw (RTI::InvalidFederationTime)
+FedTime
+FedTime::operator-(const FedTime &time)
{
- RTIfedTime fedtime = _fedTime - rft(time)._fedTime ;
+ FedTime fedtime = _fedTime - time._fedTime ;
return fedtime ;
}
-RTIfedTime
-RTIfedTime::operator-(const Double &time)
- throw (RTI::InvalidFederationTime)
+FedTime
+FedTime::operator-(const double &time)
{
- RTIfedTime fedtime = _fedTime - time ;
+ FedTime fedtime = _fedTime - time ;
return fedtime ;
}
// ----------------------------------------------------------------------------
-RTIfedTime
-RTIfedTime::operator*(const FedTime &time)
- throw (RTI::InvalidFederationTime)
+FedTime
+FedTime::operator*(const FedTime &time)
{
- RTIfedTime fedtime = _fedTime * rft(time)._fedTime ;
+ FedTime fedtime = _fedTime * time._fedTime ;
return fedtime ;
}
-RTIfedTime
-RTIfedTime::operator*(const Double &time)
- throw (RTI::InvalidFederationTime)
+FedTime
+FedTime::operator*(const double &time)
{
- RTIfedTime fedtime = _fedTime * time ;
+ FedTime fedtime = _fedTime * time ;
return fedtime ;
}
// ----------------------------------------------------------------------------
-RTIfedTime
-RTIfedTime::operator/(const FedTime &time)
- throw (RTI::InvalidFederationTime)
+FedTime
+FedTime::operator/(const FedTime &time)
{
- RTIfedTime fedtime = _fedTime / rft(time)._fedTime ;
+ FedTime fedtime = _fedTime / time._fedTime ;
return fedtime ;
}
-RTIfedTime
-RTIfedTime::operator/(const Double &time)
- throw (RTI::InvalidFederationTime)
+FedTime
+FedTime::operator/(const double &time)
{
- RTIfedTime fedtime = _fedTime / time ;
+ FedTime fedtime = _fedTime / time ;
return fedtime ;
}
// ----------------------------------------------------------------------------
std::ostream &
-operator<<(std::ostream &s, const FedTime &time)
+certi::operator<<(std::ostream &s, const FedTime &time)
{
- if (is_infinity(time))
+ if (time.isPositiveInfinity())
s << infinity_str ;
else
- s << rft(time).getTime();
+ s << time.getTime();
return s ;
}
// ============================================================================
// ----------------------------------------------------------------------------
-RTIfedTime
-operator+(const Double &d, const FedTime &time)
+FedTime
+operator+(const double &d, const FedTime &time)
{
- RTIfedTime fedtime = d + rft(time).getTime();
+ FedTime fedtime = d + time.getTime();
return fedtime ;
}
// ----------------------------------------------------------------------------
-RTIfedTime
-operator-(const Double &d, const FedTime &time)
+FedTime
+operator-(const double &d, const FedTime &time)
{
- RTIfedTime fedtime = d - rft(time).getTime();
+ FedTime fedtime = d - time.getTime();
return fedtime ;
}
// ----------------------------------------------------------------------------
-RTIfedTime
-operator*(const Double &d, const FedTime &time)
+FedTime
+operator*(const double &d, const FedTime &time)
{
- RTIfedTime fedtime = d * rft(time).getTime();
+ FedTime fedtime = d * time.getTime();
return fedtime ;
}
// ----------------------------------------------------------------------------
-RTIfedTime
-operator/(const Double &d, const FedTime &time)
+FedTime
+operator/(const double &d, const FedTime &time)
{
- RTIfedTime fedtime = d / rft(time).getTime();
+ FedTime fedtime = d / time.getTime();
return fedtime ;
}
+
+// $Id: FedTime.cc,v 3.15.4.1 2009/01/05 13:34:50 gotthardp Exp $
+
Index: libCERTI/GAV.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/GAV.cc,v
retrieving revision 3.18
retrieving revision 3.18.4.1
diff -u -b -r3.18 -r3.18.4.1
--- libCERTI/GAV.cc 7 Dec 2008 20:16:13 -0000 3.18
+++ libCERTI/GAV.cc 5 Jan 2009 13:34:51 -0000 3.18.4.1
@@ -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: GAV.cc,v 3.18 2008/12/07 20:16:13 gotthardp Exp $
+// $Id: GAV.cc,v 3.18.4.1 2009/01/05 13:34:51 gotthardp Exp $
// ----------------------------------------------------------------------------
#include "GAV.hh"
@@ -159,14 +159,6 @@
}
// ----------------------------------------------------------------------------
-RTI::Region *
-AttributeHandleValuePairSet::getRegion(ULong) const
- throw (ArrayIndexOutOfBounds, InvalidHandleValuePairSetContext)
-{
- throw RTIinternalError("Unimplemented service");
-}
-
-// ----------------------------------------------------------------------------
void
AttributeHandleValuePairSet::add(Handle h,
const char *buff,
@@ -286,7 +278,7 @@
AttributeHandleSet::remove(AttributeHandle h)
throw (AttributeNotDefined)// not guaranteed safe while iterating
{
- if (isMember(h) == RTI::RTI_TRUE)
+ if (isMember(h) == true)
list<AttributeHandle>::remove(h);
else
throw AttributeNotDefined("");
@@ -300,17 +292,17 @@
}
// ----------------------------------------------------------------------------
-RTI::Boolean
+bool
AttributeHandleSet::isEmpty() const
{
- return RTI::Boolean(list<AttributeHandle>::empty());
+ return list<AttributeHandle>::empty();
}
// ----------------------------------------------------------------------------
-RTI::Boolean
+bool
AttributeHandleSet::isMember(AttributeHandle h) const
{
- return RTI::Boolean(find(begin(), end(), h) != end());
+ return find(begin(), end(), h) != end();
}
// ----------------------------------------------------------------------------
@@ -356,7 +348,7 @@
FederateHandleSet::remove(FederateHandle h)
throw (ArrayIndexOutOfBounds)
{
- if (isMember(h) == RTI::RTI_TRUE)
+ if (isMember(h) == true)
list<FederateHandle>::remove(h);
else
throw AttributeNotDefined("");
@@ -370,10 +362,10 @@
}
// ----------------------------------------------------------------------------
-RTI::Boolean
+bool
FederateHandleSet::isMember(FederateHandle h) const
{
- return RTI::Boolean(find(begin(), end(), h) != end());
+ return find(begin(), end(), h) != end();
}
// ----------------------------------------------------------------------------
@@ -499,14 +491,6 @@
}
// ----------------------------------------------------------------------------
-RTI::Region *
-ParameterHandleValuePairSet::getRegion() const
- throw (InvalidHandleValuePairSetContext)
-{
- throw RTIinternalError("Unimplemented service");
-}
-
-// ----------------------------------------------------------------------------
void
ParameterHandleValuePairSet::add(Handle h,
const char *buff,
@@ -581,5 +565,5 @@
} // namespace certi
-// $Id: GAV.cc,v 3.18 2008/12/07 20:16:13 gotthardp Exp $
+// $Id: GAV.cc,v 3.18.4.1 2009/01/05 13:34:51 gotthardp Exp $
Index: libCERTI/GAV.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/GAV.hh,v
retrieving revision 3.13
retrieving revision 3.13.4.1
diff -u -b -r3.13 -r3.13.4.1
--- libCERTI/GAV.hh 7 Dec 2008 20:16:13 -0000 3.13
+++ libCERTI/GAV.hh 5 Jan 2009 13:34:51 -0000 3.13.4.1
@@ -47,8 +47,8 @@
virtual void empty();
- virtual RTI::Boolean isEmpty() const ;
- virtual RTI::Boolean isMember(AttributeHandle h) const ;
+ virtual bool isEmpty() const ;
+ virtual bool isMember(AttributeHandle h) const ;
};
class FederateHandleSet : public std::list<FederateHandle>
@@ -70,7 +70,7 @@
virtual void empty();
- virtual RTI::Boolean isMember(FederateHandle h) const ;
+ virtual bool isMember(FederateHandle h) const ;
};
class AttributeHandleValuePair
@@ -118,9 +118,6 @@
virtual OrderType getOrderType(ULong i) const
throw (ArrayIndexOutOfBounds, InvalidHandleValuePairSetContext);
- virtual RTI::Region *getRegion(ULong i) const
- throw (ArrayIndexOutOfBounds, InvalidHandleValuePairSetContext);
-
virtual void add(Handle h, const char *buff, ULong valueLength)
throw (ValueLengthExceeded, ValueCountExceeded);
virtual void remove(Handle h) throw (ArrayIndexOutOfBounds);
@@ -174,9 +171,6 @@
virtual OrderType getOrderType() const
throw (InvalidHandleValuePairSetContext);
- virtual RTI::Region *getRegion() const
- throw (InvalidHandleValuePairSetContext);
-
virtual void add(Handle h, const char *buff, ULong valueLength)
throw (ValueLengthExceeded, ValueCountExceeded);
Index: libCERTI/LBTS.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/LBTS.cc,v
retrieving revision 3.12
retrieving revision 3.12.4.1
diff -u -b -r3.12 -r3.12.4.1
--- libCERTI/LBTS.cc 7 Dec 2008 20:16:14 -0000 3.12
+++ libCERTI/LBTS.cc 5 Jan 2009 13:34:51 -0000 3.12.4.1
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: LBTS.cc,v 3.12 2008/12/07 20:16:14 gotthardp Exp $
+// $Id: LBTS.cc,v 3.12.4.1 2009/01/05 13:34:51 gotthardp Exp $
// ----------------------------------------------------------------------------
@@ -122,7 +122,7 @@
void
LBTS::update(FederateHandle num_fed, FederationTime time)
{
- D.Out(pdDebug, "LBTS.update: Updating federate %d(%f).", num_fed, time);
+ D.Out(pdDebug, "LBTS.update: Updating federate %d(%f).", num_fed,
time.getTime());
ClockSet::iterator it = clocks.find(num_fed);
@@ -136,10 +136,10 @@
num_fed);
else {
D.Out(pdDebug, "before LBTS.update: federate %u, old time %f.",
- it->first, it->second);
+ it->first, it->second.getTime());
it->second = time ;
D.Out(pdDebug, "after LBTS.update: federate %u, new time %f.",
- it->first, it->second) ;
+ it->first, it->second.getTime());
compute();
}
}
@@ -160,4 +160,4 @@
} // namespace certi
-// $Id: LBTS.cc,v 3.12 2008/12/07 20:16:14 gotthardp Exp $
+// $Id: LBTS.cc,v 3.12.4.1 2009/01/05 13:34:51 gotthardp Exp $
Index: libCERTI/LBTS.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/LBTS.hh,v
retrieving revision 3.8
retrieving revision 3.8.8.1
diff -u -b -r3.8 -r3.8.8.1
--- libCERTI/LBTS.hh 20 Nov 2007 09:04:54 -0000 3.8
+++ libCERTI/LBTS.hh 5 Jan 2009 13:34:51 -0000 3.8.8.1
@@ -19,13 +19,14 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: LBTS.hh,v 3.8 2007/11/20 09:04:54 erk Exp $
+// $Id: LBTS.hh,v 3.8.8.1 2009/01/05 13:34:51 gotthardp Exp $
// ----------------------------------------------------------------------------
#ifndef LIBCERTI_LBTS_HH
#define LIBCERTI_LBTS_HH
#include "certi.hh"
+#include "FedTimeD.hh"
#ifndef _WIN32
#include <unistd.h>
@@ -68,4 +69,4 @@
#endif // LIBCERTI_LBTS_HH
-// $Id: LBTS.hh,v 3.8 2007/11/20 09:04:54 erk Exp $
+// $Id: LBTS.hh,v 3.8.8.1 2009/01/05 13:34:51 gotthardp Exp $
Index: libCERTI/Message.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message.cc,v
retrieving revision 3.62
retrieving revision 3.62.4.1
diff -u -b -r3.62 -r3.62.4.1
--- libCERTI/Message.cc 7 Dec 2008 20:16:14 -0000 3.62
+++ libCERTI/Message.cc 5 Jan 2009 13:34:51 -0000 3.62.4.1
@@ -197,23 +197,23 @@
@param the_time federation time
*/
void
-Message::setFedTime(const RTI::FedTime &the_time)
+Message::setFedTime(const double the_time)
{
- fed_time = dynamic_cast<const RTIfedTime &>(the_time);
+ fed_time = the_time;
}
// ----------------------------------------------------------------------------
void
-Message::setLookahead(const RTI::FedTime& the_lookahead)
+Message::setLookahead(const double the_lookahead)
{
- lookahead = (FederationTimeDelta) ((RTIfedTime&) the_lookahead).getTime();
+ lookahead = the_lookahead;
}
// ----------------------------------------------------------------------------
void
Message::setFederationTime(FederationTime the_time)
{
- fed_time = RTIfedTime(the_time);
+ fed_time = the_time;
}
// ----------------------------------------------------------------------------
@@ -238,14 +238,14 @@
// ----------------------------------------------------------------------------
void
-Message::setTransportation(RTI::TransportationHandle the_transport)
+Message::setTransportation(TransportType the_transport)
{
transport = the_transport;
}
// ----------------------------------------------------------------------------
void
-Message::setOrdering(RTI::OrderingHandle the_ordering)
+Message::setOrdering(OrderType the_ordering)
{
order = the_ordering;
}
Index: libCERTI/Message.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message.hh,v
retrieving revision 3.54
retrieving revision 3.54.4.1
diff -u -b -r3.54 -r3.54.4.1
--- libCERTI/Message.hh 7 Dec 2008 20:16:14 -0000 3.54
+++ libCERTI/Message.hh 5 Jan 2009 13:34:51 -0000 3.54.4.1
@@ -26,7 +26,7 @@
#include "SocketUN.hh"
#include "BasicMessage.hh"
#include "GAV.hh"
-#include "fedtime.hh"
+#include "FedTimeD.hh"
#include <vector>
#include <string>
@@ -327,10 +327,10 @@
void setResignAction(RTI::ResignAction);
RTI::ResignAction getResignAction() const { return resignAction ; };
- void setFedTime(const RTI::FedTime&);
- const RTI::FedTime& getFedTime() const { return fed_time; };
+ void setFedTime(const double);
+ double getFedTime() const { return fed_time.getTime(); };
- void setLookahead(const RTI::FedTime&);
+ void setLookahead(const double);
void setFederationTime(FederationTime);
FederationTime getFederationTime() const { return fed_time.getTime(); };
@@ -341,12 +341,12 @@
void setObject(ObjectHandle);
ObjectHandle getObject() const { return object ; };
- void setTransportation(RTI::TransportationHandle);
- RTI::TransportationHandle getTransportation() const
+ void setTransportation(TransportType);
+ TransportType getTransportation() const
{ return transport; }
- void setOrdering(RTI::OrderingHandle);
- RTI::OrderingHandle getOrdering() const
+ void setOrdering(OrderType);
+ OrderType getOrdering() const
{ return order; }
void setEventRetraction(EventRetractionHandle);
@@ -389,7 +389,7 @@
TypeException exception ;
std::string exceptionReason;
- RTIfedTime fed_time;
+ FedTime fed_time;
bool boolean ;
FederationTimeDelta lookahead ;
FederateHandle federate ;
Index: libCERTI/Message_W.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/Message_W.cc,v
retrieving revision 3.39
retrieving revision 3.39.4.1
diff -u -b -r3.39 -r3.39.4.1
--- libCERTI/Message_W.cc 21 Nov 2008 12:45:25 -0000 3.39
+++ libCERTI/Message_W.cc 5 Jan 2009 13:34:51 -0000 3.39.4.1
@@ -17,7 +17,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: Message_W.cc,v 3.39 2008/11/21 12:45:25 approx Exp $
+// $Id: Message_W.cc,v 3.39.4.1 2009/01/05 13:34:51 gotthardp Exp $
// ----------------------------------------------------------------------------
@@ -494,7 +494,7 @@
case ENABLE_TIME_CONSTRAINED:
case DISABLE_TIME_CONSTRAINED:
msgBuffer.write_bool(boolean);
- msgBuffer.write_double(lookahead);
+ msgBuffer.write_double(lookahead.getTime());
break ;
// Body contains boolean
@@ -527,7 +527,7 @@
case MODIFY_LOOKAHEAD:
case QUERY_LOOKAHEAD:
// we put another time but is the lookahead
- msgBuffer.write_double(lookahead) ;
+ msgBuffer.write_double(lookahead.getTime());
break ;
// -- Default Handler --
@@ -564,7 +564,7 @@
// Note sometimes federationTime is not useful.
msgBuffer.write_int32(this->type) ;
msgBuffer.write_int32(this->exception);
- msgBuffer.write_double(getFederationTime());
+ msgBuffer.write_double(getFederationTime().getTime());
// If the message carry an exception, the Body will only contain the
// exception reason.
@@ -609,4 +609,4 @@
} // namespace certi
-// $Id: Message_W.cc,v 3.39 2008/11/21 12:45:25 approx Exp $
+// $Id: Message_W.cc,v 3.39.4.1 2009/01/05 13:34:51 gotthardp Exp $
Index: libCERTI/NetworkMessage.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/NetworkMessage.hh,v
retrieving revision 3.44
retrieving revision 3.44.4.1
diff -u -b -r3.44 -r3.44.4.1
--- libCERTI/NetworkMessage.hh 20 Nov 2008 18:21:56 -0000 3.44
+++ libCERTI/NetworkMessage.hh 5 Jan 2009 13:34:51 -0000 3.44.4.1
@@ -17,13 +17,13 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: NetworkMessage.hh,v 3.44 2008/11/20 18:21:56 approx Exp $
+// $Id: NetworkMessage.hh,v 3.44.4.1 2009/01/05 13:34:51 gotthardp Exp $
// ----------------------------------------------------------------------------
#ifndef CERTI_NETWORK_MESSAGE_HH
#define CERTI_NETWORK_MESSAGE_HH
-#include "fedtime.hh"
+#include "FedTimeD.hh"
#include "Exception.hh"
#include "Socket.hh"
#include "RTIRegion.hh"
@@ -348,4 +348,4 @@
#endif // CERTI_NETWORK_MESSAGE_HH
-// $Id: NetworkMessage.hh,v 3.44 2008/11/20 18:21:56 approx Exp $
+// $Id: NetworkMessage.hh,v 3.44.4.1 2009/01/05 13:34:51 gotthardp Exp $
Index: libCERTI/NetworkMessage_RW.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/NetworkMessage_RW.cc,v
retrieving revision 3.52
retrieving revision 3.52.4.1
diff -u -b -r3.52 -r3.52.4.1
--- libCERTI/NetworkMessage_RW.cc 23 Oct 2008 13:46:19 -0000 3.52
+++ libCERTI/NetworkMessage_RW.cc 5 Jan 2009 13:34:52 -0000 3.52.4.1
@@ -16,8 +16,9 @@
// 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: NetworkMessage_RW.cc,v 3.52 2008/10/23 13:46:19 erk Exp $
+// $Id: NetworkMessage_RW.cc,v 3.52.4.1 2009/01/05 13:34:52 gotthardp Exp $
// ----------------------------------------------------------------------------
+
#include "NetworkMessage.hh"
#include "PrettyDebug.hh"
@@ -53,8 +54,8 @@
*/
msgBuffer.write_bool(_isDated);
if (_isDated) {
- msgBuffer.write_double(date);
- D.Out(pdDebug, "Sent Message date is <%f>", date);
+ msgBuffer.write_double(date.getTime());
+ D.Out(pdDebug, "Sent Message date is <%f>", date.getTime());
}
msgBuffer.write_bool(_isLabelled);
if (_isLabelled) {
@@ -74,8 +75,8 @@
*/
D[pdDebug] << "Deserialize <" << getName().c_str()<<">"<<endl;
/* deserialize common part */
- type =
static_cast<certi::NetworkMessage::Type>(msgBuffer.read_int32());
- exception = static_cast<certi::TypeException>(msgBuffer.read_int32());
+ type = static_cast<NetworkMessage::Type>(msgBuffer.read_int32());
+ exception = static_cast<TypeException>(msgBuffer.read_int32());
federate = msgBuffer.read_int32();
federation = msgBuffer.read_int32();
/*
@@ -87,7 +88,7 @@
_isDated = msgBuffer.read_bool();
if (_isDated) {
date = msgBuffer.read_double();
- D.Out(pdDebug, "Received Message date is <%f>", date);
+ D.Out(pdDebug, "Received Message date is <%f>",
date.getTime());
}
_isLabelled = msgBuffer.read_bool();
if (_isLabelled) {
@@ -151,4 +152,4 @@
} // namespace certi
-// $Id: NetworkMessage_RW.cc,v 3.52 2008/10/23 13:46:19 erk Exp $
+// $Id: NetworkMessage_RW.cc,v 3.52.4.1 2009/01/05 13:34:52 gotthardp Exp $
Index: libRTI/CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/libRTI/CMakeLists.txt,v
retrieving revision 1.10
retrieving revision 1.10.4.1
diff -u -b -r1.10 -r1.10.4.1
--- libRTI/CMakeLists.txt 7 Dec 2008 20:16:16 -0000 1.10
+++ libRTI/CMakeLists.txt 5 Jan 2009 13:34:52 -0000 1.10.4.1
@@ -31,7 +31,44 @@
DESTINATION lib)
ENDIF (MINGW)
-INSTALL(TARGETS RTI
+##################################################################
+# Lib FedTime
+# A replacement lib FedTime may be provided by the user
+# CERTI is provided one. The lib FedTime depends on libRTI
+# since it inherits from the RTI::FedTime abstract class.
+##################################################################
+IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long")
+ENDIF(CMAKE_COMPILER_IS_GNUCC)
+IF(CMAKE_COMPILER_IS_GNUCXX)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-long-long")
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+
+INCLUDE_DIRECTORIES(../libHLA)
+SET(FEDTIME_SRCS
+ RTIfedTime.cc
+ ${CMAKE_SOURCE_DIR}/include/fedtime.hh
+)
+
+SOURCE_GROUP("Source Files\\FedTime" FILES ${FEDTIME_SRCS})
+
+ADD_LIBRARY(FedTime
+ ${FEDTIME_SRCS}
+)
+
+TARGET_LINK_LIBRARIES(FedTime RTI HLA)
+
+SET_TARGET_PROPERTIES(FedTime PROPERTIES PROJECT_LABEL LibFedTime)
+IF (MINGW)
+ SET_TARGET_PROPERTIES(FedTime PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libFedTime.def")
+ INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libFedTime.def
+ DESTINATION lib)
+ENDIF (MINGW)
+
+SET_TARGET_PROPERTIES(FedTime PROPERTIES VERSION 1.0.0 SOVERSION 1)
+
+# Install rules for both libRTI-NG and libFedTime
+INSTALL(TARGETS RTI FedTime
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
Index: libRTI/RTIambPrivateRefs.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambPrivateRefs.cc,v
retrieving revision 3.16
retrieving revision 3.16.4.1
diff -u -b -r3.16 -r3.16.4.1
--- libRTI/RTIambPrivateRefs.cc 7 Dec 2008 20:16:16 -0000 3.16
+++ libRTI/RTIambPrivateRefs.cc 5 Jan 2009 13:34:52 -0000 3.16.4.1
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RTIambPrivateRefs.cc,v 3.16 2008/12/07 20:16:16 gotthardp Exp $
+// $Id: RTIambPrivateRefs.cc,v 3.16.4.1 2009/01/05 13:34:52 gotthardp Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -712,7 +712,7 @@
if (msg->getBoolean())
fed_amb->reflectAttributeValues(msg->getObject(),
*attributes,
- msg->getFedTime(),
+ RTIfedTime(msg->getFedTime()),
(msg->getTag()).c_str(),
msg->getEventRetraction());
else
@@ -733,7 +733,7 @@
fed_amb->receiveInteraction(
msg->getInteractionClass(),
*parameters,
- msg->getFedTime(),
+ RTIfedTime(msg->getFedTime()),
(msg->getTag()).c_str(),
msg->getEventRetraction());
else
@@ -752,7 +752,7 @@
if (msg->getBoolean()) {
fed_amb->removeObjectInstance(
msg->getObject(),
- msg->getFedTime(),
+ RTIfedTime(msg->getFedTime()),
(msg->getTag()).c_str(),
msg->getEventRetraction());
}
@@ -884,21 +884,21 @@
case Message::TIME_ADVANCE_GRANT:
try {
- fed_amb->timeAdvanceGrant(msg->getFedTime());
+ fed_amb->timeAdvanceGrant(RTIfedTime(msg->getFedTime()));
}
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("timeAdvanceGrant")
break ;
case Message::TIME_REGULATION_ENABLED:
try {
- fed_amb->timeRegulationEnabled(msg->getFedTime());
+ fed_amb->timeRegulationEnabled(RTIfedTime(msg->getFedTime()));
}
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("timeRegulationEnabled")
break ;
case Message::TIME_CONSTRAINED_ENABLED:
try {
- fed_amb->timeConstrainedEnabled(msg->getFedTime());
+ fed_amb->timeConstrainedEnabled(RTIfedTime(msg->getFedTime()));
}
CATCH_FEDERATE_AMBASSADOR_EXCEPTIONS("timeConstrainedEnabled")
break ;
@@ -908,4 +908,4 @@
}
}
-// $Id: RTIambPrivateRefs.cc,v 3.16 2008/12/07 20:16:16 gotthardp Exp $
+// $Id: RTIambPrivateRefs.cc,v 3.16.4.1 2009/01/05 13:34:52 gotthardp Exp $
Index: libRTI/RTIambPrivateRefs.hh
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambPrivateRefs.hh,v
retrieving revision 3.7
retrieving revision 3.7.4.1
diff -u -b -r3.7 -r3.7.4.1
--- libRTI/RTIambPrivateRefs.hh 7 Dec 2008 20:16:16 -0000 3.7
+++ libRTI/RTIambPrivateRefs.hh 5 Jan 2009 13:34:52 -0000 3.7.4.1
@@ -19,10 +19,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RTIambPrivateRefs.hh,v 3.7 2008/12/07 20:16:16 gotthardp Exp $
+// $Id: RTIambPrivateRefs.hh,v 3.7.4.1 2009/01/05 13:34:52 gotthardp Exp $
// ----------------------------------------------------------------------------
#include "RTI.hh"
+#include "fedtime.hh"
#include "Message.hh"
#include "RootObject.hh"
#include "MessageBuffer.hh"
@@ -59,4 +60,4 @@
MessageBuffer msgBufSend,msgBufReceive ;
};
-// $Id: RTIambPrivateRefs.hh,v 3.7 2008/12/07 20:16:16 gotthardp Exp $
+// $Id: RTIambPrivateRefs.hh,v 3.7.4.1 2009/01/05 13:34:52 gotthardp Exp $
Index: libRTI/RTIambassador.cc
===================================================================
RCS file: /sources/certi/certi/libRTI/RTIambassador.cc,v
retrieving revision 3.101
retrieving revision 3.101.4.1
diff -u -b -r3.101 -r3.101.4.1
--- libRTI/RTIambassador.cc 7 Dec 2008 20:16:16 -0000 3.101
+++ libRTI/RTIambassador.cc 5 Jan 2009 13:34:52 -0000 3.101.4.1
@@ -19,11 +19,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RTIambassador.cc,v 3.101 2008/12/07 20:16:16 gotthardp Exp $
+// $Id: RTIambassador.cc,v 3.101.4.1 2009/01/05 13:34:52 gotthardp Exp $
// ----------------------------------------------------------------------------
-
-#include "certi.hh"
+#include "RTI.hh"
+#include "fedtime.hh"
#include "RTIambPrivateRefs.hh"
#include "RTItypesImp.hh"
@@ -612,7 +612,7 @@
//! Request Federation Save with time.
void
RTI::RTIambassador::requestFederationSave(const char *label,
- const FedTime& theTime)
+ const RTI::FedTime& theTime)
throw (RTI::FederationTimeAlreadyPassed,
RTI::InvalidFederationTime,
RTI::FederateNotExecutionMember,
@@ -626,7 +626,7 @@
G.Out(pdGendoc,"enter RTIambassador::requestFederationSave with time");
req.type = Message::REQUEST_FEDERATION_SAVE ;
- req.setFedTime(theTime);
+ req.setFedTime(cast<RTIfedTime>()(theTime).getTime());
req.setLabel(label);
// boolean true means time constrained
req.setBoolean(true);
@@ -975,11 +975,11 @@
@param theTime Federation time
@param theTag User supplied tag
*/
-EventRetractionHandle
+RTI::EventRetractionHandle
RTI::RTIambassador::
updateAttributeValues(ObjectHandle theObject,
const AttributeHandleValuePairSet& theAttributes,
- const FedTime& theTime,
+ const RTI::FedTime& theTime,
const char *theTag)
throw (RTI::ObjectNotKnown,
RTI::AttributeNotDefined,
@@ -996,7 +996,7 @@
req.type = Message::UPDATE_ATTRIBUTE_VALUES ;
req.setObject(theObject);
- req.setFedTime(theTime);
+ req.setFedTime(cast<RTIfedTime>()(theTime).getTime());
if ( theTag == NULL)
{
throw RTI::RTIinternalError ("Calling updateAttributeValues with Tag
NULL");
@@ -1054,10 +1054,10 @@
@param theTime Federation time
@param theTag User-supplied tag
*/
-EventRetractionHandle
+RTI::EventRetractionHandle
RTI::RTIambassador::sendInteraction(InteractionClassHandle theInteraction,
const ParameterHandleValuePairSet&
theParameters,
- const FedTime& theTime,
+ const RTI::FedTime& theTime,
const char *theTag)
throw (RTI::InteractionClassNotDefined,
RTI::InteractionClassNotPublished,
@@ -1073,7 +1073,7 @@
req.type = Message::SEND_INTERACTION ;
req.setInteractionClass(theInteraction);
- req.setFedTime(theTime);
+ req.setFedTime(cast<RTIfedTime>()(theTime).getTime());
if (theTag == NULL)
{
throw RTI::RTIinternalError ("Calling sendInteraction with Tag NULL") ;
@@ -1130,9 +1130,9 @@
@param theTime Federation time
@param theTag user supplied tag
*/
-EventRetractionHandle
+RTI::EventRetractionHandle
RTI::RTIambassador::deleteObjectInstance(ObjectHandle theObject,
- const FedTime& theTime,
+ const RTI::FedTime& theTime,
const char *theTag)
throw (RTI::ObjectNotKnown,
RTI::DeletePrivilegeNotHeld,
@@ -1147,7 +1147,7 @@
req.type = Message::DELETE_OBJECT_INSTANCE ;
req.setObject(theObject);
- req.setFedTime(theTime);
+ req.setFedTime(cast<RTIfedTime>()(theTime).getTime());
if (theTag == NULL)
{
throw RTI::RTIinternalError ("Calling deleteObjectInstance with Tag
NULL") ;
@@ -1531,8 +1531,8 @@
// ----------------------------------------------------------------------------
// Enable Time Regulation
void
-RTI::RTIambassador::enableTimeRegulation(const FedTime& theFederateTime,
- const FedTime& theLookahead)
+RTI::RTIambassador::enableTimeRegulation(const RTI::FedTime& theFederateTime,
+ const RTI::FedTime& theLookahead)
throw (RTI::RTIinternalError, RTI::RestoreInProgress,
RTI::SaveInProgress, RTI::FederateNotExecutionMember,
RTI::ConcurrentAccessAttempted, RTI::InvalidLookahead,
@@ -1541,8 +1541,8 @@
{
Message req, rep ;
req.type = Message::ENABLE_TIME_REGULATION ;
- req.setFedTime(theFederateTime);
- req.setLookahead(theLookahead);
+ req.setFedTime(cast<RTIfedTime>()(theFederateTime).getTime());
+ req.setLookahead(cast<RTIfedTime>()(theLookahead).getTime());
req.setBoolean(true);
privateRefs->executeService(&req, &rep);
}
@@ -1603,7 +1603,7 @@
// ----------------------------------------------------------------------------
// Time Advance Request
void
-RTI::RTIambassador::timeAdvanceRequest(const FedTime& theTime)
+RTI::RTIambassador::timeAdvanceRequest(const RTI::FedTime& theTime)
throw (RTI::TimeAdvanceAlreadyInProgress,
RTI::FederationTimeAlreadyPassed,
RTI::InvalidFederationTime,
@@ -1618,14 +1618,14 @@
Message req, rep ;
req.type = Message::TIME_ADVANCE_REQUEST ;
- req.setFedTime(theTime);
+ req.setFedTime(cast<RTIfedTime>()(theTime).getTime());
privateRefs->executeService(&req, &rep);
}
// ----------------------------------------------------------------------------
// Time Advance Request Available
void
-RTI::RTIambassador::timeAdvanceRequestAvailable(const FedTime& theTime)
+RTI::RTIambassador::timeAdvanceRequestAvailable(const RTI::FedTime& theTime)
throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
RTI::EnableTimeConstrainedPending, RTI::EnableTimeRegulationPending,
@@ -1635,7 +1635,7 @@
Message req, rep ;
req.type = Message::TIME_ADVANCE_REQUEST_AVAILABLE ;
- req.setFedTime(theTime);
+ req.setFedTime(cast<RTIfedTime>()(theTime).getTime());
privateRefs->executeService(&req, &rep);
}
@@ -1643,7 +1643,7 @@
// ----------------------------------------------------------------------------
// Next Event Request
void
-RTI::RTIambassador::nextEventRequest(const FedTime& theTime)
+RTI::RTIambassador::nextEventRequest(const RTI::FedTime& theTime)
throw (RTI::TimeAdvanceAlreadyInProgress,
RTI::FederationTimeAlreadyPassed,
RTI::InvalidFederationTime,
@@ -1658,14 +1658,14 @@
Message req, rep ;
req.type = Message::NEXT_EVENT_REQUEST ;
- req.setFedTime(theTime);
+ req.setFedTime(cast<RTIfedTime>()(theTime).getTime());
privateRefs->executeService(&req, &rep);
}
// ----------------------------------------------------------------------------
// Next Event Request Available
void
-RTI::RTIambassador::nextEventRequestAvailable(const FedTime& theTime)
+RTI::RTIambassador::nextEventRequestAvailable(const RTI::FedTime& theTime)
throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
RTI::EnableTimeConstrainedPending, RTI::EnableTimeRegulationPending,
@@ -1675,14 +1675,14 @@
Message req, rep ;
req.type = Message::NEXT_EVENT_REQUEST_AVAILABLE ;
- req.setFedTime(theTime);
+ req.setFedTime(cast<RTIfedTime>()(theTime).getTime());
privateRefs->executeService(&req, &rep);
}
// ----------------------------------------------------------------------------
// Flush Queue Request
void
-RTI::RTIambassador::flushQueueRequest(const FedTime& theTime)
+RTI::RTIambassador::flushQueueRequest(const RTI::FedTime& theTime)
throw (RTI::TimeAdvanceAlreadyInProgress,
RTI::FederationTimeAlreadyPassed,
RTI::InvalidFederationTime,
@@ -1698,7 +1698,7 @@
Message req, rep ;
req.type = Message::FLUSH_QUEUE_REQUEST ;
- req.setFedTime(theTime);
+ req.setFedTime(cast<RTIfedTime>()(theTime).getTime());
privateRefs->executeService(&req, &rep);
}
@@ -1738,7 +1738,7 @@
// ----------------------------------------------------------------------------
// Query LBTS
void
-RTI::RTIambassador::queryLBTS(FedTime& theTime)
+RTI::RTIambassador::queryLBTS(RTI::FedTime& theTime)
throw (RTI::FederateNotExecutionMember,
RTI::ConcurrentAccessAttempted,
RTI::SaveInProgress,
@@ -1750,13 +1750,13 @@
req.type = Message::QUERY_LBTS ;
privateRefs->executeService(&req, &rep);
- theTime = rep.getFedTime();
+ cast<RTIfedTime>()(theTime) = rep.getFedTime();
}
// ----------------------------------------------------------------------------
// Query Federate Time
void
-RTI::RTIambassador::queryFederateTime(FedTime& theTime)
+RTI::RTIambassador::queryFederateTime(RTI::FedTime& theTime)
throw (RTI::FederateNotExecutionMember,
RTI::ConcurrentAccessAttempted,
RTI::SaveInProgress,
@@ -1768,13 +1768,13 @@
req.type = Message::QUERY_FEDERATE_TIME ;
privateRefs->executeService(&req, &rep);
- theTime = rep.getFedTime();
+ cast<RTIfedTime>()(theTime) = rep.getFedTime();
}
// ----------------------------------------------------------------------------
// Query Minimum Next Event Time
void
-RTI::RTIambassador::queryMinNextEventTime(FedTime& theTime)
+RTI::RTIambassador::queryMinNextEventTime(RTI::FedTime& theTime)
throw (RTI::FederateNotExecutionMember,
RTI::ConcurrentAccessAttempted,
RTI::SaveInProgress,
@@ -1786,13 +1786,13 @@
req.type = Message::QUERY_MIN_NEXT_EVENT_TIME ;
privateRefs->executeService(&req, &rep);
- theTime = rep.getFedTime();
+ cast<RTIfedTime>()(theTime) = rep.getFedTime();
}
// ----------------------------------------------------------------------------
// Modify Lookahead
void
-RTI::RTIambassador::modifyLookahead(const FedTime& theLookahead)
+RTI::RTIambassador::modifyLookahead(const RTI::FedTime& theLookahead)
throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
RTI::InvalidLookahead)
@@ -1800,7 +1800,7 @@
Message req, rep ;
req.type = Message::MODIFY_LOOKAHEAD ;
- req.setLookahead(theLookahead);
+ req.setLookahead(cast<RTIfedTime>()(theLookahead).getTime());
privateRefs->executeService(&req, &rep);
}
@@ -1808,7 +1808,7 @@
// ----------------------------------------------------------------------------
// Query Lookahead
void
-RTI::RTIambassador::queryLookahead(FedTime &theTime)
+RTI::RTIambassador::queryLookahead(RTI::FedTime &theTime)
throw (RTI::FederateNotExecutionMember,
RTI::ConcurrentAccessAttempted,
RTI::SaveInProgress,
@@ -1820,19 +1820,13 @@
req.type = Message::QUERY_LOOKAHEAD ;
privateRefs->executeService(&req, &rep);
- try {
- RTIfedTime &ret = dynamic_cast<RTIfedTime&>(theTime);
- ret = RTIfedTime((Double) rep.getFederationTimeDelta());
- }
- catch (std::bad_cast) {
- throw RTI::RTIinternalError("theTime is not a RTIfedTime object");
- }
+ cast<RTIfedTime>()(theTime) = rep.getFederationTimeDelta().getTime();
}
// ----------------------------------------------------------------------------
// Retract
void
-RTI::RTIambassador::retract(EventRetractionHandle handle)
+RTI::RTIambassador::retract(RTI::EventRetractionHandle handle)
throw (RTI::RTIinternalError, RTI::RestoreInProgress, RTI::SaveInProgress,
RTI::ConcurrentAccessAttempted, RTI::FederateNotExecutionMember,
RTI::InvalidRetractionHandle)
@@ -2234,10 +2228,10 @@
// ----------------------------------------------------------------------------
// Send Interaction With Region
-EventRetractionHandle
+RTI::EventRetractionHandle
RTI::RTIambassador::sendInteractionWithRegion(InteractionClassHandle
interaction,
const ParameterHandleValuePairSet
&par,
- const FedTime &time,
+ const RTI::FedTime &time,
const char *tag,
const Region ®ion)
throw (RTI::InteractionClassNotDefined,
@@ -2257,7 +2251,7 @@
req.setType(Message::SEND_INTERACTION);
req.setInteractionClass(interaction);
req.setPHVPS(cast<ParameterHandleValuePairSetImp>()(par).getParameterHandleValuePairs());
- req.setFedTime(time);
+ req.setFedTime(cast<RTIfedTime>()(time).getTime());
if ( tag == NULL )
{
throw RTI::RTIinternalError ("Calling sendInteractionWithRegion with
Tag NULL");
@@ -2955,4 +2949,4 @@
privateRefs->executeService(&req, &rep);
}
-// $Id: RTIambassador.cc,v 3.101 2008/12/07 20:16:16 gotthardp Exp $
+// $Id: RTIambassador.cc,v 3.101.4.1 2009/01/05 13:34:52 gotthardp Exp $
Index: libRTI/RTItypesImp.hh
===================================================================
RCS file: /sources/certi/certi/libRTI/RTItypesImp.hh,v
retrieving revision 3.1
retrieving revision 3.1.4.1
diff -u -b -r3.1 -r3.1.4.1
--- libRTI/RTItypesImp.hh 7 Dec 2008 20:16:17 -0000 3.1
+++ libRTI/RTItypesImp.hh 5 Jan 2009 13:34:52 -0000 3.1.4.1
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RTItypesImp.hh,v 3.1 2008/12/07 20:16:17 gotthardp Exp $
+// $Id: RTItypesImp.hh,v 3.1.4.1 2009/01/05 13:34:52 gotthardp Exp $
// ----------------------------------------------------------------------------
#ifndef _RTI_TYPESIMP_HH
@@ -44,6 +44,18 @@
throw RTI::RTIinternalError("Incompatible object on input.");
}
}
+
+ template<class R>
+ I& operator()(R& imp)
+ {
+ try {
+ return dynamic_cast<I&>(imp);
+ }
+ catch (...)
+ {
+ throw RTI::RTIinternalError("Incompatible object on input.");
+ }
+ }
};
typedef std::pair<AttributeHandle, AttributeValue_t>
AttributeHandleValuePair_t;
@@ -251,4 +263,4 @@
#endif // _RTI_TYPESIMP_HH
-// $Id: RTItypesImp.hh,v 3.1 2008/12/07 20:16:17 gotthardp Exp $
+// $Id: RTItypesImp.hh,v 3.1.4.1 2009/01/05 13:34:52 gotthardp Exp $
Index: libCERTI/FedTimeD.hh
===================================================================
RCS file: libCERTI/FedTimeD.hh
diff -N libCERTI/FedTimeD.hh
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libCERTI/FedTimeD.hh 5 Jan 2009 13:34:51 -0000 1.1.2.1
@@ -0,0 +1,185 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2005 ONERA
+//
+// This file is part of CERTI-libCERTI
+//
+// CERTI-libCERTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libCERTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// 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: FedTimeD.hh,v 1.1.2.1 2009/01/05 13:34:51 gotthardp Exp $
+// ----------------------------------------------------------------------------
+
+#ifndef CERTI_FEDTIMED_HH
+#define CERTI_FEDTIMED_HH
+
+#include <math.h>
+#include <ostream>
+
+namespace certi {
+
+/*
+ fcmp
+ Copyright (c) 1998-2000 Theodore C. Belding
+ University of Michigan Center for the Study of Complex Systems
+ <mailto:address@hidden>
+ <http://fcmp.sourceforge.net>
+
+ This file is part of the fcmp distribution. fcmp is free software;
+ you can redistribute and modify it under the terms of the GNU Library
+ General Public License (LGPL), version 2 or later. This software
+ comes with absolutely no warranty. See the file COPYING for details
+ and terms of copying.
+
+ Description:
+
+ Knuth's floating point comparison operators, from:
+ Knuth, D. E. (1998). The Art of Computer Programming.
+ Volume 2: Seminumerical Algorithms. 3rd ed. Addison-Wesley.
+ Section 4.2.2, p. 233. ISBN 0-201-89684-2.
+
+ Input parameters:
+ x1, x2: numbers to be compared
+ epsilon: determines tolerance
+
+ epsilon should be carefully chosen based on the machine's precision,
+ the observed magnitude of error, the desired precision, and the
+ magnitude of the numbers to be compared. See the fcmp README file for
+ more information.
+
+ This routine may be used for both single-precision (float) and
+ double-precision (double) floating-point numbers.
+
+ Returns:
+ -1 if x1 < x2
+ 0 if x1 == x2
+ 1 if x1 > x2
+*/
+
+inline int
+fcmp(double x1,double x2, double epsilon)
+{
+ int exponent;
+ double delta;
+ double difference;
+
+ /* Get exponent(max(fabs(x1), fabs(x2))) and store it in exponent. */
+
+ /* If neither x1 nor x2 is 0, */
+ /* this is equivalent to max(exponent(x1), exponent(x2)). */
+
+ /* If either x1 or x2 is 0, its exponent returned by frexp would be 0, */
+ /* which is much larger than the exponents of numbers close to 0 in */
+ /* magnitude. But the exponent of 0 should be less than any number */
+ /* whose magnitude is greater than 0. */
+
+ /* So we only want to set exponent to 0 if both x1 and */
+ /* x2 are 0. Hence, the following works for all x1 and x2. */
+
+ frexp(fabs(x1) > fabs(x2) ? x1 : x2, &exponent);
+
+ /* Do the comparison. */
+
+ /* delta = epsilon * pow(2, exponent) */
+
+ /* Form a neighborhood around x2 of size delta in either direction. */
+ /* If x1 is within this delta neighborhood of x2, x1 == x2. */
+ /* Otherwise x1 > x2 or x1 < x2, depending on which side of */
+ /* the neighborhood x1 is on. */
+
+ delta = ldexp(epsilon, exponent);
+
+ difference = x1 - x2;
+
+ if (difference > delta)
+ return 1; /* x1 > x2 */
+ else if (difference < -delta)
+ return -1; /* x1 < x2 */
+ else /* -delta <= difference <= delta */
+ return 0; /* x1 == x2 */
+}
+
+class FedTime
+{
+public:
+ static const double epsilon;
+ static int fcmp(const double x1, const double x2);
+
+ FedTime();
+ FedTime(const double &);
+ FedTime(const FedTime &);
+ ~FedTime();
+
+public:
+ void setZero();
+ bool isZero();
+ void setEpsilon();
+ void setPositiveInfinity();
+ bool isPositiveInfinity() const;
+ int encodedLength() const;
+ void encode(char *) const;
+ int getPrintableLength() const;
+ void getPrintableString(char *);
+ double getTime() const;
+
+ FedTime& operator+=(const FedTime &);
+ FedTime& operator-=(const FedTime &);
+ bool operator<=(const FedTime &) const;
+ bool operator<(const FedTime &) const;
+ bool operator>=(const FedTime &) const;
+ bool operator>(const FedTime &) const;
+ bool operator==(const FedTime &) const;
+ bool operator==(const double &) const;
+ bool operator!=(const FedTime &) const;
+ bool operator!=(const double &) const;
+ FedTime &operator=(const FedTime &);
+ FedTime &operator=(const double &);
+ FedTime &operator*=(const FedTime &);
+ FedTime &operator/=(const FedTime &);
+ FedTime &operator+=(const double &);
+ FedTime &operator-=(const double &);
+ FedTime &operator*=(const double &);
+ FedTime &operator/=(const double &);
+ FedTime operator+(const FedTime &);
+ FedTime operator+(const double &);
+ FedTime operator-(const FedTime &);
+ FedTime operator-(const double &);
+ FedTime operator*(const FedTime &);
+ FedTime operator*(const double &);
+ FedTime operator/(const FedTime &);
+ FedTime operator/(const double &);
+
+ friend std::ostream &operator<<(std::ostream&, const FedTime &time);
+
+private:
+ double _fedTime ;
+ double _zero ;
+ double _epsilon ;
+ double _positiveInfinity ;
+};
+
+FedTime operator+(const double &, const FedTime &);
+FedTime operator-(const double &, const FedTime &);
+FedTime operator*(const double &, const FedTime &);
+FedTime operator/(const double &, const FedTime &);
+
+typedef FedTime FederationTime;
+typedef FedTime FederationTimeDelta;
+
+} // namespace certi
+
+#endif // CERTI_FEDTIMED_HH
+
+// $Id: FedTimeD.hh,v 1.1.2.1 2009/01/05 13:34:51 gotthardp Exp $
Index: libRTI/RTIfedTime.cc
===================================================================
RCS file: libRTI/RTIfedTime.cc
diff -N libRTI/RTIfedTime.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libRTI/RTIfedTime.cc 5 Jan 2009 13:34:52 -0000 1.1.2.1
@@ -0,0 +1,501 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2006 ONERA
+//
+// This file is part of CERTI-libCERTI
+//
+// CERTI-libCERTI is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// CERTI-libCERTI is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// ----------------------------------------------------------------------------
+
+#include <math.h>
+
+#include "certi.hh"
+#include "fedtime.hh"
+#include "FedTimeD.hh"
+
+#include <algorithm>
+#include <limits>
+#include <sstream>
+#include <typeinfo>
+
+using std::stringstream ;
+
+namespace
+{
+
+// ----------------------------------------------------------------------------
+/** FedTime to RTIfedTime reference cast
+ */
+inline const RTIfedTime &
+rft(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ try {
+ return dynamic_cast<const RTIfedTime &>(time);
+ }
+ catch (std::bad_cast) {
+ throw RTI::InvalidFederationTime("Could not cast to RTIfedTime");
+ }
+}
+
+inline bool
+is_infinity(const RTI::FedTime &time)
+{
+ return const_cast<RTI::FedTime &>(time).isPositiveInfinity() ==
RTI::RTI_TRUE ;
+}
+
+const char *infinity_str = "+inf" ;
+
+} // anonymous namespace
+
+// ----------------------------------------------------------------------------
+// FedTimeFactory
+RTI::FedTime *
+RTI::FedTimeFactory::makeZero()
+ throw (RTI::MemoryExhausted)
+{
+ try {
+ return new RTIfedTime();
+ }
+ catch (std::bad_alloc) {
+ throw RTI::MemoryExhausted("Cannot allocate RTI::FedTime.");
+ }
+}
+
+RTI::FedTime *
+RTI::FedTimeFactory::decode(const char *buf)
+ throw (RTI::MemoryExhausted)
+{
+ try {
+ return new RTIfedTime(*(const RTI::Double*)buf);
+ }
+ catch (std::bad_alloc) {
+ throw RTI::MemoryExhausted("Cannot allocate RTI::FedTime.");
+ }
+}
+
+// ----------------------------------------------------------------------------
+// RTIfedTime
+RTIfedTime::RTIfedTime()
+ : _fedTime(0),
+ _zero(0),
+ _epsilon(std::numeric_limits<double>::epsilon()),
+ _positiveInfinity(std::numeric_limits<double>::infinity()) { }
+
+RTIfedTime::RTIfedTime(const RTI::Double &time)
+ : _fedTime(time),
+ _zero(0),
+ _epsilon(std::numeric_limits<double>::epsilon()),
+ _positiveInfinity(std::numeric_limits<double>::infinity()) { }
+
+RTIfedTime::RTIfedTime(const RTI::FedTime &time)
+ : _fedTime(rft(time).getTime()),
+ _zero(0),
+ _epsilon(std::numeric_limits<double>::epsilon()),
+ _positiveInfinity(std::numeric_limits<double>::infinity()) { }
+
+// ----------------------------------------------------------------------------
+RTIfedTime::RTIfedTime(const RTIfedTime &time)
+ : FedTime(),
+ _fedTime(time._fedTime),
+ _zero(time._zero),
+ _epsilon(time._epsilon),
+ _positiveInfinity(time._positiveInfinity) { }
+
+// ----------------------------------------------------------------------------
+RTIfedTime::~RTIfedTime()
+{
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIfedTime::setZero()
+{
+ _fedTime = _zero;
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::isZero()
+{
+ return RTI::Boolean(_fedTime == _zero);
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIfedTime::setEpsilon()
+{
+ _fedTime = _epsilon;
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIfedTime::setPositiveInfinity()
+{
+ _fedTime = _positiveInfinity;
+}
+
+// ----------------------------------------------------------------------------
+inline RTI::Boolean
+RTIfedTime::isPositiveInfinity()
+{
+ return RTI::Boolean(_fedTime == _positiveInfinity);
+}
+
+// ----------------------------------------------------------------------------
+int
+RTIfedTime::encodedLength() const
+{
+ // current implementation of RTIfedtime takes
+ // four IEEE-754 double values.
+ return (sizeof(_fedTime)+
+ sizeof(_zero)+
+ sizeof(_epsilon)+
+ sizeof(_positiveInfinity));
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIfedTime::encode(char *buffer) const
+{
+ memcpy(buffer, &_fedTime, sizeof(RTI::Double));
+}
+
+// ----------------------------------------------------------------------------
+int
+RTIfedTime::getPrintableLength() const
+{
+ stringstream s ;
+
+ if (is_infinity(*this))
+ s << infinity_str ;
+ else
+ s << _fedTime ;
+
+ return s.str().length() + 1 ;
+}
+
+// ----------------------------------------------------------------------------
+void
+RTIfedTime::getPrintableString(char *str)
+{
+ stringstream s ;
+
+ if (is_infinity(*this))
+ s << infinity_str ;
+ else
+ s << _fedTime ;
+
+ s >> str ;
+ str[s.str().length()] = 0 ;
+}
+
+// ----------------------------------------------------------------------------
+RTI::FedTime &
+RTIfedTime::operator+=(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime += rft(time)._fedTime ;
+ return *this;
+}
+
+// ----------------------------------------------------------------------------
+RTI::FedTime &
+RTIfedTime::operator-=(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime -= rft(time)._fedTime ;
+ return *this;
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator<=(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ if (const_cast<RTI::FedTime &>(time).isPositiveInfinity())
+ return RTI::RTI_TRUE ;
+ else if (is_infinity(*this))
+ return RTI::RTI_FALSE ;
+ else
+ return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon)
<= 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator<(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ if (is_infinity(*this))
+ return RTI::RTI_FALSE ;
+ else
+ return RTI::Boolean(is_infinity(time) || certi::fcmp(_fedTime,
rft(time)._fedTime, _epsilon) < 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator>=(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ if (is_infinity(*this))
+ return RTI::RTI_TRUE ;
+ else if (is_infinity(time))
+ return RTI::RTI_FALSE ;
+ else
+ return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon)
>= 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator>(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ if (is_infinity(time))
+ return RTI::RTI_FALSE ;
+ else
+ return RTI::Boolean(is_infinity(*this) || certi::fcmp(_fedTime,
rft(time)._fedTime, _epsilon) > 0);
+}
+
+// ----------------------------------------------------------------------------
+inline RTI::Boolean
+RTIfedTime::operator==(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ if (is_infinity(*this) && is_infinity(time))
+ return RTI::RTI_TRUE ;
+ else if (is_infinity(*this) || is_infinity(time))
+ return RTI::RTI_FALSE ;
+ else
+ return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon)
== 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::FedTime &
+RTIfedTime::operator=(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime = rft(time)._fedTime ;
+ return *this ;
+}
+
+// ----------------------------------------------------------------------------
+RTI::Double
+RTIfedTime::getTime() const
+{
+ return _fedTime ;
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator==(const RTI::Double &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ return RTI::Boolean(!is_infinity(*this) && certi::fcmp(_fedTime, time,
_epsilon) == 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator!=(const RTI::FedTime &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ return RTI::Boolean(certi::fcmp(_fedTime, rft(time)._fedTime, _epsilon) !=
0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::Boolean
+RTIfedTime::operator!=(const RTI::Double &time) const
+ throw (RTI::InvalidFederationTime)
+{
+ return RTI::Boolean(is_infinity(*this) || certi::fcmp(_fedTime, time,
_epsilon) != 0);
+}
+
+// ----------------------------------------------------------------------------
+RTI::FedTime &
+RTIfedTime::operator=(const RTIfedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime = time._fedTime ;
+ return *this ;
+}
+
+// ----------------------------------------------------------------------------
+RTI::FedTime &
+RTIfedTime::operator=(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime = time ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator*=(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime *= rft(time)._fedTime ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator/=(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime /= rft(time)._fedTime ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator+=(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime += time ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator-=(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime -= time ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator*=(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime *= time ;
+ return *this ;
+}
+
+RTI::FedTime &
+RTIfedTime::operator/=(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ _fedTime /= time ;
+ return *this ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+RTIfedTime::operator+(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime + rft(time)._fedTime ;
+ return fedtime ;
+}
+
+RTIfedTime
+RTIfedTime::operator+(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime + time ;
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+RTIfedTime::operator-(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime - rft(time)._fedTime ;
+ return fedtime ;
+}
+
+RTIfedTime
+RTIfedTime::operator-(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime - time ;
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+RTIfedTime::operator*(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime * rft(time)._fedTime ;
+ return fedtime ;
+}
+
+RTIfedTime
+RTIfedTime::operator*(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime * time ;
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+RTIfedTime::operator/(const RTI::FedTime &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime / rft(time)._fedTime ;
+ return fedtime ;
+}
+
+RTIfedTime
+RTIfedTime::operator/(const RTI::Double &time)
+ throw (RTI::InvalidFederationTime)
+{
+ RTIfedTime fedtime = _fedTime / time ;
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+std::ostream &
+operator<<(std::ostream &s, const RTI::FedTime &time)
+{
+ if (is_infinity(time))
+ s << infinity_str ;
+ else
+ s << rft(time).getTime();
+ return s ;
+}
+
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+operator+(const RTI::Double &d, const RTI::FedTime &time)
+{
+ RTIfedTime fedtime = d + rft(time).getTime();
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+operator-(const RTI::Double &d, const RTI::FedTime &time)
+{
+ RTIfedTime fedtime = d - rft(time).getTime();
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+operator*(const RTI::Double &d, const RTI::FedTime &time)
+{
+ RTIfedTime fedtime = d * rft(time).getTime();
+ return fedtime ;
+}
+
+// ----------------------------------------------------------------------------
+RTIfedTime
+operator/(const RTI::Double &d, const RTI::FedTime &time)
+{
+ RTIfedTime fedtime = d / rft(time).getTime();
+ return fedtime ;
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi RTIA/RTIA_network.cc RTIA/TimeManagement.... [br_DEV_NoCircularRef],
certi-cvs <=