45#ifndef G4TRACKSTATE_HH_
46#define G4TRACKSTATE_HH_
69 static int GetID() {
return fID; }
143 std::map<int, G4VTrackStateHandle> fTrackStates;
144 std::map<void*, G4VTrackStateHandle> fMultipleTrackStates;
150 fMultipleTrackStates[adress] = state;
155 std::map<void*, G4VTrackStateHandle>::const_iterator it =
156 fMultipleTrackStates.find(adress);
157 if (it == fMultipleTrackStates.end())
167 std::map<void*, G4VTrackStateHandle>::const_iterator it =
168 fMultipleTrackStates.find((
void*)adress);
169 if (it == fMultipleTrackStates.end())
178 fTrackStates[state->GetID()] = state;
184 std::map<int, G4VTrackStateHandle>::const_iterator it =
186 if (it == fTrackStates.end())
210#define G4TrackStateHandle(T) G4shared_ptr<G4TrackState<T> >
212template<
class OriginalType>
213G4shared_ptr<G4VTrackState>
217 G4shared_ptr<G4VTrackState> output =
218 G4dynamic_pointer_cast<G4VTrackState>(state);
222template<
class FinalType>
223G4shared_ptr<G4TrackState<FinalType> >
227 G4shared_ptr<G4TrackState<FinalType> > output =
228 G4dynamic_pointer_cast<G4TrackState<FinalType>>(state);
272 ConvertToConcreteTrackState<ClassType>(manager.
GetTrackState(
this));
310#if __cplusplus > 199711L
311#define RegisterTrackState(CLASS,STATE) \
313 class G4TrackState<CLASS> : public G4TrackStateBase<CLASS>, \
314 public CLASS::STATE \
316 friend class G4TrackStateDependent<CLASS>; \
317 using CLASS::STATE::STATE; \
319 typedef CLASS::STATE State; \
320 G4TrackState() : G4TrackStateBase<CLASS>(), CLASS::STATE(){}\
321 virtual ~G4TrackState(){}\
324 return G4TrackStateID<CLASS>::GetID();\
328 return G4TrackStateID<CLASS>::GetID();\
333#define RegisterTrackState(CLASS,STATE) \
335 class G4TrackState<CLASS> : public G4TrackStateBase<CLASS>, \
336 public CLASS::STATE \
338 friend class G4TrackStateDependent<CLASS>; \
340 typedef CLASS::STATE State; \
341 G4TrackState() : G4TrackStateBase<CLASS>(), CLASS::STATE(){}\
342 virtual ~G4TrackState(){}\
345 return G4TrackStateID<CLASS>::GetID();\
349 return G4TrackStateID<CLASS>::GetID();\
G4shared_ptr< G4VTrackState > G4VTrackStateHandle
G4shared_ptr< G4VTrackState > ConvertToAbstractTrackState(G4shared_ptr< G4TrackState< OriginalType > > state)
G4shared_ptr< G4TrackState< FinalType > > ConvertToConcreteTrackState(G4VTrackStateHandle state)
virtual ~G4TrackStateBase()
virtual StateTypeHandle CreateTrackState() const
virtual void NewTrackState()
virtual StateTypeHandle GetConcreteTrackState() const
virtual void SetTrackState(G4shared_ptr< StateType > state)
virtual G4VTrackStateHandle PopTrackState()
virtual void SaveTrackState(G4TrackStateManager &manager)
virtual ~G4TrackStateDependent()
virtual void LoadTrackState(G4TrackStateManager &manager)
G4shared_ptr< StateType > StateTypeHandle
G4TrackState< T > StateType
virtual void ResetTrackState()
StateTypeHandle fpTrackState
virtual G4VTrackStateHandle GetTrackState() const
void SetTrackState(void *adress, G4VTrackStateHandle state)
G4VTrackStateHandle GetTrackState(void *adress) const
void SetTrackState(G4VTrackStateHandle state)
G4VTrackStateHandle GetTrackState() const
G4VTrackStateHandle GetTrackState(T *adress) const
virtual ~G4VTrackStateDependent()
virtual G4VTrackStateHandle GetTrackState() const =0
virtual void LoadTrackState(G4TrackStateManager &)=0
virtual void SaveTrackState(G4TrackStateManager &)=0
virtual void NewTrackState()=0
virtual void ResetTrackState()=0
virtual G4VTrackStateHandle PopTrackState()=0
virtual ~G4VTrackStateID()