InputContext class
#include <gtopt/input_context.hpp>
Base classes
-
template<typename SystemLP_class ElementContext<SystemLP>
Type SystemLP_Type> - Provides a context for interacting with elements within a SystemLP.
- struct InputTraits
- Input data access traits.
Public types
-
template<typename... Uid>using array_table_vector_uid_idx_t = std::tuple<array_
uid_ idx_ map_ t<Uid...>, table_ uid_ idx_ map_ t<Uid...>, vector_ uid_ idx_ t<Uid...>> -
template<typename... Uid>using array_uid_idx_map_t = base_
map_ t<CFNameUid, arrow_ array_ uid_ idx_ t<Uid...>> -
template<typename... Uid>using array_vector_uid_idx_v = std::variant<arrow_
array_ uid_ idx_ t<Uid...>, vector_ uid_ idx_ t<Uid...>> -
template<typename... Uid>using arrow_array_uid_idx_t = std::pair<ArrowChunkedArray, ArrowUidIdx<Uid...>>
-
template<typename... Uid>using arrow_table_uid_idx_t = std::tuple<ArrowTable, ArrowUidIdx<Uid...>>
-
template<typename... Uid>using ArrowUidIdx = UidToArrowIdx<Uid...>::UidIdx
-
using base_map_t = gtopt::
flat_map<Key, Value> - using CFName = std::tuple<ClassNameType, FieldNameType>
- using CFNameUid = std::tuple<ClassNameType, FieldNameType, Uid>
- using ClassNameType = std::string_view
- using FieldNameType = std::string_view
-
template<typename... Uid>using idx_key_t = UidToVectorIdx<Uid...>::IndexKey
-
template<typename value_type, typename... Uid>using idx_vector_t = mvector_
traits<value_type, idx_ key_ t<Uid...>>::vector_type -
template<typename... Uid>using table_uid_idx_map_t = base_
map_ t<CFName, arrow_ table_ uid_ idx_ t<Uid...>> -
template<typename... Uid>using vector_uid_idx_t = VectorUidIdx<Uid...>
-
template<typename... Uid>using VectorUidIdx = UidToVectorIdx<Uid...>::UidIdx
Public static functions
-
template<typename Type, typename RType RType = Type, typename FSched, typename UidIdx, typename AccessOper AccessOper, typename... Uid>static auto access_sched(const FSched& sched, const UidIdx& uid_idx, AccessOper access_oper, Uid... uid) -> RType -> constexpr auto
- static auto at_sched(const FSched& sched, const UidIdx& uid_idx, Uid... uid) -> Type -> constexpr auto
- static auto optval_sched(const FSched& sched, const UidIdx& uid_idx, Uid... uid) -> std::optional< Type > -> constexpr auto
Constructors, destructors, conversion operators
- InputContext(const SystemContext& system_context) explicit
Public functions
- auto add_element(Element&& element) -> auto
- Adds a new element to the system.
- auto element(const Id<Element>& id) const -> constexpr auto&&
- Gets a reference to an element by its ID.
- auto element_index(const Id<Element>& id) const -> constexpr auto
- Gets the index of an element by its ID.
- auto element_index(const ObjectSingleId<Element>& id) const -> ElementIndex< Element > -> auto
- auto elements() const -> constexpr auto&& noexcept
- Gets a container of all elements of a specific type.
- auto get_array_index(const FSched& sched, std::string_view cname, const Id& id) const -> auto
- auto make_element_index(this Self&& self, const Object& objori, const std::variant<Uid, Name, Attrs>& element_var) -> ElementIndex< Element > -> auto
- Finds an existing element's index or creates a new one.
- auto system_context() const -> constexpr auto&&
- auto system_lp(this auto& self) -> constexpr SystemLP& noexcept
- Gets the underlying SystemLP object.
- auto system_lp(this const auto& self) -> constexpr const SystemLP& noexcept
Typedef documentation
#include <gtopt/uid_traits.hpp>
template<typename... Uid>
using gtopt:: InputContext:: array_table_vector_uid_idx_t = std::tuple<array_ uid_ idx_ map_ t<Uid...>, table_ uid_ idx_ map_ t<Uid...>, vector_ uid_ idx_ t<Uid...>>
#include <gtopt/uid_traits.hpp>
template<typename... Uid>
using gtopt:: InputContext:: array_uid_idx_map_t = base_ map_ t<CFNameUid, arrow_ array_ uid_ idx_ t<Uid...>>
#include <gtopt/uid_traits.hpp>
template<typename... Uid>
using gtopt:: InputContext:: array_vector_uid_idx_v = std::variant<arrow_ array_ uid_ idx_ t<Uid...>, vector_ uid_ idx_ t<Uid...>>
#include <gtopt/uid_traits.hpp>
template<typename... Uid>
using gtopt:: InputContext:: arrow_array_uid_idx_t = std::pair<ArrowChunkedArray, ArrowUidIdx<Uid...>>
#include <gtopt/uid_traits.hpp>
template<typename... Uid>
using gtopt:: InputContext:: arrow_table_uid_idx_t = std::tuple<ArrowTable, ArrowUidIdx<Uid...>>
#include <gtopt/uid_traits.hpp>
template<typename... Uid>
using gtopt:: InputContext:: ArrowUidIdx = UidToArrowIdx<Uid...>::UidIdx
#include <gtopt/uid_traits.hpp>
using gtopt:: InputContext:: base_map_t = gtopt:: flat_map<Key, Value>
using gtopt:: InputContext:: CFName = std::tuple<ClassNameType, FieldNameType>
#include <gtopt/uid_traits.hpp>
using gtopt:: InputContext:: CFNameUid = std::tuple<ClassNameType, FieldNameType, Uid>
#include <gtopt/uid_traits.hpp>
using gtopt:: InputContext:: ClassNameType = std::string_view
#include <gtopt/uid_traits.hpp>
using gtopt:: InputContext:: FieldNameType = std::string_view
#include <gtopt/uid_traits.hpp>
#include <gtopt/uid_traits.hpp>
template<typename... Uid>
using gtopt:: InputContext:: idx_key_t = UidToVectorIdx<Uid...>::IndexKey
#include <gtopt/uid_traits.hpp>
template<typename value_type, typename... Uid>
using gtopt:: InputContext:: idx_vector_t = mvector_ traits<value_type, idx_ key_ t<Uid...>>::vector_type
#include <gtopt/uid_traits.hpp>
template<typename... Uid>
using gtopt:: InputContext:: table_uid_idx_map_t = base_ map_ t<CFName, arrow_ table_ uid_ idx_ t<Uid...>>
#include <gtopt/uid_traits.hpp>
template<typename... Uid>
using gtopt:: InputContext:: vector_uid_idx_t = VectorUidIdx<Uid...>
#include <gtopt/uid_traits.hpp>
template<typename... Uid>
using gtopt:: InputContext:: VectorUidIdx = UidToVectorIdx<Uid...>::UidIdx
Function documentation
#include <gtopt/input_traits.hpp>
template<typename Type, typename RType RType = Type, typename FSched, typename UidIdx, typename AccessOper AccessOper, typename... Uid>
static constexpr auto gtopt:: InputContext:: access_sched(const FSched& sched,
const UidIdx& uid_idx,
AccessOper access_oper,
Uid... uid) -> RType
#include <gtopt/input_traits.hpp>
static constexpr auto gtopt:: InputContext:: optval_sched(const FSched& sched,
const UidIdx& uid_idx,
Uid... uid) -> std::optional< Type >
auto gtopt:: InputContext:: add_element(Element&& element)
#include <gtopt/element_context.hpp>
Adds a new element to the system.
| Parameters | |
|---|---|
| element | The element to add (rvalue reference). |
| Returns | The ElementIndex of the newly added element. |
constexpr auto gtopt:: InputContext:: element_index(const Id<Element>& id) const
#include <gtopt/element_context.hpp>
Gets the index of an element by its ID.
| Parameters | |
|---|---|
| id | The ID of the element. |
| Returns | The ElementIndex for the given ID. |
| Exceptions | |
| std::out_of_range | if the element is not found. |
constexpr auto&& gtopt:: InputContext:: elements() const noexcept
#include <gtopt/element_context.hpp>
Gets a container of all elements of a specific type.
| Returns | A const reference to the container of elements. |
|---|
auto gtopt:: InputContext:: make_element_index(this Self&& self,
const Object& objori,
const std::variant<Uid, Name, Attrs>& element_var) -> ElementIndex< Element >
#include <gtopt/element_context.hpp>
Finds an existing element's index or creates a new one.
| Parameters | |
|---|---|
| self | The ElementContext instance. |
| objori | The original object with base data. |
| element_var | A variant holding either a Uid, a Name, or Attrs. |
| Returns | ElementIndex of the found or created element. |
This function attempts to find an element by Uid or Name. If not found, it creates a new element using the provided attributes and original object data.