lumiera_documentation/src/lib/nocopy.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

120 lines
3.8 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.

/*
NOCOPY.hpp - some flavours of non-copyable entities
Copyright (C)
2012, 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 nocopy.hpp
** Mix-Ins to allow or prohibit various degrees of copying and cloning.
** Whenever a class is conceived as entity with a well-defined "identity",
** or whenever a service has to manage resources, we consider it good practice
** to define it by default as "non copyable". This rules out a lot of complexities
** with mutable state and confusion regarding equality.
** @remark inspired by [Boost-Noncopyable]
**
** [Boost-Noncopyable]: http://www.boost.org/doc/libs/1_55_0/libs/utility/utility.htm#Class_noncopyable
*/
#ifndef LIB_NOCOPY_H
#define LIB_NOCOPY_H
namespace util {
/**
* Any copy and copy construction prohibited
*/
class NonCopyable
{
protected:
~NonCopyable() = default;
NonCopyable() = default;
NonCopyable (NonCopyable const&) = delete;
NonCopyable& operator= (NonCopyable const&) = delete;
};
/**
* Types marked with this mix-in may be moved but not copied
*/
class MoveOnly
{
protected:
~MoveOnly() = default;
MoveOnly() = default;
MoveOnly (MoveOnly&&) = default;
MoveOnly (MoveOnly const&) = delete;
MoveOnly& operator= (MoveOnly&&) = delete;
MoveOnly& operator= (MoveOnly const&) = delete;
};
/**
* Types marked with this mix-in may be moved and move-assigned
*/
class MoveAssign
{
protected:
~MoveAssign() = default;
MoveAssign() = default;
MoveAssign (MoveAssign&&) = default;
MoveAssign (MoveAssign const&) = delete;
MoveAssign& operator= (MoveAssign&&) = default;
MoveAssign& operator= (MoveAssign const&) = delete;
};
/**
* Types marked with this mix-in may be created and moved
* liberally at construction, while any further assignment
* to object instances is prohibited thereafter.
*/
class NonAssign
{
protected:
~NonAssign() = default;
NonAssign() = default;
NonAssign (NonAssign&&) = default;
NonAssign (NonAssign const&) = default;
NonAssign& operator= (NonAssign&&) = delete;
NonAssign& operator= (NonAssign const&) = delete;
};
/**
* Types marked with this mix-in may be duplicated
* by copy-construction, yet may not be moved or
* transferred any further after creation.
*/
class Cloneable
{
protected:
~Cloneable() = default;
Cloneable() = default;
Cloneable (Cloneable&&) = delete;
Cloneable (Cloneable const&) = default;
Cloneable& operator= (Cloneable&&) = delete;
Cloneable& operator= (Cloneable const&) = delete;
};
/**
* Not meant to be instantiated in any way.
* Types marked this way are typically used for metaprogramming
* or expose static factory methods to some related sibling
* based on a template parameter or similar configuration.
*/
class NoInstance
{
protected:
NoInstance() = delete;
};
} // namespace util
#endif /*LIB_NOCOPY_H*/