📄 timeservices.cc
字号:
// ----------------------------------------------------------------------------// CERTI - HLA RunTime Infrastructure// Copyright (C) 2002, 2003 ONERA//// This file is part of CERTI-libRTI//// CERTI-libRTI 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-libRTI 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: TimeServices.cc,v 3.2 2003/10/06 16:19:44 breholee Exp $// ----------------------------------------------------------------------------#include <config.h>#include "RTIambassador.hh"#include "Message.hh"namespace certi {static pdCDebug D("LIBRTI", "(libRTI TM) - ");// ===========================================================================// TIME MANAGEMENT// ===========================================================================// ----------------------------------------------------------------------------// Enable Time RegulationvoidRTIambassador::enableTimeRegulation(const FedTime& /*theFederateTime*/, const FedTime& /*theLookahead*/) throw (FederationTimeAlreadyPassed, TimeRegulationAlreadyEnabled, //not implemented EnableTimeRegulationPending, //not implemented TimeAdvanceAlreadyInProgress, //not implemented InvalidFederationTime, //not implemented InvalidLookahead, //not implemented ConcurrentAccessAttempted, //not implemented FederateNotExecutionMember, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::ENABLE_TIME_REGULATION ; req.setBoolean(RTI_TRUE); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Disable Time RegulationvoidRTIambassador::disableTimeRegulation() throw (FederationTimeAlreadyPassed, TimeRegulationWasNotEnabled, //not implemented ConcurrentAccessAttempted, FederateNotExecutionMember, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::DISABLE_TIME_REGULATION ; req.setBoolean(RTI_FALSE); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Enable Time ConstrainedvoidRTIambassador::enableTimeConstrained() throw (TimeConstrainedAlreadyEnabled, //not implemented EnableTimeConstrainedPending, //not implemented TimeAdvanceAlreadyInProgress, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::ENABLE_TIME_CONSTRAINED ; req.setBoolean(RTI_TRUE); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Disable Time ConstrainedvoidRTIambassador::disableTimeConstrained() throw (TimeConstrainedWasNotEnabled, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::DISABLE_TIME_CONSTRAINED ; req.setBoolean(RTI_FALSE); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Time Advance RequestvoidRTIambassador::timeAdvanceRequest(const FedTime& theTime) throw (TimeAdvanceAlreadyInProgress, FederationTimeAlreadyPassed, InvalidFederationTime, EnableTimeRegulationPending, //not implemented EnableTimeConstrainedPending, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::TIME_ADVANCE_REQUEST ; req.setFedTime(theTime); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Time Advance Request AvailablevoidRTIambassador::timeAdvanceRequestAvailable(const FedTime& theTime) throw (InvalidFederationTime, FederationTimeAlreadyPassed, TimeAdvanceAlreadyInProgress, EnableTimeRegulationPending, EnableTimeConstrainedPending, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError, UnimplementedService){ throw UnimplementedService(); Message req, rep ; req.type = Message::TIME_ADVANCE_REQUEST_AVAILABLE ; req.setFedTime(theTime); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Next Event RequestvoidRTIambassador::nextEventRequest(const FedTime& theTime) throw (TimeAdvanceAlreadyInProgress, FederationTimeAlreadyPassed, InvalidFederationTime, EnableTimeRegulationPending, //not implemented EnableTimeConstrainedPending, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::NEXT_EVENT_REQUEST ; req.setFedTime(theTime); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Next Event Request AvailablevoidRTIambassador::nextEventRequestAvailable(const FedTime& theTime) throw (InvalidFederationTime, FederationTimeAlreadyPassed, TimeAdvanceAlreadyInProgress, EnableTimeRegulationPending, EnableTimeConstrainedPending, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError, UnimplementedService){ throw UnimplementedService(); Message req, rep ; req.type = Message::NEXT_EVENT_REQUEST ; req.setFedTime(theTime); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Flush Queue RequestvoidRTIambassador::flushQueueRequest(const FedTime& theTime) throw (TimeAdvanceAlreadyInProgress, FederationTimeAlreadyPassed, InvalidFederationTime, EnableTimeRegulationPending, //not implemented EnableTimeConstrainedPending, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ throw UnimplementedService(); Message req, rep ; req.type = Message::FLUSH_QUEUE_REQUEST ; req.setFedTime(theTime); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Enable Asynchronous DeliveryvoidRTIambassador::enableAsynchronousDelivery() throw (AsynchronousDeliveryAlreadyEnabled, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError, UnimplementedService){ throw UnimplementedService(); Message req, rep ; req.type = Message::ENABLE_ASYNCHRONOUS_DELIVERY ; executeService(&req, &rep);}// ----------------------------------------------------------------------------// Disable Asynchronous DeliveryvoidRTIambassador::disableAsynchronousDelivery() throw (AsynchronousDeliveryAlreadyDisabled, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError, UnimplementedService){ throw UnimplementedService(); Message req, rep ; req.type = Message::DISABLE_ASYNCHRONOUS_DELIVERY ; executeService(&req, &rep);}// ----------------------------------------------------------------------------// Query LBTSvoidRTIambassador::queryLBTS(FedTime& theTime) throw (FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::QUERY_LBTS ; executeService(&req, &rep); theTime = rep.getFedTime();}// ----------------------------------------------------------------------------// Query Federate TimevoidRTIambassador::queryFederateTime(FedTime& theTime) throw (FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::QUERY_FEDERATE_TIME ; executeService(&req, &rep); theTime = rep.getFedTime();}// ----------------------------------------------------------------------------// Query Minimum Next Event TimevoidRTIambassador::queryMinNextEventTime(FedTime& theTime) throw (FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ theTime = RTIfedTime(0.0);}// ----------------------------------------------------------------------------// Modify LookaheadvoidRTIambassador::modifyLookahead(const FedTime& theLookahead) throw (InvalidFederationTimeDelta, //CERTI InvalidLookahead, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::MODIFY_LOOKAHEAD ; req.setLookahead(theLookahead); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Query LookaheadvoidRTIambassador::queryLookahead(FedTime& theTime) throw (FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::QUERY_LOOKAHEAD ; executeService(&req, &rep); RTIfedTime *tmp = new RTIfedTime((Double) rep.getFederationTimeDelta()); theTime = *(dynamic_cast<FedTime *>(tmp));}// ----------------------------------------------------------------------------// RetractvoidRTIambassador::retract(EventRetractionHandle handle) throw (InvalidRetractionHandle, FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError, UnimplementedService) //CERTI{ throw UnimplementedService(); Message req, rep ; req.type = Message::RETRACT ; req.setEventRetraction(handle); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Change Attribute Order TypevoidRTIambassador::changeAttributeOrderType(ObjectHandle theObject, const AttributeHandleSet& attrs, OrderingHandle theType) throw (ObjectNotKnown, AttributeNotDefined, AttributeNotOwned, InvalidOrderType, //CERTI InvalidOrderingHandle, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::CHANGE_ATTRIBUTE_ORDER_TYPE ; req.setObject(theObject); req.setOrdering(theType); req.setAHS(attrs); executeService(&req, &rep);}// ----------------------------------------------------------------------------// Change Interaction Order TypevoidRTIambassador::changeInteractionOrderType(InteractionClassHandle theClass, OrderingHandle theType) throw (InteractionClassNotDefined, InteractionClassNotPublished, InvalidOrderType, //CERTI InvalidOrderingHandle, //not implemented FederateNotExecutionMember, ConcurrentAccessAttempted, SaveInProgress, RestoreInProgress, RTIinternalError){ Message req, rep ; req.type = Message::CHANGE_INTERACTION_ORDER_TYPE ; req.setInteractionClass(theClass); req.setOrdering(theType); executeService(&req, &rep);}}// $Id: TimeServices.cc,v 3.2 2003/10/06 16:19:44 breholee Exp $
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -