00001 // ---------------------------------------------------------------------------- 00002 // CERTI - HLA RunTime Infrastructure 00003 // Copyright (C) 2002-2005 ONERA 00004 // 00005 // This file is part of CERTI-libCERTI 00006 // 00007 // CERTI-libCERTI is free software ; you can redistribute it and/or 00008 // modify it under the terms of the GNU Lesser General Public License 00009 // as published by the Free Software Foundation ; either version 2 of 00010 // the License, or (at your option) any later version. 00011 // 00012 // CERTI-libCERTI is distributed in the hope that it will be useful, but 00013 // WITHOUT ANY WARRANTY ; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 // Lesser General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public 00018 // License along with this program ; if not, write to the Free Software 00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00020 // USA 00021 // 00022 // $Id: Exception.cc,v 3.17 2008/12/07 20:16:12 gotthardp Exp $ 00023 // ---------------------------------------------------------------------------- 00024 00025 #include "Exception.hh" 00026 #include "certi.hh" 00027 #include "PrettyDebug.hh" 00028 #include <sstream> 00029 00030 // static members for HLA Exceptions 00031 long certi::ArrayIndexOutOfBounds::_type = certi::e_ArrayIndexOutOfBounds ; 00032 long certi::AsynchronousDeliveryAlreadyDisabled::_type = certi::e_AsynchronousDeliveryAlreadyDisabled ; 00033 long certi::AsynchronousDeliveryAlreadyEnabled::_type = certi::e_AsynchronousDeliveryAlreadyEnabled ; 00034 long certi::AttributeAcquisitionWasNotRequested::_type = certi::e_AttributeAcquisitionWasNotRequested ; 00035 long certi::AttributeAcquisitionWasNotCanceled::_type = certi::e_AttributeAcquisitionWasNotCanceled ; 00036 long certi::AttributeAlreadyBeingAcquired::_type = certi::e_AttributeAlreadyBeingAcquired ; 00037 long certi::AttributeAlreadyBeingDivested::_type = certi::e_AttributeAlreadyBeingDivested ; 00038 long certi::AttributeAlreadyOwned::_type = certi::e_AttributeAlreadyOwned ; 00039 long certi::AttributeDivestitureWasNotRequested::_type = certi::e_AttributeDivestitureWasNotRequested ; 00040 long certi::AttributeNotDefined::_type = certi::e_AttributeNotDefined ; 00041 long certi::AttributeNotKnown::_type = certi::e_AttributeNotKnown ; 00042 long certi::AttributeNotOwned::_type = certi::e_AttributeNotOwned ; 00043 long certi::AttributeNotPublished::_type = certi::e_AttributeNotPublished ; 00044 long certi::ConcurrentAccessAttempted::_type = certi::e_ConcurrentAccessAttempted ; 00045 long certi::CouldNotDiscover::_type = certi::e_CouldNotDiscover ; 00046 long certi::CouldNotOpenFED::_type = certi::e_CouldNotOpenFED ; 00047 long certi::CouldNotRestore::_type = certi::e_CouldNotRestore ; 00048 long certi::DeletePrivilegeNotHeld::_type = certi::e_DeletePrivilegeNotHeld ; 00049 long certi::DimensionNotDefined::_type = certi::e_DimensionNotDefined ; 00050 long certi::EnableTimeConstrainedPending::_type = certi::e_EnableTimeConstrainedPending ; 00051 long certi::EnableTimeConstrainedWasNotPending::_type = certi::e_EnableTimeConstrainedWasNotPending ; 00052 long certi::EnableTimeRegulationPending::_type = certi::e_EnableTimeRegulationPending ; 00053 long certi::EnableTimeRegulationWasNotPending::_type = certi::e_EnableTimeRegulationWasNotPending ; 00054 long certi::ErrorReadingFED::_type = certi::e_ErrorReadingFED ; 00055 long certi::EventNotKnown::_type = certi::e_EventNotKnown ; 00056 long certi::FederateAlreadyExecutionMember::_type = certi::e_FederateAlreadyExecutionMember ; 00057 long certi::FederateInternalError::_type = certi::e_FederateInternalError ; 00058 long certi::FederateLoggingServiceCalls::_type = certi::e_FederateLoggingServiceCalls ; 00059 long certi::FederateNotExecutionMember::_type = certi::e_FederateNotExecutionMember ; 00060 long certi::FederateOwnsAttributes::_type = certi::e_FederateOwnsAttributes ; 00061 long certi::FederateWasNotAskedToReleaseAttribute::_type = certi::e_FederateWasNotAskedToReleaseAttribute ; 00062 long certi::FederatesCurrentlyJoined::_type = certi::e_FederatesCurrentlyJoined ; 00063 long certi::FederationExecutionAlreadyExists::_type = certi::e_FederationExecutionAlreadyExists ; 00064 long certi::FederationExecutionDoesNotExist::_type = certi::e_FederationExecutionDoesNotExist ; 00065 long certi::FederationTimeAlreadyPassed::_type = certi::e_FederationTimeAlreadyPassed ; 00066 long certi::HandleValuePairMaximumExceeded::_type = certi::e_HandleValuePairMaximumExceeded ; 00067 long certi::InteractionClassNotDefined::_type = certi::e_InteractionClassNotDefined ; 00068 long certi::InteractionClassNotKnown::_type = certi::e_InteractionClassNotKnown ; 00069 long certi::InteractionClassNotPublished::_type = certi::e_InteractionClassNotPublished ; 00070 long certi::InteractionClassNotSubscribed::_type = certi::e_InteractionClassNotSubscribed ; 00071 long certi::InteractionParameterNotDefined::_type = certi::e_InteractionParameterNotDefined ; 00072 long certi::InteractionParameterNotKnown::_type = certi::e_InteractionParameterNotKnown ; 00073 long certi::InvalidExtents::_type = certi::e_InvalidExtents ; 00074 long certi::InvalidFederationTime::_type = certi::e_InvalidFederationTime ; 00075 long certi::InvalidHandleValuePairSetContext::_type = certi::e_InvalidHandleValuePairSetContext ; 00076 long certi::InvalidLookahead::_type = certi::e_InvalidLookahead ; 00077 long certi::InvalidOrderingHandle::_type = certi::e_InvalidOrderingHandle ; 00078 long certi::InvalidRegionContext::_type = certi::e_InvalidRegionContext ; 00079 long certi::InvalidResignAction::_type = certi::e_InvalidResignAction ; 00080 long certi::InvalidRetractionHandle::_type = certi::e_InvalidRetractionHandle ; 00081 long certi::InvalidTransportationHandle::_type = certi::e_InvalidTransportationHandle ; 00082 long certi::MemoryExhausted::_type = certi::e_MemoryExhausted ; 00083 long certi::NameNotFound::_type = certi::e_NameNotFound ; 00084 long certi::ObjectClassNotDefined::_type = certi::e_ObjectClassNotDefined ; 00085 long certi::ObjectClassNotKnown::_type = certi::e_ObjectClassNotKnown ; 00086 long certi::ObjectClassNotPublished::_type = certi::e_ObjectClassNotPublished ; 00087 long certi::ObjectClassNotSubscribed::_type = certi::e_ObjectClassNotSubscribed ; 00088 long certi::ObjectNotKnown::_type = certi::e_ObjectNotKnown ; 00089 long certi::ObjectAlreadyRegistered::_type = certi::e_ObjectAlreadyRegistered ; 00090 long certi::OwnershipAcquisitionPending::_type = certi::e_OwnershipAcquisitionPending ; 00091 long certi::RegionInUse::_type = certi::e_RegionInUse ; 00092 long certi::RegionNotKnown::_type = certi::e_RegionNotKnown ; 00093 long certi::RestoreInProgress::_type = certi::e_RestoreInProgress ; 00094 long certi::RestoreNotRequested::_type = certi::e_RestoreNotRequested ; 00095 long certi::RTIinternalError::_type = certi::e_RTIinternalError ; 00096 long certi::SpaceNotDefined::_type = certi::e_SpaceNotDefined ; 00097 long certi::SaveInProgress::_type = certi::e_SaveInProgress ; 00098 long certi::SaveNotInitiated::_type = certi::e_SaveNotInitiated ; 00099 long certi::SpecifiedSaveLabelDoesNotExist::_type = certi::e_SpecifiedSaveLabelDoesNotExist ; 00100 long certi::SynchronizationPointLabelWasNotAnnounced::_type = certi::e_SynchronizationPointLabelWasNotAnnounced ; 00101 long certi::TimeAdvanceAlreadyInProgress::_type = certi::e_TimeAdvanceAlreadyInProgress ; 00102 long certi::TimeAdvanceWasNotInProgress::_type = certi::e_TimeAdvanceWasNotInProgress ; 00103 long certi::TimeConstrainedAlreadyEnabled::_type = certi::e_TimeConstrainedAlreadyEnabled ; 00104 long certi::TimeConstrainedWasNotEnabled::_type = certi::e_TimeConstrainedWasNotEnabled ; 00105 long certi::TimeRegulationAlreadyEnabled::_type = certi::e_TimeRegulationAlreadyEnabled ; 00106 long certi::TimeRegulationWasNotEnabled::_type = certi::e_TimeRegulationWasNotEnabled ; 00107 long certi::UnableToPerformSave::_type = certi::e_UnableToPerformSave ; 00108 long certi::ValueCountExceeded::_type = certi::e_ValueCountExceeded ; 00109 long certi::ValueLengthExceeded::_type = certi::e_ValueLengthExceeded ; 00110 00111 // TypeException managing (how to obtain TypeException from Exception name ?) 00112 long certi::FederateNotPublishing::_type = certi::e_FederateNotPublishing ; 00113 long certi::FederateNotSubscribing::_type = certi::e_FederateNotSubscribing ; 00114 long certi::InvalidObjectHandle::_type = certi::e_InvalidObjectHandle ; 00115 long certi::CouldNotOpenRID::_type = certi::e_CouldNotOpenRID ; 00116 long certi::ErrorReadingRID::_type = certi::e_ErrorReadingRID ; 00117 long certi::AttributeNotSubscribed::_type = certi::e_AttributeNotSubscribed ; 00118 long certi::FederationAlreadyPaused::_type = certi::e_FederationAlreadyPaused ; 00119 long certi::FederationNotPaused::_type = certi::e_FederationNotPaused ; 00120 long certi::SecurityError::_type = certi::e_SecurityError ; 00121 long certi::FederateAlreadyPaused::_type = certi::e_FederateAlreadyPaused ; 00122 long certi::FederateDoesNotExist::_type = certi::e_FederateDoesNotExist ; 00123 long certi::FederateNameAlreadyInUse::_type = certi::e_FederateNameAlreadyInUse ; 00124 long certi::FederateNotPaused::_type = certi::e_FederateNotPaused ; 00125 long certi::IDsupplyExhausted::_type = certi::e_IDsupplyExhausted ; 00126 long certi::InvalidDivestitureCondition::_type = certi::e_InvalidDivestitureCondition ; 00127 long certi::InvalidFederationTimeDelta::_type = certi::e_InvalidFederationTimeDelta ; 00128 long certi::InvalidRoutingSpace::_type = certi::e_InvalidRoutingSpace ; 00129 long certi::NoPauseRequested::_type = certi::e_NoPauseRequested ; 00130 long certi::NoResumeRequested::_type = certi::e_NoResumeRequested ; 00131 long certi::TooManyIDsRequested::_type = certi::e_TooManyIDsRequested ; 00132 long certi::UnimplementedService::_type = certi::e_UnimplementedService ; 00133 long certi::UnknownLabel::_type = certi::e_UnknownLabel ; 00134 long certi::NetworkError::_type = certi::e_NetworkError ; 00135 long certi::NetworkSignal::_type = certi::e_NetworkSignal ; 00136 00137 static PrettyDebug PD_Exception("CERTI_EXCEPTION",__FILE__); 00138 00139 const std::string certi::Exception::displayMe() const 00140 { 00141 std::stringstream msg; 00142 00143 msg << "CERTI::Exception ["; 00144 if (NULL!=_name) { 00145 msg <<_name; 00146 } else { 00147 msg<<"<noname>"; 00148 } 00149 msg << " - reason="; 00150 if (!_reason.empty()) { 00151 msg << _reason; 00152 } else { 00153 msg << "<noreason>"; 00154 } 00155 msg << std::endl; 00156 msg << std::flush; 00157 00158 PD_Exception[pdExcept] << msg.str().c_str(); 00159 return msg.str(); 00160 } 00161 // $Id: Exception.cc,v 3.17 2008/12/07 20:16:12 gotthardp Exp $