xo-facet xo-object2 xo-cmake: facet tidy + build integration
This commit is contained in:
parent
9a68fb6b49
commit
04509c4bd7
7 changed files with 402 additions and 0 deletions
75
include/xo/object2/sequence/ASequence.hpp
Normal file
75
include/xo/object2/sequence/ASequence.hpp
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/** @file ASequence.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [./idl/Sequence.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [abstract_facet.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [./idl/Sequence.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
// includes (via {facet_includes})
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
#include <xo/facet/obj.hpp>
|
||||
#include <xo/facet/facet_implementation.hpp>
|
||||
#include <xo/facet/typeseq.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
||||
using Copaque = const void *;
|
||||
using Opaque = void *;
|
||||
|
||||
/**
|
||||
Elements appear in some determinstic order.
|
||||
Sequence is GC-aware --> elements must be GC-aware
|
||||
**/
|
||||
class ASequence {
|
||||
public:
|
||||
/** @defgroup scm-sequence-type-traits **/
|
||||
///@{
|
||||
// types
|
||||
/** type for length of a sequence **/
|
||||
using size_type = std::size_t;
|
||||
/** facet for types with GC support **/
|
||||
using AGCObject = xo::mm::AGCObject;
|
||||
///@}
|
||||
|
||||
/** @defgroup scm-sequence-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** RTTI: unique id# for actual runtime data representation **/
|
||||
virtual int32_t _typeseq() const noexcept = 0;
|
||||
/** true iff sequence is empty **/
|
||||
virtual bool is_empty(Copaque data) const noexcept = 0;
|
||||
/** true iff sequence is finite **/
|
||||
virtual bool is_finite(Copaque data) const noexcept = 0;
|
||||
/** return element @p index of this sequence **/
|
||||
virtual obj<AGCObject> at(Copaque data, size_type index) const = 0;
|
||||
|
||||
// nonconst methods
|
||||
///@}
|
||||
}; /*ASequence*/
|
||||
|
||||
/** Implementation ISequence_DRepr of ASequence for state DRepr
|
||||
* should provide a specialization:
|
||||
*
|
||||
* template <>
|
||||
* struct xo::facet::FacetImplementation<ASequence, DRepr> {
|
||||
* using Impltype = ISequence_DRepr;
|
||||
* };
|
||||
*
|
||||
* then ISequence_ImplType<DRepr> --> ISequence_DRepr
|
||||
**/
|
||||
template <typename DRepr>
|
||||
using ISequence_ImplType = xo::facet::FacetImplType<ASequence, DRepr>;
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* */
|
||||
87
include/xo/object2/sequence/ISequence_Any.hpp
Normal file
87
include/xo/object2/sequence/ISequence_Any.hpp
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/** @file ISequence_Any.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [./idl/Sequence.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [./idl/Sequence.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ASequence.hpp"
|
||||
#include <xo/facet/obj.hpp>
|
||||
|
||||
namespace xo { namespace scm { class ISequence_Any; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
|
||||
template <>
|
||||
struct FacetImplementation<xo::scm::ASequence,
|
||||
DVariantPlaceholder>
|
||||
{
|
||||
using ImplType = xo::scm::ISequence_Any;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
||||
/** @class ISequence_Any
|
||||
* @brief ASequence implementation for empty variant instance
|
||||
**/
|
||||
class ISequence_Any : public ASequence {
|
||||
public:
|
||||
/** @defgroup scm-sequence-any-type-traits **/
|
||||
///@{
|
||||
|
||||
using size_type = ASequence::size_type;
|
||||
using AGCObject = ASequence::AGCObject;
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-sequence-any-methods **/
|
||||
///@{
|
||||
|
||||
const ASequence * iface() const { return std::launder(this); }
|
||||
|
||||
// from ASequence
|
||||
|
||||
// const methods
|
||||
int32_t _typeseq() const noexcept override { return s_typeseq; }
|
||||
[[noreturn]] bool is_empty(Copaque) const noexcept override { _fatal(); }
|
||||
[[noreturn]] bool is_finite(Copaque) const noexcept override { _fatal(); }
|
||||
[[noreturn]] obj<AGCObject> at(Copaque, size_type) const override { _fatal(); }
|
||||
|
||||
// nonconst methods
|
||||
|
||||
///@}
|
||||
|
||||
private:
|
||||
/** @defgraoup scm-sequence-any-private-methods **/
|
||||
///@{
|
||||
|
||||
[[noreturn]] static void _fatal();
|
||||
|
||||
///@}
|
||||
|
||||
public:
|
||||
/** @defgraoup scm-sequence-any-member-vars **/
|
||||
///@{
|
||||
|
||||
static int32_t s_typeseq;
|
||||
static bool _valid;
|
||||
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm */
|
||||
} /*namespace xo */
|
||||
|
||||
/* ISequence_Any.hpp */
|
||||
85
include/xo/object2/sequence/ISequence_Xfer.hpp
Normal file
85
include/xo/object2/sequence/ISequence_Xfer.hpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/** @file ISequence_Xfer.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [./idl/Sequence.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [./idl/Sequence.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ASequence.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class ISequence_Xfer
|
||||
**/
|
||||
template <typename DRepr, typename ISequence_DRepr>
|
||||
class ISequence_Xfer : public ASequence {
|
||||
public:
|
||||
/** @defgroup scm-sequence-xfer-type-traits **/
|
||||
///@{
|
||||
using Impl = ISequence_DRepr;
|
||||
using size_type = ASequence::size_type;
|
||||
using AGCObject = ASequence::AGCObject;
|
||||
///@}
|
||||
|
||||
/** @defgroup scm-sequence-xfer-methods **/
|
||||
///@{
|
||||
|
||||
static const DRepr & _dcast(Copaque d) { return *(const DRepr *)d; }
|
||||
static DRepr & _dcast(Opaque d) { return *(DRepr *)d; }
|
||||
|
||||
// from ASequence
|
||||
|
||||
// const methods
|
||||
int32_t _typeseq() const noexcept override { return s_typeseq; }
|
||||
bool is_empty(Copaque data) const noexcept override {
|
||||
return I::is_empty(_dcast(data));
|
||||
}
|
||||
bool is_finite(Copaque data) const noexcept override {
|
||||
return I::is_finite(_dcast(data));
|
||||
}
|
||||
obj<AGCObject> at(Copaque data, size_type index) const override {
|
||||
return I::at(_dcast(data), index);
|
||||
}
|
||||
|
||||
// non-const methods
|
||||
|
||||
///@}
|
||||
|
||||
private:
|
||||
using I = Impl;
|
||||
|
||||
public:
|
||||
/** @defgraoup scm-sequence-xfer-member-vars **/
|
||||
///@{
|
||||
|
||||
/** typeseq for template parameter DRepr **/
|
||||
static int32_t s_typeseq;
|
||||
/** true iff satisfies facet implementation **/
|
||||
static bool _valid;
|
||||
|
||||
///@}
|
||||
};
|
||||
|
||||
template <typename DRepr, typename ISequence_DRepr>
|
||||
int32_t
|
||||
ISequence_Xfer<DRepr, ISequence_DRepr>::s_typeseq
|
||||
= xo::facet::typeseq::id<DRepr>();
|
||||
|
||||
template <typename DRepr, typename ISequence_DRepr>
|
||||
bool
|
||||
ISequence_Xfer<DRepr, ISequence_DRepr>::_valid
|
||||
= xo::facet::valid_facet_implementation<ASequence,
|
||||
ISequence_Xfer>();
|
||||
|
||||
} /*namespace scm */
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end ISequence_Xfer.hpp */
|
||||
85
include/xo/object2/sequence/RSequence.hpp
Normal file
85
include/xo/object2/sequence/RSequence.hpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/** @file RSequence.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [./idl/Sequence.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [./idl/Sequence.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ASequence.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
|
||||
/** @class RSequence
|
||||
**/
|
||||
template <typename Object>
|
||||
class RSequence : public Object {
|
||||
private:
|
||||
using O = Object;
|
||||
|
||||
public:
|
||||
/** @defgroup scm-sequence-router-type-traits **/
|
||||
///@{
|
||||
using ObjectType = Object;
|
||||
using DataPtr = Object::DataPtr;
|
||||
using size_type = ASequence::size_type;
|
||||
using AGCObject = ASequence::AGCObject;
|
||||
///@}
|
||||
|
||||
/** @defgroup scm-sequence-router-ctors **/
|
||||
///@{
|
||||
RSequence() {}
|
||||
RSequence(Object::DataPtr data) : Object{std::move(data)} {}
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-sequence-router-methods **/
|
||||
///@{
|
||||
|
||||
// const methods
|
||||
int32_t _typeseq() const noexcept { return O::iface()->_typeseq(); }
|
||||
bool is_empty() const noexcept override {
|
||||
return O::iface()->is_empty(O::data());
|
||||
}
|
||||
bool is_finite() const noexcept override {
|
||||
return O::iface()->is_finite(O::data());
|
||||
}
|
||||
obj<AGCObject> at(size_type index) const override {
|
||||
return O::iface()->at(O::data(), index);
|
||||
}
|
||||
|
||||
// non-const methods
|
||||
// << do something for non-const methods >>
|
||||
//
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-sequence-member-vars **/
|
||||
///@{
|
||||
|
||||
static bool _valid;
|
||||
|
||||
///@}
|
||||
};
|
||||
|
||||
template <typename Object>
|
||||
bool
|
||||
RSequence<Object>::_valid = xo::facet::valid_object_router<Object>();
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
namespace xo { namespace facet {
|
||||
template <typename Object>
|
||||
struct RoutingFor<xo::scm::ASequence, Object> {
|
||||
using RoutingType = xo::scm::RSequence<Object>;
|
||||
};
|
||||
} }
|
||||
|
||||
/* end RSequence.hpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue