11#include "webcface/common/webcface-config.h"
25 :
Field(base), index(index) {}
42 std::optional<double> tryGet()
const;
49 double get()
const {
return tryGet().value_or(0); }
66 using Field::lastName;
122 template <
typename T,
123 std::enable_if_t<std::is_integral_v<T>, std::nullptr_t> =
nullptr>
154 template <
typename F,
typename std::enable_if_t<std::is_invocable_v<F>,
155 std::
nullptr_t> =
nullptr>
158 [callback = std::move(callback)](
const auto &) { callback(); });
167 template <
typename T>
169 onChange(std::forward<T>(callback));
179 const Value &set(
double v)
const;
185 const Value &set(std::vector<double> v)
const;
195 template <
typename R,
198 return set(traits::arrayLikeToVector(range));
204 const Value &resize(std::size_t size)
const;
208 const Value &push_back(
double v)
const;
218 std::size_t size()
const;
224 template <
typename T>
226 this->set(std::forward<T>(v));
238 this->set(std::move(v));
247 const Value &request()
const;
254 std::optional<double> tryGet()
const;
259 std::optional<std::vector<double>> tryGetVec()
const;
264 double get()
const {
return tryGet().value_or(0); }
270 return tryGetVec().value_or(std::vector<double>{});
272 operator double()
const {
return get(); }
273 operator std::vector<double>()
const {
return getVec(); }
288 [[deprecated]] std::chrono::system_clock::time_point time()
const;
294 const Value &free()
const;
297 this->set(this->
get() + rhs);
301 this->set(this->
get() - rhs);
305 this->set(this->
get() * rhs);
309 this->set(this->
get() / rhs);
313 this->set(
static_cast<std::int32_t
>(this->
get()) % rhs);
318 this->set(
static_cast<std::int32_t
>(this->
get()) << rhs);
322 this->set(
static_cast<std::int32_t
>(this->
get()) >> rhs);
326 this->set(
static_cast<std::int32_t
>(this->
get()) & rhs);
330 this->set(
static_cast<std::int32_t
>(this->
get()) | rhs);
334 this->set(
static_cast<std::int32_t
>(this->
get()) ^ rhs);
342 this->set(this->
get() + 1);
350 auto v = this->
get();
359 this->set(this->
get() - 1);
367 auto v = this->
get();
380 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Value>,
381 std::
nullptr_t> =
nullptr>
383 return static_cast<Field>(*this) ==
static_cast<Field>(other);
385 template <
typename T,
typename std::enable_if_t<std::is_same_v<T, Value>,
386 std::
nullptr_t> =
nullptr>
388 return static_cast<Field>(*this) ==
static_cast<Field>(other);
u8stringとstringとwstringをshared_ptrで持ち共有する
Definition encoding.h:67
配列型のValueデータの一部の要素を指定するクラス
Definition value.h:20
ValueElementRef(const Field &base, std::size_t index)
Definition value.h:24
const ValueElementRef & operator=(double v) const
Definition value.h:35
double get() const
値があればその要素を返す
Definition value.h:49
実数値またはその配列の送受信データを表すクラス
Definition value.h:59
Value parent() const
nameの最後のピリオドの前までを新しい名前とするField
Definition value.h:138
const Value & operator/=(double rhs) const
Definition value.h:308
const Value & operator+=(double rhs) const
Definition value.h:296
const Value & operator|=(std::int32_t rhs) const
Definition value.h:329
bool operator==(const T &other) const
Valueの参照先を比較
Definition value.h:382
ValueElementRef operator[](T index) const
1次元配列型データの要素を参照する
Definition value.h:124
const Value & onChange(F callback) const
値が変化したときに呼び出されるコールバックを設定
Definition value.h:156
const Value & set(const R &range) const
配列型の値をセットする
Definition value.h:197
std::vector< double > getVec() const
値をvectorで返す
Definition value.h:269
const Value & operator%=(std::int32_t rhs) const
Definition value.h:312
const Value & operator>>=(std::int32_t rhs) const
Definition value.h:321
double operator--(int) const
1引いたものをsetし、足す前の値を返す
Definition value.h:366
Value operator[](std::string_view field) const
Definition value.h:96
Value child(std::string_view field) const
「(thisの名前).(追加の名前)」を新しい名前とするField
Definition value.h:74
bool operator<=(const Value &) const =delete
const Value & operator*=(double rhs) const
Definition value.h:304
Value child(int index) const
Definition value.h:89
bool operator!=(const T &other) const
Definition value.h:387
double operator++(int) const
1足したものをsetし、足す前の値を返す
Definition value.h:349
bool operator>=(const Value &) const =delete
Value child(std::wstring_view field) const
「(thisの名前).(追加の名前)」を新しい名前とするField (wstring)
Definition value.h:81
void appendListener(T &&callback) const
Definition value.h:168
const Value & operator&=(std::int32_t rhs) const
Definition value.h:325
const Value & operator--() const
1引いたものをsetした後自身を返す
Definition value.h:358
const Value & operator-=(double rhs) const
Definition value.h:300
bool operator>(const Value &) const =delete
const Value & operator=(T &&v) const
数値または配列をセットする
Definition value.h:225
const Value & operator^=(std::int32_t rhs) const
Definition value.h:333
Value operator[](std::wstring_view field) const
Definition value.h:101
const Value & operator=(std::vector< double > v) const
vector型配列をセットする
Definition value.h:237
ValueElementRef at(std::size_t index) const
1次元配列型データの要素を参照する
Definition value.h:131
bool operator<(const Value &) const =delete
Value operator[](const char *field) const
Definition value.h:106
Value operator[](const wchar_t *field) const
Definition value.h:110
double get() const
値を返す
Definition value.h:264
Value(const Field &base, const SharedString &field)
Definition value.h:63
const Value & operator<<=(std::int32_t rhs) const
Definition value.h:316
const Value & operator++() const
1足したものをsetした後自身を返す
Definition value.h:341
std::ostream & operator<<(std::ostream &os, const Arg &arg)
Definition func_info.cc:100
const auto & get(const AxisAngle &aa)
Definition transform.h:231
ClientDataの参照とメンバ名とデータ名を持つクラス
Definition field.h:71
Field parent() const
nameの最後のピリオドの前までを新しい名前とするField
Definition field.cc:33
Field child(const SharedString &field) const
Definition field.cc:42
Definition array_like.h:58
#define WEBCFACE_DLL
Definition webcface-config.h:69
#define WEBCFACE_CALL
Definition webcface-config.h:106
#define WEBCFACE_NS_END
Definition webcface-config.h:118
#define WEBCFACE_NS_BEGIN
Definition webcface-config.h:117
#define WEBCFACE_CALL_FP
Definition webcface-config.h:107