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 {
12  {}
13 
15  {
16  if (this->isEmpty()) { return CAircraftSituationChange::null(); }
17  return this->front();
18  }
19 
21  {
22  if (this->isEmpty()) { return CAircraftSituationChange::null(); }
23  return this->back();
24  }
25 
27  {
28  if (this->size() > index) { return (*this)[index]; }
30  }
31 } // 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.
CAircraftSituationChangeList()=default
Default constructor.
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