// Copyright Sebastian Jeckel 2017. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef REACT_API_H_INCLUDED #define REACT_API_H_INCLUDED #pragma once #include #include #include "react/detail/defs.h" #include "react/common/utility.h" /*****************************************/ REACT_BEGIN /*****************************************/ /////////////////////////////////////////////////////////////////////////////////////////////////// /// API constants /////////////////////////////////////////////////////////////////////////////////////////////////// enum class WeightHint { automatic, light, heavy }; enum class TransactionFlags { none = 0, allow_merging = 1 << 1, sync_linked = 1 << 2 }; REACT_DEFINE_BITMASK_OPERATORS(TransactionFlags) enum class Token { value }; enum class InPlaceTag { value = 1 }; static constexpr InPlaceTag in_place = InPlaceTag::value; /////////////////////////////////////////////////////////////////////////////////////////////////// /// API types /////////////////////////////////////////////////////////////////////////////////////////////////// // Group class Group; // Ref template using Ref = std::reference_wrapper; // State template class State; template class StateVar; template class StateSlot; template class StateLink; template using StateRef = State>; // Event enum class Token; template class Event; template class EventSource; template class EventSlot; template using EventValueList = std::vector; template using EventValueSink = std::back_insert_iterator>; // Observer class Observer; template bool HasChanged(const T& a, const T& b) { return !(a == b); } template bool HasChanged(const Ref& a, const Ref& b) { return true; } template void ListInsert(T& list, V&& value) { list.push_back(std::forward(value)); } template void MapInsert(T& map, V&& value) { map.insert(std::forward(value)); } /******************************************/ REACT_END /******************************************/ #endif // REACT_API_H_INCLUDED