2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2016-12-22 21:19:50 -08:00
|
|
|
|
2017-08-25 17:48:06 -07:00
|
|
|
#ifndef CSCORE_PROPERTYIMPL_H_
|
|
|
|
|
#define CSCORE_PROPERTYIMPL_H_
|
2016-12-22 21:19:50 -08:00
|
|
|
|
|
|
|
|
#include <string>
|
2021-06-06 16:13:58 -07:00
|
|
|
#include <string_view>
|
2016-12-22 21:19:50 -08:00
|
|
|
#include <vector>
|
|
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/util/Signal.h"
|
2016-12-22 21:19:50 -08:00
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/cs/cscore_c.h"
|
2016-12-22 21:19:50 -08:00
|
|
|
|
|
|
|
|
namespace cs {
|
|
|
|
|
|
|
|
|
|
// Property data
|
|
|
|
|
class PropertyImpl {
|
|
|
|
|
public:
|
|
|
|
|
PropertyImpl() = default;
|
2021-06-06 16:13:58 -07:00
|
|
|
explicit PropertyImpl(std::string_view name_);
|
|
|
|
|
PropertyImpl(std::string_view name_, CS_PropertyKind kind_, int step_,
|
2018-07-27 22:12:30 -07:00
|
|
|
int defaultValue_, int value_);
|
2021-06-06 16:13:58 -07:00
|
|
|
PropertyImpl(std::string_view name_, CS_PropertyKind kind_, int minimum_,
|
2018-07-27 22:12:30 -07:00
|
|
|
int maximum_, int step_, int defaultValue_, int value_);
|
2016-12-22 21:19:50 -08:00
|
|
|
virtual ~PropertyImpl() = default;
|
|
|
|
|
PropertyImpl(const PropertyImpl& oth) = delete;
|
|
|
|
|
PropertyImpl& operator=(const PropertyImpl& oth) = delete;
|
|
|
|
|
|
2018-07-27 22:12:30 -07:00
|
|
|
void SetValue(int v);
|
2021-06-06 16:13:58 -07:00
|
|
|
void SetValue(std::string_view v);
|
2018-07-27 22:12:30 -07:00
|
|
|
void SetDefaultValue(int v);
|
2016-12-22 21:19:50 -08:00
|
|
|
|
|
|
|
|
std::string name;
|
|
|
|
|
CS_PropertyKind propKind{CS_PROP_NONE};
|
|
|
|
|
bool hasMinimum{false};
|
|
|
|
|
bool hasMaximum{false};
|
|
|
|
|
int minimum{0};
|
|
|
|
|
int maximum{100};
|
|
|
|
|
int step{1};
|
|
|
|
|
int defaultValue{0};
|
|
|
|
|
int value{0};
|
|
|
|
|
std::string valueStr;
|
|
|
|
|
std::vector<std::string> enumChoices;
|
|
|
|
|
bool valueSet{false};
|
2018-07-27 22:12:30 -07:00
|
|
|
|
|
|
|
|
// emitted when value changes
|
|
|
|
|
wpi::sig::Signal<> changed;
|
2016-12-22 21:19:50 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace cs
|
|
|
|
|
|
2017-08-25 17:48:06 -07:00
|
|
|
#endif // CSCORE_PROPERTYIMPL_H_
|