WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
NotifyListener.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #ifndef __FRC_ROBORIO__
11 
12 #include "HAL_Value.h"
13 
14 typedef void (*HAL_NotifyCallback)(const char* name, void* param,
15  const struct HAL_Value* value);
16 
17 typedef void (*HAL_BufferCallback)(const char* name, void* param,
18  unsigned char* buffer, unsigned int count);
19 
20 typedef void (*HAL_ConstBufferCallback)(const char* name, void* param,
21  const unsigned char* buffer,
22  unsigned int count);
23 
24 namespace hal {
25 
26 template <typename CallbackFunction>
28  HalCallbackListener() = default;
29  HalCallbackListener(void* param_, CallbackFunction callback_)
30  : callback(callback_), param(param_) {}
31 
32  explicit operator bool() const { return callback != nullptr; }
33 
34  CallbackFunction callback;
35  void* param;
36 };
37 
38 } // namespace hal
39 
40 #endif
HAL Entry Value.
Definition: HAL_Value.h:25
WPILib Hardware Abstraction Layer (HAL) namespace.
Definition: SimDataValue.h:19
Definition: NotifyListener.h:27
auto count(R &&Range, const E &Element) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
Wrapper function around std::count to count the number of times an element Element occurs in the give...
Definition: STLExtras.h:941