File indexing completed on 2025-01-18 09:12:35
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/EventData/MultiTrajectory.hpp"
0010 #include "Acts/EventData/ProxyAccessor.hpp"
0011 #include "Acts/EventData/TrackContainer.hpp"
0012 #include "Acts/EventData/VectorMultiTrajectory.hpp"
0013 #include "Acts/EventData/VectorTrackContainer.hpp"
0014 #include "Acts/Tests/CommonHelpers/NonCompileTestHelpers.hpp"
0015 #include "Acts/Utilities/ThrowAssert.hpp"
0016
0017 using namespace Acts;
0018
0019 ACTS_DOES_NOT_COMPILE_SUITE_BEGIN(BuildFromConstRef)
0020
0021 {
0022 VectorTrackContainer mutVtc;
0023 VectorMultiTrajectory mutMtj;
0024
0025 TrackContainer mutTc{mutVtc, mutMtj};
0026 static_assert(!mutTc.ReadOnly, "Unexpectedly read only");
0027
0028 auto t = mutTc.makeTrack();
0029 t.appendTrackState();
0030 t.appendTrackState();
0031 t.appendTrackState();
0032 t = mutTc.makeTrack();
0033 t.appendTrackState();
0034
0035 ConstVectorTrackContainer vtc{std::move(mutVtc)};
0036 ConstVectorMultiTrajectory mtj{std::move(mutMtj)};
0037
0038 TrackContainer ctc{vtc, mtj};
0039 ACTS_DOES_NOT_COMPILE_BEGIN(AddTrackToConstTrackContainer)
0040 ctc.addTrack();
0041 ACTS_DOES_NOT_COMPILE_END()
0042 }
0043
0044 {
0045 VectorTrackContainer vtc;
0046 VectorMultiTrajectory mtj;
0047 {
0048 TrackContainer tc{vtc, mtj};
0049
0050 ACTS_DOES_NOT_COMPILE_BEGIN(TrackMutateConstProxyRef)
0051 for (const auto track : tc) {
0052 track.parameters().setRandom();
0053 }
0054 ACTS_DOES_NOT_COMPILE_END()
0055 }
0056
0057 ConstVectorTrackContainer cvtc{std::move(vtc)};
0058 ConstVectorMultiTrajectory cmtj{std::move(mtj)};
0059 {
0060 TrackContainer tc{cvtc, cmtj};
0061
0062 ACTS_DOES_NOT_COMPILE_BEGIN(TrackMutateConstProxy)
0063 for (auto track : tc) {
0064 track.parameters().setRandom();
0065 }
0066 ACTS_DOES_NOT_COMPILE_END()
0067 }
0068 }
0069
0070 {
0071 VectorTrackContainer vtc;
0072 VectorMultiTrajectory mtj;
0073 TrackContainer tc{vtc, mtj};
0074 auto t = tc.makeTrack();
0075 (void)t;
0076
0077 ConstProxyAccessor<unsigned int> caccNMeasuements("nMeasurements");
0078 static_cast<void>(caccNMeasuements);
0079 ACTS_DOES_NOT_COMPILE_BEGIN(ConstAccessorMutate)
0080 caccNMeasuements(t) = 66;
0081 ACTS_DOES_NOT_COMPILE_END()
0082
0083 ACTS_DOES_NOT_COMPILE_BEGIN(MutationThroughContainerConstRef)
0084 const auto& ctc = tc;
0085 ctc.getTrack(idx).covariance().setRandom();
0086 ACTS_DOES_NOT_COMPILE_END()
0087
0088 ACTS_DOES_NOT_COMPILE_BEGIN(MutationThroughProxyConstRef)
0089 const auto& ctp = t;
0090 ctp.covariance().setRandom();
0091 ACTS_DOES_NOT_COMPILE_END()
0092 }
0093
0094 ACTS_DOES_NOT_COMPILE_SUITE_END()