lumiera_documentation/src/lib/hetero-data.hpp
Ichthyostega 8069c874f1 Invocation: develop a concept for handling parameter data
...as part of the rendering process, executed on top of the
low-level-model (Render Node network) as conceived thus far.

Parameter handling could be ''encoded'' into render nodes altogether,
or, at the other extreme, an explicit parameter handling could be specified
as part of the Render Node execution. As both extremes will lead to some
unfavourable consequences, I am aiming at a middle ground: largely, the
''automation computation'' will be encoded and hidden within the network,
implying that this topic remains to be addressed as part of defining
the Builder semantics and implementation. Yet in part the required
processing structure can be foreseen at an abstract level, and thus
the essential primitive operations are specified explicitly as part
of the Render Node definition. Notably the ''standard Weaving Pattern''
will include a ''parameter tuple'' into each `FeedManifold` and require
a binding function, which accepts this tuple as first argument.

Moreover — at implementation level, a library facility must be provided
to support handling of ''arbitrary heterogeneous data values'' embedded
directly into stack frame memory, together with a type-safe compile-time
overlay, which allows the builder to embed specific ''accessor handles''
into functor bindings, even while the actual storage location is not
yet known at that time (obviously, as being located on the stack).

__Note__: a recurring topic is how to return descriptor objects from builder functions; for this purpose, I am adjusting the semantics of `lib/nocopy.hpp` to be more specific...
2024-12-09 22:10:11 +01:00

94 lines
2.7 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
HETERO-DATA.hpp - handle chain of heterogeneous data blocks
Copyright (C)
2024, Hermann Vosseler <Ichthyostega@web.de>
  **Lumiera** is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License, or (at your
  option) any later version. See the file COPYING for further details.
*/
/** @file hetero-data.hpp
** Maintain a chained sequence of heterogeneous data blocks without allocation.
** This building block for low-level memory management allows to build up a collection
** of entirely arbitrary data placed into existing and possibly distributed storage.
** The safety of storage and lifetime must be ensured by other means, since data access
** proceeds without further bound checks. However, a type-safe compile-time overlay of
** accessor marker types is provided, allowing to integrate such a storage layout into
** an overall memory safe arrangement.
**
** A usage scenario would be gradually to build up an assortment of data elements directly
** in local automatic storage within an elaborate recursive call stack unfolding recursively.
** Notably the accessor marker types can be assembled independently from the provision of
** actual storage, as the connection between accessor and actual storage address is
** _established late,_ on actual _data access._ Obviously, data access in such an arrangement
** requires traversal in several steps, which, on the other hand, can be justified by a good
** cache locality of recently used stack frames, thereby avoiding heap allocations altogether.
**
** @todo WIP-WIP this is the draft of a design sketch regarding the render node network,
** which seems to be still pretty much in flux as of 12/2024
** @see HeteroData_test
** @see steam::engine::TurnoutSystem (use case)
**
*/
#ifndef LIB_HETERO_DATA_H
#define LIB_HETERO_DATA_H
//#include "lib/error.hpp"
//#include "lib/symbol.hpp"
#include "lib/nocopy.hpp"
#include "lib/linked-elements.hpp"
#include "lib/meta/typelist.hpp"
//#include <algorithm>
//#include <vector>
namespace lib {
struct StorageLoc
{
StorageLoc* next{nullptr};
};
template<typename...DATA>
struct StorageFrame
: StorageLoc
, std::tuple<DATA...>
{
};
/**
*/
template<class SPEC>
class HeteroData
{
};
template<class TAIL, typename...DATA>
class HeteroData<meta::Node<StorageFrame<DATA...>,TAIL>>
: protected StorageFrame<DATA...>
{
public:
size_t constexpr size();
template<size_t slot>
struct Navigator
{
};
};
} // namespace lib
#endif /*LIB_HETERO_DATA_H*/