diff --git a/.clang-format b/.clang-format index db93141eec..f69bef0cec 100644 --- a/.clang-format +++ b/.clang-format @@ -1,111 +1,171 @@ --- +Language: Cpp BasedOnStyle: Google AccessModifierOffset: -1 AlignAfterOpenBracket: Align -AlignConsecutiveMacros: false -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + PadOperators: false AlignEscapedNewlines: Left -AlignOperands: true -AlignTrailingComments: true +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: Inline -AllowShortLambdasOnASingleLine: All AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes +AttributeMacros: + - __capability BinPackArguments: true BinPackParameters: true +BitFieldColonSpacing: Both BraceWrapping: AfterCaseLabel: false AfterClass: false - AfterControlStatement: false + AfterControlStatement: Never AfterEnum: false + AfterExternBlock: false AfterFunction: false AfterNamespace: false AfterObjCDeclaration: false AfterStruct: false AfterUnion: false - AfterExternBlock: false BeforeCatch: false BeforeElse: false + BeforeLambdaBody: false + BeforeWhile: false IndentBraces: false SplitEmptyFunction: true SplitEmptyRecord: true SplitEmptyNamespace: true -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Attach -BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeColon +BreakAfterAttributes: Always BreakAfterJavaFieldAnnotations: false +BreakArrays: true +BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always +BreakBeforeBraces: Attach +BreakBeforeInlineASMColon: OnlyMultiline +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon BreakStringLiterals: true ColumnLimit: 80 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true -DeriveLineEnding: true DerivePointerAlignment: false DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: - foreach - Q_FOREACH - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE IncludeBlocks: Regroup IncludeCategories: - Regex: '^' Priority: 2 SortPriority: 0 + CaseSensitive: false - Regex: '^<.*\.h>' Priority: 1 SortPriority: 0 + CaseSensitive: false - Regex: '^<.*' Priority: 2 SortPriority: 0 + CaseSensitive: false - Regex: '.*' Priority: 3 SortPriority: 0 + CaseSensitive: false IncludeIsMainRegex: '([-_](test|unittest))?$' IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseBlocks: false IndentCaseLabels: true +IndentExternBlock: AfterExternBlock IndentGotoLabels: true IndentPPDirectives: None +IndentRequiresClause: true IndentWidth: 2 IndentWrappedFunctionNames: false +InsertBraces: false +InsertNewlineAtEOF: false +InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: false +LambdaBodyIndentation: Signature +LineEnding: DeriveLF MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 NamespaceIndentation: None ObjCBinPackProtocolList: Never ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: NextLine PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 1 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 PenaltyReturnTypeOnItsOwnLine: 200 PointerAlignment: Left +PPIndentWidth: -1 +QualifierAlignment: Leave RawStringFormats: - Language: Cpp Delimiters: @@ -132,34 +192,65 @@ RawStringFormats: - PARSE_TEXT_PROTO - ParseTextOrDie - ParseTextProtoOrDie - CanonicalDelimiter: '' + - ParseTestProto + - ParsePartialTestProto + CanonicalDelimiter: pb BasedOnStyle: google +ReferenceAlignment: Pointer ReflowComments: true +RemoveBracesLLVM: false +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 SortIncludes: false -SortUsingDeclarations: true +SortJavaStaticImport: Before +SortUsingDeclarations: LexicographicNumeric SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 2 -SpacesInAngles: false +SpacesInAngles: Never SpacesInConditionalStatement: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 SpacesInParentheses: false SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false Standard: c++20 StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION TabWidth: 8 UseTab: Never +WhitespaceSensitiveMacros: + - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE ... diff --git a/.clang-tidy b/.clang-tidy index 62783c051a..6f1ae3a6d5 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -35,7 +35,6 @@ Checks: bugprone-unhandled-self-assignment, bugprone-unused-raii, bugprone-virtual-near-miss, - cert-dcl58-cpp, cert-err52-cpp, cert-err60-cpp, cert-mem57-cpp, diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index ba25a05c62..fe205377df 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -26,16 +26,10 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - name: Install clang-format - run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo sh -c "echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list" - sudo apt-get update -q - sudo apt-get install -y clang-format-14 - name: Install wpiformat run: pip3 install wpiformat - name: Run - run: wpiformat -clang 14 + run: wpiformat - name: Check output run: git --no-pager diff --exit-code HEAD - name: Generate diff @@ -70,12 +64,6 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - name: Install clang-tidy - run: | - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo sh -c "echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list" - sudo apt-get update -q - sudo apt-get install -y clang-tidy-14 clang-format-14 - name: Install wpiformat run: pip3 install wpiformat - name: Create compile_commands.json @@ -83,7 +71,7 @@ jobs: - name: List changed files run: wpiformat -list-changed-files - name: Run clang-tidy - run: wpiformat -clang 14 -no-format -tidy-changed -compile-commands=build/compile_commands/linuxx86-64 -vv + run: wpiformat -no-format -tidy-changed -compile-commands=build/compile_commands/linuxx86-64 -vv javaformat: name: "Java format" runs-on: ubuntu-22.04 diff --git a/README.md b/README.md index c27ed5a089..e43f47467a 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ On macOS ARM, run `softwareupdate --install-rosetta`. This is necessary to be ab Clone the WPILib repository and follow the instructions above for installing any required tooling. -See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/main/README.md) for wpiformat setup instructions. We use clang-format 14. +See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/main/README.md) for wpiformat setup instructions. ## Building @@ -120,7 +120,7 @@ Once a PR has been submitted, formatting can be run in CI by commenting `/format #### wpiformat -wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat -clang 14` on Windows or `python3 -m wpiformat -clang 14` on other platforms. +wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat` on Windows or `python3 -m wpiformat` on other platforms. #### Java Code Quality Tools diff --git a/cscore/src/main/native/cpp/Image.h b/cscore/src/main/native/cpp/Image.h index cb8df912dd..83cbe89974 100644 --- a/cscore/src/main/native/cpp/Image.h +++ b/cscore/src/main/native/cpp/Image.h @@ -22,9 +22,7 @@ class Image { public: #ifndef __linux__ - explicit Image(size_t capacity) { - m_data.reserve(capacity); - } + explicit Image(size_t capacity) { m_data.reserve(capacity); } #else explicit Image(size_t capacity) : m_data{capacity, default_init_allocator{}} { @@ -39,35 +37,19 @@ class Image { operator std::string_view() const { // NOLINT return str(); } - std::string_view str() const { - return {data(), size()}; - } - size_t capacity() const { - return m_data.capacity(); - } + std::string_view str() const { return {data(), size()}; } + size_t capacity() const { return m_data.capacity(); } const char* data() const { return reinterpret_cast(m_data.data()); } - char* data() { - return reinterpret_cast(m_data.data()); - } - size_t size() const { - return m_data.size(); - } + char* data() { return reinterpret_cast(m_data.data()); } + size_t size() const { return m_data.size(); } - const std::vector& vec() const { - return m_data; - } - std::vector& vec() { - return m_data; - } + const std::vector& vec() const { return m_data; } + std::vector& vec() { return m_data; } - void resize(size_t size) { - m_data.resize(size); - } - void SetSize(size_t size) { - m_data.resize(size); - } + void resize(size_t size) { m_data.resize(size); } + void SetSize(size_t size) { m_data.resize(size); } cv::Mat AsMat() { int type; @@ -90,9 +72,7 @@ class Image { return cv::Mat{height, width, type, m_data.data()}; } - cv::_InputArray AsInputArray() { - return cv::_InputArray{m_data}; - } + cv::_InputArray AsInputArray() { return cv::_InputArray{m_data}; } bool Is(int width_, int height_) { return width == width_ && height == height_; @@ -114,12 +94,8 @@ class Image { bool IsLarger(const Image& oth) { return width >= oth.width && height >= oth.height; } - bool IsSmaller(int width_, int height_) { - return !IsLarger(width_, height_); - } - bool IsSmaller(const Image& oth) { - return !IsLarger(oth); - } + bool IsSmaller(int width_, int height_) { return !IsLarger(width_, height_); } + bool IsSmaller(const Image& oth) { return !IsLarger(oth); } private: std::vector m_data; diff --git a/cscore/src/main/native/include/cscore_cv.h b/cscore/src/main/native/include/cscore_cv.h index 30a356bef3..6a91accc7f 100644 --- a/cscore/src/main/native/include/cscore_cv.h +++ b/cscore/src/main/native/include/cscore_cv.h @@ -152,8 +152,8 @@ class CvSink : public ImageSink { * message); the frame time is in the same time base as wpi::Now(), * and is in 1 us increments. */ - [[nodiscard]] uint64_t GrabFrame(cv::Mat& image, - double timeout = 0.225) const; + [[nodiscard]] + uint64_t GrabFrame(cv::Mat& image, double timeout = 0.225) const; /** * Wait for the next frame and get the image. May block forever. @@ -163,7 +163,8 @@ class CvSink : public ImageSink { * message); the frame time is in the same time base as wpi::Now(), * and is in 1 us increments. */ - [[nodiscard]] uint64_t GrabFrameNoTimeout(cv::Mat& image) const; + [[nodiscard]] + uint64_t GrabFrameNoTimeout(cv::Mat& image) const; }; inline CvSource::CvSource(std::string_view name, const VideoMode& mode) { diff --git a/cscore/src/main/native/include/cscore_raw.h b/cscore/src/main/native/include/cscore_raw.h index 0aaaeffd12..5e1632c096 100644 --- a/cscore/src/main/native/include/cscore_raw.h +++ b/cscore/src/main/native/include/cscore_raw.h @@ -174,8 +174,8 @@ class RawSink : public ImageSink { * message); the frame time is in the same time base as wpi::Now(), * and is in 1 us increments. */ - [[nodiscard]] uint64_t GrabFrame(RawFrame& image, - double timeout = 0.225) const; + [[nodiscard]] + uint64_t GrabFrame(RawFrame& image, double timeout = 0.225) const; /** * Wait for the next frame and get the image. May block forever. @@ -185,7 +185,8 @@ class RawSink : public ImageSink { * message); the frame time is in the same time base as wpi::Now(), * and is in 1 us increments. */ - [[nodiscard]] uint64_t GrabFrameNoTimeout(RawFrame& image) const; + [[nodiscard]] + uint64_t GrabFrameNoTimeout(RawFrame& image) const; }; inline RawSource::RawSource(std::string_view name, const VideoMode& mode) { diff --git a/cscore/src/main/native/include/cscore_raw_cv.h b/cscore/src/main/native/include/cscore_raw_cv.h index 5b9a37439f..975fcc91ac 100644 --- a/cscore/src/main/native/include/cscore_raw_cv.h +++ b/cscore/src/main/native/include/cscore_raw_cv.h @@ -111,7 +111,8 @@ class RawCvSink : public RawSink { * message); the frame time is in the same time base as wpi::Now(), * and is in 1 us increments. */ - [[nodiscard]] uint64_t GrabFrame(cv::Mat& image, double timeout = 0.225); + [[nodiscard]] + uint64_t GrabFrame(cv::Mat& image, double timeout = 0.225); /** * Wait for the next frame and get the image. May block forever. @@ -121,7 +122,8 @@ class RawCvSink : public RawSink { * message); the frame time is in the same time base as wpi::Now(), * and is in 1 us increments. */ - [[nodiscard]] uint64_t GrabFrameNoTimeout(cv::Mat& image); + [[nodiscard]] + uint64_t GrabFrameNoTimeout(cv::Mat& image); /** * Wait for the next frame and get the image. @@ -132,8 +134,8 @@ class RawCvSink : public RawSink { * message); the frame time is in the same time base as wpi::Now(), * and is in 1 us increments. */ - [[nodiscard]] uint64_t GrabFrameDirect(cv::Mat& image, - double timeout = 0.225); + [[nodiscard]] + uint64_t GrabFrameDirect(cv::Mat& image, double timeout = 0.225); /** * Wait for the next frame and get the image. May block forever. @@ -143,7 +145,8 @@ class RawCvSink : public RawSink { * message); the frame time is in the same time base as wpi::Now(), * and is in 1 us increments. */ - [[nodiscard]] uint64_t GrabFrameNoTimeoutDirect(cv::Mat& image); + [[nodiscard]] + uint64_t GrabFrameNoTimeoutDirect(cv::Mat& image); private: RawFrame rawFrame; diff --git a/hal/src/main/native/athena/FPGACalls.h b/hal/src/main/native/athena/FPGACalls.h index 46e8ac407c..3ef9004197 100644 --- a/hal/src/main/native/athena/FPGACalls.h +++ b/hal/src/main/native/athena/FPGACalls.h @@ -8,7 +8,8 @@ namespace hal { namespace init { -[[nodiscard]] int InitializeFPGA(); +[[nodiscard]] +int InitializeFPGA(); } // namespace init using HAL_NiFpga_ReserveIrqContextFunc = diff --git a/ntcore/src/main/native/cpp/ListenerStorage.h b/ntcore/src/main/native/cpp/ListenerStorage.h index b291a12dfe..44b4ceaa12 100644 --- a/ntcore/src/main/native/cpp/ListenerStorage.h +++ b/ntcore/src/main/native/cpp/ListenerStorage.h @@ -50,14 +50,16 @@ class ListenerStorage final : public IListenerStorage { NT_ListenerPoller CreateListenerPoller(); // returns listener handle and mask for each listener that was destroyed - [[nodiscard]] std::vector> - DestroyListenerPoller(NT_ListenerPoller pollerHandle); + [[nodiscard]] + std::vector> DestroyListenerPoller( + NT_ListenerPoller pollerHandle); std::vector ReadListenerQueue(NT_ListenerPoller pollerHandle); // returns listener handle and mask for each listener that was destroyed - [[nodiscard]] std::vector> - RemoveListener(NT_Listener listenerHandle); + [[nodiscard]] + std::vector> RemoveListener( + NT_Listener listenerHandle); bool WaitForListenerQueue(double timeout); diff --git a/ntcore/src/main/native/include/networktables/Topic.h b/ntcore/src/main/native/include/networktables/Topic.h index e2a8a5a350..c33ce1795a 100644 --- a/ntcore/src/main/native/include/networktables/Topic.h +++ b/ntcore/src/main/native/include/networktables/Topic.h @@ -169,7 +169,8 @@ class Topic { * @param options subscribe options * @return subscriber */ - [[nodiscard]] GenericSubscriber GenericSubscribe( + [[nodiscard]] + GenericSubscriber GenericSubscribe( const PubSubOptions& options = kDefaultPubSubOptions); /** @@ -186,7 +187,8 @@ class Topic { * @param options subscribe options * @return subscriber */ - [[nodiscard]] GenericSubscriber GenericSubscribe( + [[nodiscard]] + GenericSubscriber GenericSubscribe( std::string_view typeString, const PubSubOptions& options = kDefaultPubSubOptions); @@ -206,7 +208,8 @@ class Topic { * @param options publish options * @return publisher */ - [[nodiscard]] GenericPublisher GenericPublish( + [[nodiscard]] + GenericPublisher GenericPublish( std::string_view typeString, const PubSubOptions& options = kDefaultPubSubOptions); @@ -228,7 +231,8 @@ class Topic { * @param options publish options * @return publisher */ - [[nodiscard]] GenericPublisher GenericPublishEx( + [[nodiscard]] + GenericPublisher GenericPublishEx( std::string_view typeString, const wpi::json& properties, const PubSubOptions& options = kDefaultPubSubOptions); @@ -250,7 +254,8 @@ class Topic { * @param options publish and/or subscribe options * @return entry */ - [[nodiscard]] GenericEntry GetGenericEntry( + [[nodiscard]] + GenericEntry GetGenericEntry( const PubSubOptions& options = kDefaultPubSubOptions); /** @@ -272,7 +277,8 @@ class Topic { * @param options publish and/or subscribe options * @return entry */ - [[nodiscard]] GenericEntry GetGenericEntry( + [[nodiscard]] + GenericEntry GetGenericEntry( std::string_view typeString, const PubSubOptions& options = kDefaultPubSubOptions); diff --git a/ntcore/src/main/native/include/networktables/UnitTopic.h b/ntcore/src/main/native/include/networktables/UnitTopic.h index cac950180b..febc2d1919 100644 --- a/ntcore/src/main/native/include/networktables/UnitTopic.h +++ b/ntcore/src/main/native/include/networktables/UnitTopic.h @@ -295,7 +295,8 @@ class UnitTopic final : public Topic { * @param options subscribe options * @return subscriber */ - [[nodiscard]] SubscriberType Subscribe( + [[nodiscard]] + SubscriberType Subscribe( ParamType defaultValue, const PubSubOptions& options = kDefaultPubSubOptions); @@ -315,7 +316,8 @@ class UnitTopic final : public Topic { * @param options subscribe options * @return subscriber */ - [[nodiscard]] SubscriberType SubscribeEx( + [[nodiscard]] + SubscriberType SubscribeEx( std::string_view typeString, ParamType defaultValue, const PubSubOptions& options = kDefaultPubSubOptions); @@ -334,8 +336,8 @@ class UnitTopic final : public Topic { * @param options publish options * @return publisher */ - [[nodiscard]] PublisherType Publish( - const PubSubOptions& options = kDefaultPubSubOptions); + [[nodiscard]] + PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions); /** * Create a new publisher to the topic, with type string and initial @@ -355,9 +357,10 @@ class UnitTopic final : public Topic { * @param options publish options * @return publisher */ - [[nodiscard]] PublisherType PublishEx( - std::string_view typeString, const wpi::json& properties, - const PubSubOptions& options = kDefaultPubSubOptions); + [[nodiscard]] + PublisherType PublishEx(std::string_view typeString, + const wpi::json& properties, + const PubSubOptions& options = kDefaultPubSubOptions); /** * Create a new entry for the topic. @@ -379,9 +382,9 @@ class UnitTopic final : public Topic { * @param options publish and/or subscribe options * @return entry */ - [[nodiscard]] EntryType GetEntry( - ParamType defaultValue, - const PubSubOptions& options = kDefaultPubSubOptions); + [[nodiscard]] + EntryType GetEntry(ParamType defaultValue, + const PubSubOptions& options = kDefaultPubSubOptions); /** * Create a new entry for the topic, with specific type string. @@ -404,9 +407,9 @@ class UnitTopic final : public Topic { * @param options publish and/or subscribe options * @return entry */ - [[nodiscard]] EntryType GetEntryEx( - std::string_view typeString, ParamType defaultValue, - const PubSubOptions& options = kDefaultPubSubOptions); + [[nodiscard]] + EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue, + const PubSubOptions& options = kDefaultPubSubOptions); }; } // namespace nt diff --git a/simulation/halsim_gui/src/main/native/include/HALDataSource.h b/simulation/halsim_gui/src/main/native/include/HALDataSource.h index c04f3589b3..295b3f8ba5 100644 --- a/simulation/halsim_gui/src/main/native/include/HALDataSource.h +++ b/simulation/halsim_gui/src/main/native/include/HALDataSource.h @@ -57,9 +57,13 @@ HALSIM_Cancel##cbname##Callback(m_index, m_callback); \ } \ \ - int32_t GetIndex() const { return m_index; } \ + int32_t GetIndex() const { \ + return m_index; \ + } \ \ - int GetChannel() const { return m_channel; } \ + int GetChannel() const { \ + return m_channel; \ + } \ \ private: \ static void CallbackFunc(const char*, void* param, \ @@ -96,9 +100,13 @@ HALSIM_Cancel##cbname##Callback(m_index, m_channel, m_callback); \ } \ \ - int32_t GetIndex() const { return m_index; } \ + int32_t GetIndex() const { \ + return m_index; \ + } \ \ - int32_t GetChannel() const { return m_channel; } \ + int32_t GetChannel() const { \ + return m_channel; \ + } \ \ private: \ static void CallbackFunc(const char*, void* param, \ diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h index 1e93dfa3f7..c064fa39b5 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/Command.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/Command.h @@ -124,7 +124,8 @@ class Command { * @param duration the timeout duration * @return the command with the timeout added */ - [[nodiscard]] CommandPtr WithTimeout(units::second_t duration) &&; + [[nodiscard]] + CommandPtr WithTimeout(units::second_t duration) &&; /** * Decorates this command with an interrupt condition. If the specified @@ -135,7 +136,8 @@ class Command { * @param condition the interrupt condition * @return the command with the interrupt condition added */ - [[nodiscard]] CommandPtr Until(std::function condition) &&; + [[nodiscard]] + CommandPtr Until(std::function condition) &&; /** * Decorates this command with a run condition. If the specified condition @@ -146,7 +148,8 @@ class Command { * @param condition the interrupt condition * @return the command with the interrupt condition added */ - [[nodiscard]] CommandPtr OnlyWhile(std::function condition) &&; + [[nodiscard]] + CommandPtr OnlyWhile(std::function condition) &&; /** * Decorates this command with an interrupt condition. If the specified @@ -159,7 +162,8 @@ class Command { * @deprecated Replace with Until() */ WPI_DEPRECATED("Replace with Until()") - [[nodiscard]] CommandPtr WithInterrupt(std::function condition) &&; + [[nodiscard]] + CommandPtr WithInterrupt(std::function condition) &&; /** * Decorates this command with a runnable to run before this command starts. @@ -168,9 +172,9 @@ class Command { * @param requirements the required subsystems * @return the decorated command */ - [[nodiscard]] CommandPtr BeforeStarting( - std::function toRun, - std::initializer_list requirements) &&; + [[nodiscard]] + CommandPtr BeforeStarting(std::function toRun, + std::initializer_list requirements) &&; /** * Decorates this command with a runnable to run before this command starts. @@ -179,9 +183,9 @@ class Command { * @param requirements the required subsystems * @return the decorated command */ - [[nodiscard]] CommandPtr BeforeStarting( - std::function toRun, - std::span requirements = {}) &&; + [[nodiscard]] + CommandPtr BeforeStarting(std::function toRun, + std::span requirements = {}) &&; /** * Decorates this command with a runnable to run after the command finishes. @@ -190,9 +194,9 @@ class Command { * @param requirements the required subsystems * @return the decorated command */ - [[nodiscard]] CommandPtr AndThen( - std::function toRun, - std::initializer_list requirements) &&; + [[nodiscard]] + CommandPtr AndThen(std::function toRun, + std::initializer_list requirements) &&; /** * Decorates this command with a runnable to run after the command finishes. @@ -201,9 +205,9 @@ class Command { * @param requirements the required subsystems * @return the decorated command */ - [[nodiscard]] CommandPtr AndThen( - std::function toRun, - std::span requirements = {}) &&; + [[nodiscard]] + CommandPtr AndThen(std::function toRun, + std::span requirements = {}) &&; /** * Decorates this command to run perpetually, ignoring its ordinary end @@ -231,7 +235,8 @@ safe) semantics. * * @return the decorated command */ - [[nodiscard]] CommandPtr Repeatedly() &&; + [[nodiscard]] + CommandPtr Repeatedly() &&; /** * Decorates this command to run "by proxy" by wrapping it in a @@ -243,7 +248,8 @@ safe) semantics. * * @return the decorated command */ - [[nodiscard]] CommandPtr AsProxy() &&; + [[nodiscard]] + CommandPtr AsProxy() &&; /** * Decorates this command to only run if this condition is not met. If the @@ -254,7 +260,8 @@ safe) semantics. * @param condition the condition that will prevent the command from running * @return the decorated command */ - [[nodiscard]] CommandPtr Unless(std::function condition) &&; + [[nodiscard]] + CommandPtr Unless(std::function condition) &&; /** * Decorates this command to only run if this condition is met. If the command @@ -265,7 +272,8 @@ safe) semantics. * @param condition the condition that will allow the command to run * @return the decorated command */ - [[nodiscard]] CommandPtr OnlyIf(std::function condition) &&; + [[nodiscard]] + CommandPtr OnlyIf(std::function condition) &&; /** * Decorates this command to run or stop when disabled. @@ -273,7 +281,8 @@ safe) semantics. * @param doesRunWhenDisabled true to run when disabled. * @return the decorated command */ - [[nodiscard]] CommandPtr IgnoringDisable(bool doesRunWhenDisabled) &&; + [[nodiscard]] + CommandPtr IgnoringDisable(bool doesRunWhenDisabled) &&; /** * Decorates this command to run or stop when disabled. @@ -281,7 +290,8 @@ safe) semantics. * @param interruptBehavior true to run when disabled. * @return the decorated command */ - [[nodiscard]] CommandPtr WithInterruptBehavior( + [[nodiscard]] + CommandPtr WithInterruptBehavior( Command::InterruptionBehavior interruptBehavior) &&; /** @@ -292,7 +302,8 @@ safe) semantics. * command was interrupted. * @return the decorated command */ - [[nodiscard]] CommandPtr FinallyDo(std::function end) &&; + [[nodiscard]] + CommandPtr FinallyDo(std::function end) &&; /** * Decorates this command with a lambda to call on interrupt, following the @@ -301,7 +312,8 @@ safe) semantics. * @param handler a lambda to run when the command is interrupted * @return the decorated command */ - [[nodiscard]] CommandPtr HandleInterrupt(std::function handler) &&; + [[nodiscard]] + CommandPtr HandleInterrupt(std::function handler) &&; /** * Decorates this Command with a name. @@ -309,7 +321,8 @@ safe) semantics. * @param name name * @return the decorated Command */ - [[nodiscard]] CommandPtr WithName(std::string_view name) &&; + [[nodiscard]] + CommandPtr WithName(std::string_view name) &&; /** * Schedules this command. diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h b/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h index 23027cdaa8..2308b5d087 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/CommandPtr.h @@ -45,7 +45,8 @@ class CommandPtr final { * * @return the decorated command */ - [[nodiscard]] CommandPtr Repeatedly() &&; + [[nodiscard]] + CommandPtr Repeatedly() &&; /** * Decorates this command to run "by proxy" by wrapping it in a @@ -55,7 +56,8 @@ class CommandPtr final { * * @return the decorated command */ - [[nodiscard]] CommandPtr AsProxy() &&; + [[nodiscard]] + CommandPtr AsProxy() &&; /** * Decorates this command to run or stop when disabled. @@ -63,7 +65,8 @@ class CommandPtr final { * @param doesRunWhenDisabled true to run when disabled. * @return the decorated command */ - [[nodiscard]] CommandPtr IgnoringDisable(bool doesRunWhenDisabled) &&; + [[nodiscard]] + CommandPtr IgnoringDisable(bool doesRunWhenDisabled) &&; /** * Decorates this command to run or stop when disabled. @@ -71,7 +74,8 @@ class CommandPtr final { * @param interruptBehavior true to run when disabled. * @return the decorated command */ - [[nodiscard]] CommandPtr WithInterruptBehavior( + [[nodiscard]] + CommandPtr WithInterruptBehavior( Command::InterruptionBehavior interruptBehavior) &&; /** @@ -81,9 +85,9 @@ class CommandPtr final { * @param requirements the required subsystems * @return the decorated command */ - [[nodiscard]] CommandPtr AndThen( - std::function toRun, - std::span requirements = {}) &&; + [[nodiscard]] + CommandPtr AndThen(std::function toRun, + std::span requirements = {}) &&; /** * Decorates this command with a runnable to run after the command finishes. @@ -92,9 +96,9 @@ class CommandPtr final { * @param requirements the required subsystems * @return the decorated command */ - [[nodiscard]] CommandPtr AndThen( - std::function toRun, - std::initializer_list requirements) &&; + [[nodiscard]] + CommandPtr AndThen(std::function toRun, + std::initializer_list requirements) &&; /** * Decorates this command with a set of commands to run after it in sequence. @@ -104,7 +108,8 @@ class CommandPtr final { * @param next the commands to run next * @return the decorated command */ - [[nodiscard]] CommandPtr AndThen(CommandPtr&& next) &&; + [[nodiscard]] + CommandPtr AndThen(CommandPtr&& next) &&; /** * Decorates this command with a runnable to run before this command starts. @@ -113,9 +118,9 @@ class CommandPtr final { * @param requirements the required subsystems * @return the decorated command */ - [[nodiscard]] CommandPtr BeforeStarting( - std::function toRun, - std::initializer_list requirements) &&; + [[nodiscard]] + CommandPtr BeforeStarting(std::function toRun, + std::initializer_list requirements) &&; /** * Decorates this command with a runnable to run before this command starts. @@ -124,9 +129,9 @@ class CommandPtr final { * @param requirements the required subsystems * @return the decorated command */ - [[nodiscard]] CommandPtr BeforeStarting( - std::function toRun, - std::span requirements = {}) &&; + [[nodiscard]] + CommandPtr BeforeStarting(std::function toRun, + std::span requirements = {}) &&; /** * Decorates this command with another command to run before this command @@ -135,7 +140,8 @@ class CommandPtr final { * @param before the command to run before this one * @return the decorated command */ - [[nodiscard]] CommandPtr BeforeStarting(CommandPtr&& before) &&; + [[nodiscard]] + CommandPtr BeforeStarting(CommandPtr&& before) &&; /** * Decorates this command with a timeout. If the specified timeout is @@ -146,7 +152,8 @@ class CommandPtr final { * @param duration the timeout duration * @return the command with the timeout added */ - [[nodiscard]] CommandPtr WithTimeout(units::second_t duration) &&; + [[nodiscard]] + CommandPtr WithTimeout(units::second_t duration) &&; /** * Decorates this command with an interrupt condition. If the specified @@ -157,7 +164,8 @@ class CommandPtr final { * @param condition the interrupt condition * @return the command with the interrupt condition added */ - [[nodiscard]] CommandPtr Until(std::function condition) &&; + [[nodiscard]] + CommandPtr Until(std::function condition) &&; /** * Decorates this command with a run condition. If the specified condition @@ -168,7 +176,8 @@ class CommandPtr final { * @param condition the interrupt condition * @return the command with the interrupt condition added */ - [[nodiscard]] CommandPtr OnlyWhile(std::function condition) &&; + [[nodiscard]] + CommandPtr OnlyWhile(std::function condition) &&; /** * Decorates this command to only run if this condition is not met. If the @@ -179,7 +188,8 @@ class CommandPtr final { * @param condition the condition that will prevent the command from running * @return the decorated command */ - [[nodiscard]] CommandPtr Unless(std::function condition) &&; + [[nodiscard]] + CommandPtr Unless(std::function condition) &&; /** * Decorates this command to only run if this condition is met. If the command @@ -190,7 +200,8 @@ class CommandPtr final { * @param condition the condition that will allow the command to run * @return the decorated command */ - [[nodiscard]] CommandPtr OnlyIf(std::function condition) &&; + [[nodiscard]] + CommandPtr OnlyIf(std::function condition) &&; /** * Decorates this command with a set of commands to run parallel to it, ending @@ -201,7 +212,8 @@ class CommandPtr final { * @param parallel the commands to run in parallel * @return the decorated command */ - [[nodiscard]] CommandPtr DeadlineWith(CommandPtr&& parallel) &&; + [[nodiscard]] + CommandPtr DeadlineWith(CommandPtr&& parallel) &&; /** * Decorates this command with a set of commands to run parallel to it, ending @@ -211,7 +223,8 @@ class CommandPtr final { * @param parallel the commands to run in parallel * @return the decorated command */ - [[nodiscard]] CommandPtr AlongWith(CommandPtr&& parallel) &&; + [[nodiscard]] + CommandPtr AlongWith(CommandPtr&& parallel) &&; /** * Decorates this command with a set of commands to run parallel to it, ending @@ -221,7 +234,8 @@ class CommandPtr final { * @param parallel the commands to run in parallel * @return the decorated command */ - [[nodiscard]] CommandPtr RaceWith(CommandPtr&& parallel) &&; + [[nodiscard]] + CommandPtr RaceWith(CommandPtr&& parallel) &&; /** * Decorates this command with a lambda to call on interrupt or end, following @@ -231,7 +245,8 @@ class CommandPtr final { * command was interrupted. * @return the decorated command */ - [[nodiscard]] CommandPtr FinallyDo(std::function end) &&; + [[nodiscard]] + CommandPtr FinallyDo(std::function end) &&; /** * Decorates this command with a lambda to call on interrupt, following the @@ -240,7 +255,8 @@ class CommandPtr final { * @param handler a lambda to run when the command is interrupted * @return the decorated command */ - [[nodiscard]] CommandPtr HandleInterrupt(std::function handler) &&; + [[nodiscard]] + CommandPtr HandleInterrupt(std::function handler) &&; /** * Decorates this Command with a name. Is an inline function for @@ -249,7 +265,8 @@ class CommandPtr final { * @param name name * @return the decorated Command */ - [[nodiscard]] CommandPtr WithName(std::string_view name) &&; + [[nodiscard]] + CommandPtr WithName(std::string_view name) &&; /** * Get a raw pointer to the held command. diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/Commands.h b/wpilibNewCommands/src/main/native/include/frc2/command/Commands.h index ccf738b29d..a33b2d2b22 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/Commands.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/Commands.h @@ -27,7 +27,8 @@ namespace cmd { /** * Constructs a command that does nothing, finishing immediately. */ -[[nodiscard]] CommandPtr None(); +[[nodiscard]] +CommandPtr None(); // Action Commands @@ -37,9 +38,9 @@ namespace cmd { * @param action the action to run * @param requirements subsystems the action requires */ -[[nodiscard]] CommandPtr RunOnce( - std::function action, - std::initializer_list requirements); +[[nodiscard]] +CommandPtr RunOnce(std::function action, + std::initializer_list requirements); /** * Constructs a command that runs an action once and finishes. @@ -47,8 +48,9 @@ namespace cmd { * @param action the action to run * @param requirements subsystems the action requires */ -[[nodiscard]] CommandPtr RunOnce(std::function action, - std::span requirements = {}); +[[nodiscard]] +CommandPtr RunOnce(std::function action, + std::span requirements = {}); /** * Constructs a command that runs an action every iteration until interrupted. @@ -56,8 +58,9 @@ namespace cmd { * @param action the action to run * @param requirements subsystems the action requires */ -[[nodiscard]] CommandPtr Run(std::function action, - std::initializer_list requirements); +[[nodiscard]] +CommandPtr Run(std::function action, + std::initializer_list requirements); /** * Constructs a command that runs an action every iteration until interrupted. @@ -65,8 +68,9 @@ namespace cmd { * @param action the action to run * @param requirements subsystems the action requires */ -[[nodiscard]] CommandPtr Run(std::function action, - std::span requirements = {}); +[[nodiscard]] +CommandPtr Run(std::function action, + std::span requirements = {}); /** * Constructs a command that runs an action once and another action when the @@ -76,9 +80,9 @@ namespace cmd { * @param end the action to run on interrupt * @param requirements subsystems the action requires */ -[[nodiscard]] CommandPtr StartEnd( - std::function start, std::function end, - std::initializer_list requirements); +[[nodiscard]] +CommandPtr StartEnd(std::function start, std::function end, + std::initializer_list requirements); /** * Constructs a command that runs an action once and another action when the @@ -88,9 +92,9 @@ namespace cmd { * @param end the action to run on interrupt * @param requirements subsystems the action requires */ -[[nodiscard]] CommandPtr StartEnd( - std::function start, std::function end, - std::span requirements = {}); +[[nodiscard]] +CommandPtr StartEnd(std::function start, std::function end, + std::span requirements = {}); /** * Constructs a command that runs an action every iteration until interrupted, @@ -100,9 +104,9 @@ namespace cmd { * @param end the action to run on interrupt * @param requirements subsystems the action requires */ -[[nodiscard]] CommandPtr RunEnd(std::function run, - std::function end, - std::initializer_list requirements); +[[nodiscard]] +CommandPtr RunEnd(std::function run, std::function end, + std::initializer_list requirements); /** * Constructs a command that runs an action every iteration until interrupted, @@ -112,16 +116,17 @@ namespace cmd { * @param end the action to run on interrupt * @param requirements subsystems the action requires */ -[[nodiscard]] CommandPtr RunEnd(std::function run, - std::function end, - std::span requirements = {}); +[[nodiscard]] +CommandPtr RunEnd(std::function run, std::function end, + std::span requirements = {}); /** * Constructs a command that prints a message and finishes. * * @param msg the message to print */ -[[nodiscard]] CommandPtr Print(std::string_view msg); +[[nodiscard]] +CommandPtr Print(std::string_view msg); // Idling Commands @@ -130,7 +135,8 @@ namespace cmd { * * @param duration after how long the command finishes */ -[[nodiscard]] CommandPtr Wait(units::second_t duration); +[[nodiscard]] +CommandPtr Wait(units::second_t duration); /** * Constructs a command that does nothing, finishing once a condition becomes @@ -138,7 +144,8 @@ namespace cmd { * * @param condition the condition */ -[[nodiscard]] CommandPtr WaitUntil(std::function condition); +[[nodiscard]] +CommandPtr WaitUntil(std::function condition); // Selector Commands @@ -149,8 +156,9 @@ namespace cmd { * @param onFalse the command to run if the selector function returns false * @param selector the selector function */ -[[nodiscard]] CommandPtr Either(CommandPtr&& onTrue, CommandPtr&& onFalse, - std::function selector); +[[nodiscard]] +CommandPtr Either(CommandPtr&& onTrue, CommandPtr&& onFalse, + std::function selector); /** * Runs one of several commands, based on the selector function. @@ -159,8 +167,9 @@ namespace cmd { * @param commands map of commands to select from */ template -[[nodiscard]] CommandPtr Select(std::function selector, - std::pair&&... commands) { +[[nodiscard]] +CommandPtr Select(std::function selector, + std::pair&&... commands) { std::vector>> vec; ((void)vec.emplace_back(commands.first, std::move(commands.second).Unwrap()), @@ -189,13 +198,15 @@ std::vector MakeVector(Args&&... args) { /** * Runs a group of commands in series, one after the other. */ -[[nodiscard]] CommandPtr Sequence(std::vector&& commands); +[[nodiscard]] +CommandPtr Sequence(std::vector&& commands); /** * Runs a group of commands in series, one after the other. */ template -[[nodiscard]] CommandPtr Sequence(Args&&... commands) { +[[nodiscard]] +CommandPtr Sequence(Args&&... commands) { return Sequence(impl::MakeVector(std::forward(commands)...)); } @@ -203,14 +214,16 @@ template * Runs a group of commands in series, one after the other. Once the last * command ends, the group is restarted. */ -[[nodiscard]] CommandPtr RepeatingSequence(std::vector&& commands); +[[nodiscard]] +CommandPtr RepeatingSequence(std::vector&& commands); /** * Runs a group of commands in series, one after the other. Once the last * command ends, the group is restarted. */ template -[[nodiscard]] CommandPtr RepeatingSequence(Args&&... commands) { +[[nodiscard]] +CommandPtr RepeatingSequence(Args&&... commands) { return RepeatingSequence(impl::MakeVector(std::forward(commands)...)); } @@ -218,14 +231,16 @@ template * Runs a group of commands at the same time. Ends once all commands in the * group finish. */ -[[nodiscard]] CommandPtr Parallel(std::vector&& commands); +[[nodiscard]] +CommandPtr Parallel(std::vector&& commands); /** * Runs a group of commands at the same time. Ends once all commands in the * group finish. */ template -[[nodiscard]] CommandPtr Parallel(Args&&... commands) { +[[nodiscard]] +CommandPtr Parallel(Args&&... commands) { return Parallel(impl::MakeVector(std::forward(commands)...)); } @@ -233,14 +248,16 @@ template * Runs a group of commands at the same time. Ends once any command in the group * finishes, and cancels the others. */ -[[nodiscard]] CommandPtr Race(std::vector&& commands); +[[nodiscard]] +CommandPtr Race(std::vector&& commands); /** * Runs a group of commands at the same time. Ends once any command in the group * finishes, and cancels the others. */ template -[[nodiscard]] CommandPtr Race(Args&&... commands) { +[[nodiscard]] +CommandPtr Race(Args&&... commands) { return Race(impl::MakeVector(std::forward(commands)...)); } @@ -248,15 +265,16 @@ template * Runs a group of commands at the same time. Ends once a specific command * finishes, and cancels the others. */ -[[nodiscard]] CommandPtr Deadline(CommandPtr&& deadline, - std::vector&& others); +[[nodiscard]] +CommandPtr Deadline(CommandPtr&& deadline, std::vector&& others); /** * Runs a group of commands at the same time. Ends once a specific command * finishes, and cancels the others. */ template -[[nodiscard]] CommandPtr Deadline(CommandPtr&& deadline, Args&&... commands) { +[[nodiscard]] +CommandPtr Deadline(CommandPtr&& deadline, Args&&... commands) { return Deadline(std::move(deadline), impl::MakeVector(std::forward(commands)...)); } diff --git a/wpilibNewCommands/src/main/native/include/frc2/command/Subsystem.h b/wpilibNewCommands/src/main/native/include/frc2/command/Subsystem.h index 2c8f093053..218c243616 100644 --- a/wpilibNewCommands/src/main/native/include/frc2/command/Subsystem.h +++ b/wpilibNewCommands/src/main/native/include/frc2/command/Subsystem.h @@ -117,7 +117,8 @@ class Subsystem { * * @param action the action to run */ - [[nodiscard]] CommandPtr RunOnce(std::function action); + [[nodiscard]] + CommandPtr RunOnce(std::function action); /** * Constructs a command that runs an action every iteration until interrupted. @@ -125,7 +126,8 @@ class Subsystem { * * @param action the action to run */ - [[nodiscard]] CommandPtr Run(std::function action); + [[nodiscard]] + CommandPtr Run(std::function action); /** * Constructs a command that runs an action once and another action when the @@ -134,8 +136,8 @@ class Subsystem { * @param start the action to run on start * @param end the action to run on interrupt */ - [[nodiscard]] CommandPtr StartEnd(std::function start, - std::function end); + [[nodiscard]] + CommandPtr StartEnd(std::function start, std::function end); /** * Constructs a command that runs an action every iteration until interrupted, @@ -144,7 +146,7 @@ class Subsystem { * @param run the action to run every iteration * @param end the action to run on interrupt */ - [[nodiscard]] CommandPtr RunEnd(std::function run, - std::function end); + [[nodiscard]] + CommandPtr RunEnd(std::function run, std::function end); }; } // namespace frc2 diff --git a/wpilibc/src/main/native/include/frc/Errors.h b/wpilibc/src/main/native/include/frc/Errors.h index 252a335b79..4dae6c94bb 100644 --- a/wpilibc/src/main/native/include/frc/Errors.h +++ b/wpilibc/src/main/native/include/frc/Errors.h @@ -95,15 +95,16 @@ inline void ReportError(int32_t status, const char* fileName, int lineNumber, * @param[in] args error message format args * @return runtime error object */ -[[nodiscard]] RuntimeError MakeErrorV(int32_t status, const char* fileName, - int lineNumber, const char* funcName, - fmt::string_view format, - fmt::format_args args); +[[nodiscard]] +RuntimeError MakeErrorV(int32_t status, const char* fileName, int lineNumber, + const char* funcName, fmt::string_view format, + fmt::format_args args); template -[[nodiscard]] inline RuntimeError MakeError( - int32_t status, const char* fileName, int lineNumber, const char* funcName, - fmt::string_view format, Args&&... args) { +[[nodiscard]] +inline RuntimeError MakeError(int32_t status, const char* fileName, + int lineNumber, const char* funcName, + fmt::string_view format, Args&&... args) { return MakeErrorV(status, fileName, lineNumber, funcName, format, fmt::make_format_args(args...)); } diff --git a/wpilibc/src/main/native/include/frc/RobotBase.h b/wpilibc/src/main/native/include/frc/RobotBase.h index 112c28122a..8c2372d96c 100644 --- a/wpilibc/src/main/native/include/frc/RobotBase.h +++ b/wpilibc/src/main/native/include/frc/RobotBase.h @@ -227,9 +227,7 @@ class RobotBase { * * @return If the robot is running in simulation. */ - static constexpr bool IsSimulation() { - return !IsReal(); - } + static constexpr bool IsSimulation() { return !IsReal(); } /** * Constructor for a generic robot program. diff --git a/wpilibc/src/main/native/include/frc/simulation/AddressableLEDSim.h b/wpilibc/src/main/native/include/frc/simulation/AddressableLEDSim.h index 4533086156..2a5fcae89f 100644 --- a/wpilibc/src/main/native/include/frc/simulation/AddressableLEDSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/AddressableLEDSim.h @@ -60,7 +60,8 @@ class AddressableLEDSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object storing this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** @@ -85,7 +86,8 @@ class AddressableLEDSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterOutputPortCallback( + [[nodiscard]] + std::unique_ptr RegisterOutputPortCallback( NotifyCallback callback, bool initialNotify); /** @@ -110,8 +112,9 @@ class AddressableLEDSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterLengthCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterLengthCallback(NotifyCallback callback, + bool initialNotify); /** * Get the length of the LED strip. @@ -135,7 +138,8 @@ class AddressableLEDSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterRunningCallback( + [[nodiscard]] + std::unique_ptr RegisterRunningCallback( NotifyCallback callback, bool initialNotify); /** @@ -160,7 +164,8 @@ class AddressableLEDSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterDataCallback( + [[nodiscard]] + std::unique_ptr RegisterDataCallback( ConstBufferCallback callback, bool initialNotify); /** diff --git a/wpilibc/src/main/native/include/frc/simulation/AnalogGyroSim.h b/wpilibc/src/main/native/include/frc/simulation/AnalogGyroSim.h index faa11d712f..0210818b62 100644 --- a/wpilibc/src/main/native/include/frc/simulation/AnalogGyroSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/AnalogGyroSim.h @@ -40,8 +40,9 @@ class AnalogGyroSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterAngleCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterAngleCallback(NotifyCallback callback, + bool initialNotify); /** * Get the current angle of the gyro. @@ -64,8 +65,9 @@ class AnalogGyroSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterRateCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterRateCallback(NotifyCallback callback, + bool initialNotify); /** * Get the rate of angle change on this gyro. @@ -89,7 +91,8 @@ class AnalogGyroSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** diff --git a/wpilibc/src/main/native/include/frc/simulation/AnalogInputSim.h b/wpilibc/src/main/native/include/frc/simulation/AnalogInputSim.h index 03d754896a..05c9898d91 100644 --- a/wpilibc/src/main/native/include/frc/simulation/AnalogInputSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/AnalogInputSim.h @@ -41,7 +41,8 @@ class AnalogInputSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** @@ -66,7 +67,8 @@ class AnalogInputSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterAverageBitsCallback( + [[nodiscard]] + std::unique_ptr RegisterAverageBitsCallback( NotifyCallback callback, bool initialNotify); /** @@ -91,7 +93,8 @@ class AnalogInputSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterOversampleBitsCallback( + [[nodiscard]] + std::unique_ptr RegisterOversampleBitsCallback( NotifyCallback callback, bool initialNotify); /** @@ -116,7 +119,8 @@ class AnalogInputSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterVoltageCallback( + [[nodiscard]] + std::unique_ptr RegisterVoltageCallback( NotifyCallback callback, bool initialNotify); /** @@ -141,9 +145,9 @@ class AnalogInputSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr - RegisterAccumulatorInitializedCallback(NotifyCallback callback, - bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterAccumulatorInitializedCallback( + NotifyCallback callback, bool initialNotify); /** * Check if the accumulator has been initialized. @@ -167,7 +171,8 @@ class AnalogInputSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterAccumulatorValueCallback( + [[nodiscard]] + std::unique_ptr RegisterAccumulatorValueCallback( NotifyCallback callback, bool initialNotify); /** @@ -192,7 +197,8 @@ class AnalogInputSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterAccumulatorCountCallback( + [[nodiscard]] + std::unique_ptr RegisterAccumulatorCountCallback( NotifyCallback callback, bool initialNotify); /** @@ -217,9 +223,9 @@ class AnalogInputSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr - RegisterAccumulatorCenterCallback(NotifyCallback callback, - bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterAccumulatorCenterCallback( + NotifyCallback callback, bool initialNotify); /** * Get the accumulator center. @@ -243,9 +249,9 @@ class AnalogInputSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr - RegisterAccumulatorDeadbandCallback(NotifyCallback callback, - bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterAccumulatorDeadbandCallback( + NotifyCallback callback, bool initialNotify); /** * Get the accumulator deadband. diff --git a/wpilibc/src/main/native/include/frc/simulation/AnalogOutputSim.h b/wpilibc/src/main/native/include/frc/simulation/AnalogOutputSim.h index ffec03a819..42eb6c14b8 100644 --- a/wpilibc/src/main/native/include/frc/simulation/AnalogOutputSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/AnalogOutputSim.h @@ -40,7 +40,8 @@ class AnalogOutputSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterVoltageCallback( + [[nodiscard]] + std::unique_ptr RegisterVoltageCallback( NotifyCallback callback, bool initialNotify); /** @@ -64,7 +65,8 @@ class AnalogOutputSim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** diff --git a/wpilibc/src/main/native/include/frc/simulation/AnalogTriggerSim.h b/wpilibc/src/main/native/include/frc/simulation/AnalogTriggerSim.h index 04e9e9b7d1..019a9a95ae 100644 --- a/wpilibc/src/main/native/include/frc/simulation/AnalogTriggerSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/AnalogTriggerSim.h @@ -53,7 +53,8 @@ class AnalogTriggerSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** @@ -78,9 +79,9 @@ class AnalogTriggerSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr - RegisterTriggerLowerBoundCallback(NotifyCallback callback, - bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterTriggerLowerBoundCallback( + NotifyCallback callback, bool initialNotify); /** * Get the lower bound. @@ -104,9 +105,9 @@ class AnalogTriggerSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr - RegisterTriggerUpperBoundCallback(NotifyCallback callback, - bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterTriggerUpperBoundCallback( + NotifyCallback callback, bool initialNotify); /** * Get the upper bound. diff --git a/wpilibc/src/main/native/include/frc/simulation/BuiltInAccelerometerSim.h b/wpilibc/src/main/native/include/frc/simulation/BuiltInAccelerometerSim.h index 9ffcf5b64d..74a4f161b6 100644 --- a/wpilibc/src/main/native/include/frc/simulation/BuiltInAccelerometerSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/BuiltInAccelerometerSim.h @@ -40,8 +40,9 @@ class BuiltInAccelerometerSim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterActiveCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterActiveCallback(NotifyCallback callback, + bool initialNotify); /** * Check whether the accelerometer is active. @@ -64,8 +65,9 @@ class BuiltInAccelerometerSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterRangeCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterRangeCallback(NotifyCallback callback, + bool initialNotify); /** * Check the range of this accelerometer. @@ -88,8 +90,9 @@ class BuiltInAccelerometerSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterXCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterXCallback(NotifyCallback callback, + bool initialNotify); /** * Measure the X axis value. @@ -112,8 +115,9 @@ class BuiltInAccelerometerSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterYCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterYCallback(NotifyCallback callback, + bool initialNotify); /** * Measure the Y axis value. @@ -136,8 +140,9 @@ class BuiltInAccelerometerSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterZCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterZCallback(NotifyCallback callback, + bool initialNotify); /** * Measure the Z axis value. diff --git a/wpilibc/src/main/native/include/frc/simulation/CTREPCMSim.h b/wpilibc/src/main/native/include/frc/simulation/CTREPCMSim.h index 96959edafd..37113db141 100644 --- a/wpilibc/src/main/native/include/frc/simulation/CTREPCMSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/CTREPCMSim.h @@ -33,21 +33,24 @@ class CTREPCMSim : public PneumaticsBaseSim { ~CTREPCMSim() override = default; - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify) override; bool GetInitialized() const override; void SetInitialized(bool initialized) override; - [[nodiscard]] std::unique_ptr RegisterSolenoidOutputCallback( + [[nodiscard]] + std::unique_ptr RegisterSolenoidOutputCallback( int channel, NotifyCallback callback, bool initialNotify) override; bool GetSolenoidOutput(int channel) const override; void SetSolenoidOutput(int channel, bool solenoidOutput) override; - [[nodiscard]] std::unique_ptr RegisterCompressorOnCallback( + [[nodiscard]] + std::unique_ptr RegisterCompressorOnCallback( NotifyCallback callback, bool initialNotify) override; bool GetCompressorOn() const override; @@ -62,9 +65,9 @@ class CTREPCMSim : public PneumaticsBaseSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr - RegisterClosedLoopEnabledCallback(NotifyCallback callback, - bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterClosedLoopEnabledCallback( + NotifyCallback callback, bool initialNotify); /** * Check whether the closed loop compressor control is active. @@ -88,7 +91,8 @@ class CTREPCMSim : public PneumaticsBaseSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterPressureSwitchCallback( + [[nodiscard]] + std::unique_ptr RegisterPressureSwitchCallback( NotifyCallback callback, bool initialNotify) override; /** @@ -112,9 +116,9 @@ class CTREPCMSim : public PneumaticsBaseSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr - RegisterCompressorCurrentCallback(NotifyCallback callback, - bool initialNotify) override; + [[nodiscard]] + std::unique_ptr RegisterCompressorCurrentCallback( + NotifyCallback callback, bool initialNotify) override; /** * Read the compressor current. diff --git a/wpilibc/src/main/native/include/frc/simulation/DIOSim.h b/wpilibc/src/main/native/include/frc/simulation/DIOSim.h index 9bbd3fb8e9..5264c02302 100644 --- a/wpilibc/src/main/native/include/frc/simulation/DIOSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/DIOSim.h @@ -48,7 +48,8 @@ class DIOSim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** @@ -73,8 +74,9 @@ class DIOSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterValueCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterValueCallback(NotifyCallback callback, + bool initialNotify); /** * Read the value of the DIO port. @@ -97,7 +99,8 @@ class DIOSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterPulseLengthCallback( + [[nodiscard]] + std::unique_ptr RegisterPulseLengthCallback( NotifyCallback callback, bool initialNotify); /** @@ -122,7 +125,8 @@ class DIOSim { * initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterIsInputCallback( + [[nodiscard]] + std::unique_ptr RegisterIsInputCallback( NotifyCallback callback, bool initialNotify); /** @@ -147,7 +151,8 @@ class DIOSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterFilterIndexCallback( + [[nodiscard]] + std::unique_ptr RegisterFilterIndexCallback( NotifyCallback callback, bool initialNotify); /** diff --git a/wpilibc/src/main/native/include/frc/simulation/DigitalPWMSim.h b/wpilibc/src/main/native/include/frc/simulation/DigitalPWMSim.h index 53caee7427..f9b974d36b 100644 --- a/wpilibc/src/main/native/include/frc/simulation/DigitalPWMSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/DigitalPWMSim.h @@ -54,7 +54,8 @@ class DigitalPWMSim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** @@ -78,7 +79,8 @@ class DigitalPWMSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterDutyCycleCallback( + [[nodiscard]] + std::unique_ptr RegisterDutyCycleCallback( NotifyCallback callback, bool initialNotify); /** @@ -102,8 +104,9 @@ class DigitalPWMSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterPinCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterPinCallback(NotifyCallback callback, + bool initialNotify); /** * Check the pin number. diff --git a/wpilibc/src/main/native/include/frc/simulation/DriverStationSim.h b/wpilibc/src/main/native/include/frc/simulation/DriverStationSim.h index 232c12326f..acc510ccb0 100644 --- a/wpilibc/src/main/native/include/frc/simulation/DriverStationSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/DriverStationSim.h @@ -26,7 +26,8 @@ class DriverStationSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr RegisterEnabledCallback( + [[nodiscard]] + static std::unique_ptr RegisterEnabledCallback( NotifyCallback callback, bool initialNotify); /** @@ -51,8 +52,9 @@ class DriverStationSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterAutonomousCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterAutonomousCallback( + NotifyCallback callback, bool initialNotify); /** * Check if the DS is in autonomous. @@ -76,7 +78,8 @@ class DriverStationSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr RegisterTestCallback( + [[nodiscard]] + static std::unique_ptr RegisterTestCallback( NotifyCallback callback, bool initialNotify); /** @@ -101,7 +104,8 @@ class DriverStationSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr RegisterEStopCallback( + [[nodiscard]] + static std::unique_ptr RegisterEStopCallback( NotifyCallback callback, bool initialNotify); /** @@ -126,8 +130,9 @@ class DriverStationSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterFmsAttachedCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterFmsAttachedCallback( + NotifyCallback callback, bool initialNotify); /** * Check if the FMS is connected. @@ -151,8 +156,9 @@ class DriverStationSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterDsAttachedCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterDsAttachedCallback( + NotifyCallback callback, bool initialNotify); /** * Check if the DS is attached. @@ -176,9 +182,9 @@ class DriverStationSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterAllianceStationIdCallback(NotifyCallback callback, - bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterAllianceStationIdCallback( + NotifyCallback callback, bool initialNotify); /** * Get the alliance station ID (color + number). @@ -202,7 +208,8 @@ class DriverStationSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr RegisterMatchTimeCallback( + [[nodiscard]] + static std::unique_ptr RegisterMatchTimeCallback( NotifyCallback callback, bool initialNotify); /** diff --git a/wpilibc/src/main/native/include/frc/simulation/DutyCycleSim.h b/wpilibc/src/main/native/include/frc/simulation/DutyCycleSim.h index ec7b48c8b4..f6f89ebc44 100644 --- a/wpilibc/src/main/native/include/frc/simulation/DutyCycleSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/DutyCycleSim.h @@ -51,7 +51,8 @@ class DutyCycleSim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** @@ -75,7 +76,8 @@ class DutyCycleSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterFrequencyCallback( + [[nodiscard]] + std::unique_ptr RegisterFrequencyCallback( NotifyCallback callback, bool initialNotify); /** @@ -99,8 +101,9 @@ class DutyCycleSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterOutputCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterOutputCallback(NotifyCallback callback, + bool initialNotify); /** * Measure the output from this duty cycle port. diff --git a/wpilibc/src/main/native/include/frc/simulation/EncoderSim.h b/wpilibc/src/main/native/include/frc/simulation/EncoderSim.h index 0d578b4988..52d7bd10cf 100644 --- a/wpilibc/src/main/native/include/frc/simulation/EncoderSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/EncoderSim.h @@ -53,7 +53,8 @@ class EncoderSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** @@ -78,8 +79,9 @@ class EncoderSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterCountCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterCountCallback(NotifyCallback callback, + bool initialNotify); /** * Read the count of the encoder. @@ -103,8 +105,9 @@ class EncoderSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterPeriodCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterPeriodCallback(NotifyCallback callback, + bool initialNotify); /** * Read the period of the encoder. @@ -127,8 +130,9 @@ class EncoderSim { * @param initialNotify whether to run the callback on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterResetCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterResetCallback(NotifyCallback callback, + bool initialNotify); /** * Check if the encoder has been reset. @@ -152,7 +156,8 @@ class EncoderSim { * @param initialNotify whether to run the callback on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterMaxPeriodCallback( + [[nodiscard]] + std::unique_ptr RegisterMaxPeriodCallback( NotifyCallback callback, bool initialNotify); /** @@ -177,7 +182,8 @@ class EncoderSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterDirectionCallback( + [[nodiscard]] + std::unique_ptr RegisterDirectionCallback( NotifyCallback callback, bool initialNotify); /** @@ -202,7 +208,8 @@ class EncoderSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterReverseDirectionCallback( + [[nodiscard]] + std::unique_ptr RegisterReverseDirectionCallback( NotifyCallback callback, bool initialNotify); /** @@ -227,7 +234,8 @@ class EncoderSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterSamplesToAverageCallback( + [[nodiscard]] + std::unique_ptr RegisterSamplesToAverageCallback( NotifyCallback callback, bool initialNotify); /** @@ -252,7 +260,8 @@ class EncoderSim { * @param initialNotify if true, the callback will be run on the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterDistancePerPulseCallback( + [[nodiscard]] + std::unique_ptr RegisterDistancePerPulseCallback( NotifyCallback callback, bool initialNotify); /** diff --git a/wpilibc/src/main/native/include/frc/simulation/PWMSim.h b/wpilibc/src/main/native/include/frc/simulation/PWMSim.h index 8b4156edd0..be91841fd5 100644 --- a/wpilibc/src/main/native/include/frc/simulation/PWMSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/PWMSim.h @@ -48,7 +48,8 @@ class PWMSim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** @@ -72,7 +73,8 @@ class PWMSim { * @param initialNotify whether to run the callback with the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterRawValueCallback( + [[nodiscard]] + std::unique_ptr RegisterRawValueCallback( NotifyCallback callback, bool initialNotify); /** @@ -96,8 +98,9 @@ class PWMSim { * @param initialNotify whether to run the callback with the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterSpeedCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterSpeedCallback(NotifyCallback callback, + bool initialNotify); /** * Get the PWM speed. @@ -120,7 +123,8 @@ class PWMSim { * @param initialNotify whether to run the callback with the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterPositionCallback( + [[nodiscard]] + std::unique_ptr RegisterPositionCallback( NotifyCallback callback, bool initialNotify); /** @@ -144,7 +148,8 @@ class PWMSim { * @param initialNotify whether to run the callback with the initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterPeriodScaleCallback( + [[nodiscard]] + std::unique_ptr RegisterPeriodScaleCallback( NotifyCallback callback, bool initialNotify); /** @@ -168,7 +173,8 @@ class PWMSim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterZeroLatchCallback( + [[nodiscard]] + std::unique_ptr RegisterZeroLatchCallback( NotifyCallback callback, bool initialNotify); /** diff --git a/wpilibc/src/main/native/include/frc/simulation/PneumaticsBaseSim.h b/wpilibc/src/main/native/include/frc/simulation/PneumaticsBaseSim.h index 11110e3478..510349f769 100644 --- a/wpilibc/src/main/native/include/frc/simulation/PneumaticsBaseSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/PneumaticsBaseSim.h @@ -42,8 +42,9 @@ class PneumaticsBaseSim { * Save a reference to this object; it being deconstructed cancels the * callback. */ - [[nodiscard]] virtual std::unique_ptr - RegisterInitializedCallback(NotifyCallback callback, bool initialNotify) = 0; + [[nodiscard]] + virtual std::unique_ptr RegisterInitializedCallback( + NotifyCallback callback, bool initialNotify) = 0; /** * Check if the compressor is on. @@ -68,8 +69,9 @@ class PneumaticsBaseSim { * Save a reference to this object; it being deconstructed cancels the * callback. */ - [[nodiscard]] virtual std::unique_ptr - RegisterCompressorOnCallback(NotifyCallback callback, bool initialNotify) = 0; + [[nodiscard]] + virtual std::unique_ptr RegisterCompressorOnCallback( + NotifyCallback callback, bool initialNotify) = 0; /** * Check the solenoid output on a specific channel. @@ -98,9 +100,9 @@ class PneumaticsBaseSim { * Save a reference to this object; it being deconstructed cancels the * callback. */ - [[nodiscard]] virtual std::unique_ptr - RegisterSolenoidOutputCallback(int channel, NotifyCallback callback, - bool initialNotify) = 0; + [[nodiscard]] + virtual std::unique_ptr RegisterSolenoidOutputCallback( + int channel, NotifyCallback callback, bool initialNotify) = 0; /** * Check the value of the pressure switch. @@ -126,9 +128,9 @@ class PneumaticsBaseSim { * Save a reference to this object; it being deconstructed cancels the * callback. */ - [[nodiscard]] virtual std::unique_ptr - RegisterPressureSwitchCallback(NotifyCallback callback, - bool initialNotify) = 0; + [[nodiscard]] + virtual std::unique_ptr RegisterPressureSwitchCallback( + NotifyCallback callback, bool initialNotify) = 0; /** * Read the compressor current. @@ -153,9 +155,9 @@ class PneumaticsBaseSim { * Save a reference to this object; it being deconstructed cancels the * callback. */ - [[nodiscard]] virtual std::unique_ptr - RegisterCompressorCurrentCallback(NotifyCallback callback, - bool initialNotify) = 0; + [[nodiscard]] + virtual std::unique_ptr RegisterCompressorCurrentCallback( + NotifyCallback callback, bool initialNotify) = 0; /** * Get the current value of all solenoid outputs. diff --git a/wpilibc/src/main/native/include/frc/simulation/PowerDistributionSim.h b/wpilibc/src/main/native/include/frc/simulation/PowerDistributionSim.h index ac54da2f0a..76fa7ba97a 100644 --- a/wpilibc/src/main/native/include/frc/simulation/PowerDistributionSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/PowerDistributionSim.h @@ -40,7 +40,8 @@ class PowerDistributionSim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify); /** @@ -65,7 +66,8 @@ class PowerDistributionSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterTemperatureCallback( + [[nodiscard]] + std::unique_ptr RegisterTemperatureCallback( NotifyCallback callback, bool initialNotify); /** @@ -90,7 +92,8 @@ class PowerDistributionSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterVoltageCallback( + [[nodiscard]] + std::unique_ptr RegisterVoltageCallback( NotifyCallback callback, bool initialNotify); /** @@ -116,7 +119,8 @@ class PowerDistributionSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterCurrentCallback( + [[nodiscard]] + std::unique_ptr RegisterCurrentCallback( int channel, NotifyCallback callback, bool initialNotify); /** diff --git a/wpilibc/src/main/native/include/frc/simulation/REVPHSim.h b/wpilibc/src/main/native/include/frc/simulation/REVPHSim.h index fe305ba907..917eb1f4c6 100644 --- a/wpilibc/src/main/native/include/frc/simulation/REVPHSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/REVPHSim.h @@ -37,21 +37,24 @@ class REVPHSim : public PneumaticsBaseSim { ~REVPHSim() override = default; - [[nodiscard]] std::unique_ptr RegisterInitializedCallback( + [[nodiscard]] + std::unique_ptr RegisterInitializedCallback( NotifyCallback callback, bool initialNotify) override; bool GetInitialized() const override; void SetInitialized(bool solenoidInitialized) override; - [[nodiscard]] std::unique_ptr RegisterSolenoidOutputCallback( + [[nodiscard]] + std::unique_ptr RegisterSolenoidOutputCallback( int channel, NotifyCallback callback, bool initialNotify) override; bool GetSolenoidOutput(int channel) const override; void SetSolenoidOutput(int channel, bool solenoidOutput) override; - [[nodiscard]] std::unique_ptr RegisterCompressorOnCallback( + [[nodiscard]] + std::unique_ptr RegisterCompressorOnCallback( NotifyCallback callback, bool initialNotify) override; /** @@ -76,9 +79,9 @@ class REVPHSim : public PneumaticsBaseSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr - RegisterCompressorConfigTypeCallback(NotifyCallback callback, - bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterCompressorConfigTypeCallback( + NotifyCallback callback, bool initialNotify); /** * Check whether the closed loop compressor control is active. @@ -94,16 +97,17 @@ class REVPHSim : public PneumaticsBaseSim { */ void SetCompressorConfigType(int compressorConfigType); - [[nodiscard]] std::unique_ptr RegisterPressureSwitchCallback( + [[nodiscard]] + std::unique_ptr RegisterPressureSwitchCallback( NotifyCallback callback, bool initialNotify) override; bool GetPressureSwitch() const override; void SetPressureSwitch(bool pressureSwitch) override; - [[nodiscard]] std::unique_ptr - RegisterCompressorCurrentCallback(NotifyCallback callback, - bool initialNotify) override; + [[nodiscard]] + std::unique_ptr RegisterCompressorCurrentCallback( + NotifyCallback callback, bool initialNotify) override; double GetCompressorCurrent() const override; diff --git a/wpilibc/src/main/native/include/frc/simulation/RelaySim.h b/wpilibc/src/main/native/include/frc/simulation/RelaySim.h index 5034885868..ecc4ded139 100644 --- a/wpilibc/src/main/native/include/frc/simulation/RelaySim.h +++ b/wpilibc/src/main/native/include/frc/simulation/RelaySim.h @@ -40,9 +40,9 @@ class RelaySim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr - RegisterInitializedForwardCallback(NotifyCallback callback, - bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterInitializedForwardCallback( + NotifyCallback callback, bool initialNotify); /** * Check whether the forward direction has been initialized. @@ -65,9 +65,9 @@ class RelaySim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr - RegisterInitializedReverseCallback(NotifyCallback callback, - bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterInitializedReverseCallback( + NotifyCallback callback, bool initialNotify); /** * Check whether the reverse direction has been initialized. @@ -90,7 +90,8 @@ class RelaySim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterForwardCallback( + [[nodiscard]] + std::unique_ptr RegisterForwardCallback( NotifyCallback callback, bool initialNotify); /** @@ -114,7 +115,8 @@ class RelaySim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterReverseCallback( + [[nodiscard]] + std::unique_ptr RegisterReverseCallback( NotifyCallback callback, bool initialNotify); /** diff --git a/wpilibc/src/main/native/include/frc/simulation/RoboRioSim.h b/wpilibc/src/main/native/include/frc/simulation/RoboRioSim.h index ee959b66cc..e1697e9c83 100644 --- a/wpilibc/src/main/native/include/frc/simulation/RoboRioSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/RoboRioSim.h @@ -26,8 +26,9 @@ class RoboRioSim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterFPGAButtonCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterFPGAButtonCallback( + NotifyCallback callback, bool initialNotify); /** * Query the state of the FPGA button. @@ -50,8 +51,9 @@ class RoboRioSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterVInVoltageCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterVInVoltageCallback( + NotifyCallback callback, bool initialNotify); /** * Measure the Vin voltage. @@ -75,8 +77,9 @@ class RoboRioSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterVInCurrentCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterVInCurrentCallback( + NotifyCallback callback, bool initialNotify); /** * Measure the Vin current. @@ -100,8 +103,9 @@ class RoboRioSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserVoltage6VCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserVoltage6VCallback( + NotifyCallback callback, bool initialNotify); /** * Measure the 6V rail voltage. @@ -125,8 +129,9 @@ class RoboRioSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserCurrent6VCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserCurrent6VCallback( + NotifyCallback callback, bool initialNotify); /** * Measure the 6V rail current. @@ -150,8 +155,9 @@ class RoboRioSim { * initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserActive6VCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserActive6VCallback( + NotifyCallback callback, bool initialNotify); /** * Get the 6V rail active state. @@ -175,8 +181,9 @@ class RoboRioSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserVoltage5VCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserVoltage5VCallback( + NotifyCallback callback, bool initialNotify); /** * Measure the 5V rail voltage. @@ -200,8 +207,9 @@ class RoboRioSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserCurrent5VCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserCurrent5VCallback( + NotifyCallback callback, bool initialNotify); /** * Measure the 5V rail current. @@ -225,8 +233,9 @@ class RoboRioSim { * initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserActive5VCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserActive5VCallback( + NotifyCallback callback, bool initialNotify); /** * Get the 5V rail active state. @@ -250,8 +259,9 @@ class RoboRioSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserVoltage3V3Callback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserVoltage3V3Callback( + NotifyCallback callback, bool initialNotify); /** * Measure the 3.3V rail voltage. @@ -275,8 +285,9 @@ class RoboRioSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserCurrent3V3Callback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserCurrent3V3Callback( + NotifyCallback callback, bool initialNotify); /** * Measure the 3.3V rail current. @@ -300,8 +311,9 @@ class RoboRioSim { * initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserActive3V3Callback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserActive3V3Callback( + NotifyCallback callback, bool initialNotify); /** * Get the 3.3V rail active state. @@ -326,8 +338,9 @@ class RoboRioSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserFaults6VCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserFaults6VCallback( + NotifyCallback callback, bool initialNotify); /** * Get the 6V rail number of faults. @@ -352,8 +365,9 @@ class RoboRioSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserFaults5VCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserFaults5VCallback( + NotifyCallback callback, bool initialNotify); /** * Get the 5V rail number of faults. @@ -378,8 +392,9 @@ class RoboRioSim { * initial value * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterUserFaults3V3Callback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterUserFaults3V3Callback( + NotifyCallback callback, bool initialNotify); /** * Get the 3.3V rail number of faults. @@ -402,8 +417,9 @@ class RoboRioSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] static std::unique_ptr - RegisterBrownoutVoltageCallback(NotifyCallback callback, bool initialNotify); + [[nodiscard]] + static std::unique_ptr RegisterBrownoutVoltageCallback( + NotifyCallback callback, bool initialNotify); /** * Measure the brownout voltage. diff --git a/wpilibc/src/main/native/include/frc/simulation/SPIAccelerometerSim.h b/wpilibc/src/main/native/include/frc/simulation/SPIAccelerometerSim.h index 9d31bd0acb..a84391e7bc 100644 --- a/wpilibc/src/main/native/include/frc/simulation/SPIAccelerometerSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/SPIAccelerometerSim.h @@ -25,8 +25,9 @@ class SPIAccelerometerSim { * @param initialNotify whether to run the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterActiveCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterActiveCallback(NotifyCallback callback, + bool initialNotify); /** * Check whether the accelerometer is active. @@ -49,8 +50,9 @@ class SPIAccelerometerSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterRangeCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterRangeCallback(NotifyCallback callback, + bool initialNotify); /** * Check the range of this accelerometer. @@ -73,8 +75,9 @@ class SPIAccelerometerSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterXCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterXCallback(NotifyCallback callback, + bool initialNotify); /** * Measure the X axis value. @@ -97,8 +100,9 @@ class SPIAccelerometerSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterYCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterYCallback(NotifyCallback callback, + bool initialNotify); /** * Measure the Y axis value. @@ -121,8 +125,9 @@ class SPIAccelerometerSim { * @param initialNotify whether to call the callback with the initial state * @return the CallbackStore object associated with this callback */ - [[nodiscard]] std::unique_ptr RegisterZCallback( - NotifyCallback callback, bool initialNotify); + [[nodiscard]] + std::unique_ptr RegisterZCallback(NotifyCallback callback, + bool initialNotify); /** * Measure the Z axis value. diff --git a/wpilibc/src/main/native/include/frc/simulation/SolenoidSim.h b/wpilibc/src/main/native/include/frc/simulation/SolenoidSim.h index 66e35891bd..79c7a2deab 100644 --- a/wpilibc/src/main/native/include/frc/simulation/SolenoidSim.h +++ b/wpilibc/src/main/native/include/frc/simulation/SolenoidSim.h @@ -29,7 +29,8 @@ class SolenoidSim { * Save a reference to this object; it being deconstructed cancels the * callback. */ - [[nodiscard]] virtual std::unique_ptr RegisterOutputCallback( + [[nodiscard]] + virtual std::unique_ptr RegisterOutputCallback( NotifyCallback callback, bool initialNotify); std::shared_ptr GetModuleSim() const; diff --git a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Drive.h b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Drive.h index 9a39a14ac9..ac96c52839 100644 --- a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Drive.h +++ b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Drive.h @@ -25,8 +25,9 @@ class Drive : public frc2::SubsystemBase { * @param fwd the commanded forward movement * @param rot the commanded rotation */ - [[nodiscard]] frc2::CommandPtr ArcadeDriveCommand( - std::function fwd, std::function rot); + [[nodiscard]] + frc2::CommandPtr ArcadeDriveCommand(std::function fwd, + std::function rot); /** * Returns a command that drives the robot forward a specified distance at a @@ -35,8 +36,8 @@ class Drive : public frc2::SubsystemBase { * @param distance The distance to drive forward in meters * @param speed The fraction of max speed at which to drive */ - [[nodiscard]] frc2::CommandPtr DriveDistanceCommand(units::meter_t distance, - double speed); + [[nodiscard]] + frc2::CommandPtr DriveDistanceCommand(units::meter_t distance, double speed); private: frc::PWMSparkMax m_leftLeader{DriveConstants::kLeftMotor1Port}; diff --git a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Intake.h b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Intake.h index af8d39a70a..72093205ab 100644 --- a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Intake.h +++ b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Intake.h @@ -19,10 +19,12 @@ class Intake : public frc2::SubsystemBase { /** Returns a command that deploys the intake, and then runs the intake motor * indefinitely. */ - [[nodiscard]] frc2::CommandPtr IntakeCommand(); + [[nodiscard]] + frc2::CommandPtr IntakeCommand(); /** Returns a command that turns off and retracts the intake. */ - [[nodiscard]] frc2::CommandPtr RetractCommand(); + [[nodiscard]] + frc2::CommandPtr RetractCommand(); private: frc::PWMSparkMax m_motor{IntakeConstants::kMotorPort}; diff --git a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Shooter.h b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Shooter.h index 5ab2a63832..b31155934f 100644 --- a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Shooter.h +++ b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Shooter.h @@ -28,8 +28,8 @@ class Shooter : public frc2::SubsystemBase { * * @param setpointRotationsPerSecond The desired shooter velocity */ - [[nodiscard]] frc2::CommandPtr ShootCommand( - units::turns_per_second_t setpoint); + [[nodiscard]] + frc2::CommandPtr ShootCommand(units::turns_per_second_t setpoint); private: frc::PWMSparkMax m_shooterMotor{ShooterConstants::kShooterMotorPort}; diff --git a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Storage.h b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Storage.h index eab6da4917..58694b3035 100644 --- a/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Storage.h +++ b/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot/include/subsystems/Storage.h @@ -15,7 +15,8 @@ class Storage : frc2::SubsystemBase { public: Storage(); /** Returns a command that runs the storage motor indefinitely. */ - [[nodiscard]] frc2::CommandPtr RunCommand(); + [[nodiscard]] + frc2::CommandPtr RunCommand(); /** Whether the ball storage is full. */ bool IsFull() const; diff --git a/wpimath/src/main/native/include/frc/kinematics/SwerveDriveKinematics.h b/wpimath/src/main/native/include/frc/kinematics/SwerveDriveKinematics.h index 25ae3f3291..0ebd51733b 100644 --- a/wpimath/src/main/native/include/frc/kinematics/SwerveDriveKinematics.h +++ b/wpimath/src/main/native/include/frc/kinematics/SwerveDriveKinematics.h @@ -147,10 +147,10 @@ class SwerveDriveKinematics { * @return The resulting chassis speed. */ template - requires(std::is_same_v, - SwerveModuleState>&&...) ChassisSpeeds - ToChassisSpeeds(ModuleStates&&... wheelStates) - const; + requires(std::is_same_v, + SwerveModuleState> && + ...) + ChassisSpeeds ToChassisSpeeds(ModuleStates&&... wheelStates) const; /** * Performs forward kinematics to return the resulting chassis state from the diff --git a/wpimath/src/main/native/include/frc/kinematics/SwerveDriveKinematics.inc b/wpimath/src/main/native/include/frc/kinematics/SwerveDriveKinematics.inc index 8db7f9ce2c..0c15496fa5 100644 --- a/wpimath/src/main/native/include/frc/kinematics/SwerveDriveKinematics.inc +++ b/wpimath/src/main/native/include/frc/kinematics/SwerveDriveKinematics.inc @@ -66,11 +66,11 @@ SwerveDriveKinematics::ToSwerveModuleStates( template template -requires(std::is_same_v, - SwerveModuleState>&&...) - ChassisSpeeds SwerveDriveKinematics::ToChassisSpeeds( - ModuleStates&&... wheelStates) -const { + requires(std::is_same_v, + SwerveModuleState> && + ...) +ChassisSpeeds SwerveDriveKinematics::ToChassisSpeeds( + ModuleStates&&... wheelStates) const { static_assert(sizeof...(wheelStates) == NumModules, "Number of modules is not consistent with number of wheel " "locations provided in constructor."); diff --git a/wpinet/src/test/native/cpp/WebSocketTest.h b/wpinet/src/test/native/cpp/WebSocketTest.h index 903ce00a87..9e3ab05fc7 100644 --- a/wpinet/src/test/native/cpp/WebSocketTest.h +++ b/wpinet/src/test/native/cpp/WebSocketTest.h @@ -48,9 +48,7 @@ class WebSocketTest : public ::testing::Test { failTimer->Unreference(); } - ~WebSocketTest() override { - Finish(); - } + ~WebSocketTest() override { Finish(); } void Finish() { loop->Walk([](uv::Handle& it) { it.Close(); }); diff --git a/wpiutil/src/main/native/include/wpi/MappedFileRegion.h b/wpiutil/src/main/native/include/wpi/MappedFileRegion.h index 05e487e2a8..33d3bb9df0 100644 --- a/wpiutil/src/main/native/include/wpi/MappedFileRegion.h +++ b/wpiutil/src/main/native/include/wpi/MappedFileRegion.h @@ -59,19 +59,13 @@ class MappedFileRegion { return *this; } - explicit operator bool() const { - return m_mapping != nullptr; - } + explicit operator bool() const { return m_mapping != nullptr; } void Flush(); void Unmap(); - uint64_t size() const { - return m_size; - } - uint8_t* data() const { - return static_cast(m_mapping); - } + uint64_t size() const { return m_size; } + uint8_t* data() const { return static_cast(m_mapping); } const uint8_t* const_data() const { return static_cast(m_mapping); } diff --git a/wpiutil/src/main/native/include/wpi/priority_queue.h b/wpiutil/src/main/native/include/wpi/priority_queue.h index 4610aba366..1aeef188a9 100644 --- a/wpiutil/src/main/native/include/wpi/priority_queue.h +++ b/wpiutil/src/main/native/include/wpi/priority_queue.h @@ -65,7 +65,10 @@ class priority_queue { std::make_heap(c.begin(), c.end(), comp); } - [[nodiscard]] bool empty() const { return c.empty(); } + [[nodiscard]] + bool empty() const { + return c.empty(); + } size_type size() const { return c.size(); }