2016-12-22 21:19:50 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-01-02 09:16:20 -08:00
|
|
|
/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */
|
2016-12-22 21:19:50 -08:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
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>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2018-07-27 22:12:30 -07:00
|
|
|
#include <wpi/Signal.h>
|
2018-04-29 23:33:19 -07:00
|
|
|
#include <wpi/StringRef.h>
|
2018-07-29 12:53:41 -07:00
|
|
|
#include <wpi/Twine.h>
|
2016-12-22 21:19:50 -08:00
|
|
|
|
|
|
|
|
#include "cscore_c.h"
|
|
|
|
|
|
|
|
|
|
namespace cs {
|
|
|
|
|
|
|
|
|
|
// Property data
|
|
|
|
|
class PropertyImpl {
|
|
|
|
|
public:
|
|
|
|
|
PropertyImpl() = default;
|
2018-07-29 12:53:41 -07:00
|
|
|
explicit PropertyImpl(const wpi::Twine& name_);
|
|
|
|
|
PropertyImpl(const wpi::Twine& name_, CS_PropertyKind kind_, int step_,
|
2018-07-27 22:12:30 -07:00
|
|
|
int defaultValue_, int value_);
|
2018-07-29 12:53:41 -07:00
|
|
|
PropertyImpl(const wpi::Twine& 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);
|
2018-07-29 12:53:41 -07:00
|
|
|
void SetValue(const wpi::Twine& 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_
|