69 lines
1.4 KiB
C++
69 lines
1.4 KiB
C++
/*
|
|
* IValueAsync.hpp
|
|
*
|
|
* Created on: 6 äåê. 2019 ã.
|
|
* Author: titov
|
|
*/
|
|
|
|
#ifndef SOURCE_SYSTEMIC_IVALUEASYNC_HPP_
|
|
#define SOURCE_SYSTEMIC_IVALUEASYNC_HPP_
|
|
|
|
namespace systemic {
|
|
|
|
//!Èíòåðôåéñ óñòàíîâêè çíà÷åíèÿ.
|
|
template<typename T>
|
|
struct IValueTypeSet {
|
|
|
|
typedef T TypeInput;
|
|
|
|
virtual void set( T ) = 0;
|
|
// virtual ~IValueTypeSet() = default;
|
|
};
|
|
|
|
template<typename T>
|
|
struct IValueTypeGet {
|
|
typedef T TypeOutput;
|
|
|
|
virtual T get() const = 0;
|
|
|
|
// virtual ~IValueTypeGet() = default;
|
|
|
|
};
|
|
|
|
template<typename T>
|
|
struct IValueTypeOutput {
|
|
typedef T TypeSet;
|
|
typedef IValueTypeSet<TypeSet> SetInterface;
|
|
|
|
virtual void set_output( SetInterface * ) = 0;
|
|
// virtual ~IValueTypeOutput() = default;
|
|
};
|
|
|
|
template<typename ValueType>
|
|
struct IValueType : public systemic::IValueTypeSet<ValueType>, public systemic::IValueTypeGet<ValueType> {
|
|
virtual void set( ValueType ) = 0;
|
|
virtual ValueType get() const = 0;
|
|
|
|
//virtual ~IValueType() = default;
|
|
};
|
|
|
|
template<typename ValueType>
|
|
struct IValueTransform {
|
|
virtual ValueType operator()( ValueType ) = 0;
|
|
};
|
|
|
|
template<typename ValueType>
|
|
struct BaseValue : public IValueType<ValueType> {
|
|
|
|
void set( ValueType new_value ) { value = new_value; }
|
|
ValueType get() const { return value; }
|
|
|
|
ValueType & value;
|
|
|
|
BaseValue( ValueType & value ) : value(value) {}
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* SOURCE_SYSTEMIC_IVALUEASYNC_HPP_ */
|