swift
aircraftsituationchangelist.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 SWIFT_DEFINE_SEQUENCE_MIXINS(swift::misc::aviation, CAircraftSituationChange, CAircraftSituationChangeList)
7 
8 namespace swift::misc::aviation
9 {
11 
14  {}
15 
17  {
18  if (this->isEmpty()) { return CAircraftSituationChange::null(); }
19  return this->front();
20  }
21 
23  {
24  if (this->isEmpty()) { return CAircraftSituationChange::null(); }
25  return this->back();
26  }
27 
29  {
30  if (this->size() > index) { return (*this)[index]; }
32  }
33 } // namespace swift::misc::aviation
size_type size() const
Returns number of elements in the sequence.
Definition: sequence.h:273
reference front()
Access the first element.
Definition: sequence.h:225
reference back()
Access the last element.
Definition: sequence.h:249
bool isEmpty() const
Synonym for empty.
Definition: sequence.h:285
Value object about changes in situations.
static const CAircraftSituationChange & null()
NULL object.
CAircraftSituationChange indexOrNull(int index) const
Index or NULL.
CAircraftSituationChange frontOrNull() const
Front or NULL.
CAircraftSituationChange backOrNull() const
Back or NULL.
#define SWIFT_DEFINE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template definition of mixins for a CSequence subclass.
Definition: sequence.h:63