WPILibC++ 2024.3.2
Requirements.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <initializer_list>
8#include <span>
9#include <vector>
10
12
13namespace frc2 {
14
15/**
16 * Represents requirements for a command, which is a set of (pointers to)
17 * subsystems. This class is implicitly convertible from std::initializer_list
18 * and std::span.
19 */
21 public:
22 // NOLINTNEXTLINE
23 /*implicit*/ Requirements(std::initializer_list<Subsystem*> requirements)
24 : m_subsystems{requirements.begin(), requirements.end()} {}
25
26 // NOLINTNEXTLINE
27 /*implicit*/ Requirements(std::span<Subsystem* const> requirements)
28 : m_subsystems{requirements.begin(), requirements.end()} {}
29
30 Requirements() = default;
31
32 Requirements(const Requirements&) = default;
33
34 std::vector<Subsystem*>::const_iterator begin() const {
35 return m_subsystems.begin();
36 }
37
38 std::vector<Subsystem*>::const_iterator end() const {
39 return m_subsystems.end();
40 }
41
42 private:
43 std::vector<Subsystem*> m_subsystems;
44};
45
46} // namespace frc2
Represents requirements for a command, which is a set of (pointers to) subsystems.
Definition: Requirements.h:20
Requirements(const Requirements &)=default
Requirements(std::initializer_list< Subsystem * > requirements)
Definition: Requirements.h:23
Requirements()=default
std::vector< Subsystem * >::const_iterator end() const
Definition: Requirements.h:38
std::vector< Subsystem * >::const_iterator begin() const
Definition: Requirements.h:34
Requirements(std::span< Subsystem *const > requirements)
Definition: Requirements.h:27
Definition: TrapezoidProfileSubsystem.h:12