xo-object2: + ISequence_DArray + codegen
This commit is contained in:
parent
2d58d22a72
commit
88cf3aba0d
6 changed files with 138 additions and 0 deletions
|
|
@ -136,6 +136,18 @@ xo_add_genfacetimpl(
|
||||||
OUTPUT_CPP_DIR src/object2
|
OUTPUT_CPP_DIR src/object2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# note: manual target; generated code committed to git
|
||||||
|
xo_add_genfacetimpl(
|
||||||
|
TARGET xo-object2-facetimpl-sequence-array
|
||||||
|
FACET_PKG xo_object2
|
||||||
|
FACET Sequence
|
||||||
|
REPR Array
|
||||||
|
INPUT idl/ISequence_DArray.json5
|
||||||
|
OUTPUT_HPP_DIR include/xo/object2
|
||||||
|
OUTPUT_IMPL_SUBDIR array
|
||||||
|
OUTPUT_CPP_DIR src/object2
|
||||||
|
)
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
# must complete definition of expression lib before configuring examples
|
# must complete definition of expression lib before configuring examples
|
||||||
|
|
|
||||||
12
xo-object2/idl/ISequence_DArray.json5
Normal file
12
xo-object2/idl/ISequence_DArray.json5
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
mode: "implementation",
|
||||||
|
includes: [ ],
|
||||||
|
local_types: [ ],
|
||||||
|
namespace1: "xo",
|
||||||
|
namespace2: "scm",
|
||||||
|
facet_idl: "idl/Sequence.json5",
|
||||||
|
brief: "provide ASequence interface for DArray state",
|
||||||
|
using_doxygen: true,
|
||||||
|
repr: "DArray",
|
||||||
|
doc: [ "implement ASequence for DArray" ],
|
||||||
|
}
|
||||||
64
xo-object2/include/xo/object2/array/ISequence_DArray.hpp
Normal file
64
xo-object2/include/xo/object2/array/ISequence_DArray.hpp
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
/** @file ISequence_DArray.hpp
|
||||||
|
*
|
||||||
|
* Generated automagically from ingredients:
|
||||||
|
* 1. code generator:
|
||||||
|
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
|
||||||
|
* arguments:
|
||||||
|
* --input [idl/ISequence_DArray.json5]
|
||||||
|
* 2. jinja2 template for abstract facet .hpp file:
|
||||||
|
* [iface_facet_repr.hpp.j2]
|
||||||
|
* 3. idl for facet methods
|
||||||
|
* [idl/ISequence_DArray.json5]
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Sequence.hpp"
|
||||||
|
#include "DArray.hpp"
|
||||||
|
|
||||||
|
namespace xo { namespace scm { class ISequence_DArray; } }
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace facet {
|
||||||
|
template <>
|
||||||
|
struct FacetImplementation<xo::scm::ASequence,
|
||||||
|
xo::scm::DArray>
|
||||||
|
{
|
||||||
|
using ImplType = xo::scm::ISequence_Xfer
|
||||||
|
<xo::scm::DArray,
|
||||||
|
xo::scm::ISequence_DArray>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
/** @class ISequence_DArray
|
||||||
|
**/
|
||||||
|
class ISequence_DArray {
|
||||||
|
public:
|
||||||
|
/** @defgroup scm-sequence-darray-type-traits **/
|
||||||
|
///@{
|
||||||
|
using size_type = xo::scm::ASequence::size_type;
|
||||||
|
using AGCObject = xo::scm::ASequence::AGCObject;
|
||||||
|
using Copaque = xo::scm::ASequence::Copaque;
|
||||||
|
using Opaque = xo::scm::ASequence::Opaque;
|
||||||
|
///@}
|
||||||
|
/** @defgroup scm-sequence-darray-methods **/
|
||||||
|
///@{
|
||||||
|
// const methods
|
||||||
|
/** true iff sequence is empty **/
|
||||||
|
static bool is_empty(const DArray & self) noexcept;
|
||||||
|
/** true iff sequence is finite **/
|
||||||
|
static bool is_finite(const DArray & self) noexcept;
|
||||||
|
/** return element @p index of this sequence **/
|
||||||
|
static obj<AGCObject> at(const DArray & self, size_type index);
|
||||||
|
|
||||||
|
// non-const methods
|
||||||
|
///@}
|
||||||
|
};
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end */
|
||||||
|
|
@ -7,6 +7,7 @@ set(SELF_SRCS
|
||||||
IGCObject_DList.cpp
|
IGCObject_DList.cpp
|
||||||
IGCObject_DString.cpp
|
IGCObject_DString.cpp
|
||||||
ISequence_Any.cpp
|
ISequence_Any.cpp
|
||||||
|
ISequence_DArray.cpp
|
||||||
ISequence_DList.cpp
|
ISequence_DList.cpp
|
||||||
IPrintable_DList.cpp
|
IPrintable_DList.cpp
|
||||||
IPrintable_DFloat.cpp
|
IPrintable_DFloat.cpp
|
||||||
|
|
|
||||||
40
xo-object2/src/object2/ISequence_DArray.cpp
Normal file
40
xo-object2/src/object2/ISequence_DArray.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
/** @file ISequence_DArray.cpp
|
||||||
|
*
|
||||||
|
* Generated automagically from ingredients:
|
||||||
|
* 1. code generator:
|
||||||
|
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
|
||||||
|
* arguments:
|
||||||
|
* --input [idl/ISequence_DArray.json5]
|
||||||
|
* 2. jinja2 template for abstract facet .hpp file:
|
||||||
|
* [iface_facet_any.hpp.j2]
|
||||||
|
* 3. idl for facet methods
|
||||||
|
* [idl/ISequence_DArray.json5]
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "array/ISequence_DArray.hpp"
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
auto
|
||||||
|
ISequence_DArray::is_empty(const DArray & self) noexcept -> bool
|
||||||
|
{
|
||||||
|
return self.is_empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
ISequence_DArray::is_finite(const DArray & self) noexcept -> bool
|
||||||
|
{
|
||||||
|
return self.is_finite();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
ISequence_DArray::at(const DArray & self, size_type index) -> obj<AGCObject>
|
||||||
|
{
|
||||||
|
return self.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end ISequence_DArray.cpp */
|
||||||
|
|
@ -15,6 +15,9 @@
|
||||||
#include <xo/object2/number/IPrintable_DInteger.hpp>
|
#include <xo/object2/number/IPrintable_DInteger.hpp>
|
||||||
#include <xo/object2/string/IPrintable_DString.hpp>
|
#include <xo/object2/string/IPrintable_DString.hpp>
|
||||||
|
|
||||||
|
#include <xo/object2/list/ISequence_DList.hpp>
|
||||||
|
#include <xo/object2/array/ISequence_DArray.hpp>
|
||||||
|
|
||||||
#include <xo/printable2/detail/APrintable.hpp>
|
#include <xo/printable2/detail/APrintable.hpp>
|
||||||
#include <xo/alloc2/alloc/AAllocator.hpp>
|
#include <xo/alloc2/alloc/AAllocator.hpp>
|
||||||
#include <xo/facet/FacetRegistry.hpp>
|
#include <xo/facet/FacetRegistry.hpp>
|
||||||
|
|
@ -27,6 +30,7 @@ namespace xo {
|
||||||
using xo::scm::DList;
|
using xo::scm::DList;
|
||||||
using xo::scm::DFloat;
|
using xo::scm::DFloat;
|
||||||
using xo::scm::DString;
|
using xo::scm::DString;
|
||||||
|
using xo::scm::DArray;
|
||||||
using xo::facet::FacetRegistry;
|
using xo::facet::FacetRegistry;
|
||||||
using xo::facet::typeseq;
|
using xo::facet::typeseq;
|
||||||
|
|
||||||
|
|
@ -38,6 +42,7 @@ namespace xo {
|
||||||
|
|
||||||
FacetRegistry::register_impl<AGCObject, DList>();
|
FacetRegistry::register_impl<AGCObject, DList>();
|
||||||
FacetRegistry::register_impl<APrintable, DList>();
|
FacetRegistry::register_impl<APrintable, DList>();
|
||||||
|
FacetRegistry::register_impl<ASequence, DList>();
|
||||||
|
|
||||||
FacetRegistry::register_impl<AGCObject, DFloat>();
|
FacetRegistry::register_impl<AGCObject, DFloat>();
|
||||||
FacetRegistry::register_impl<APrintable, DFloat>();
|
FacetRegistry::register_impl<APrintable, DFloat>();
|
||||||
|
|
@ -48,14 +53,18 @@ namespace xo {
|
||||||
FacetRegistry::register_impl<AGCObject, DString>();
|
FacetRegistry::register_impl<AGCObject, DString>();
|
||||||
FacetRegistry::register_impl<APrintable, DString>();
|
FacetRegistry::register_impl<APrintable, DString>();
|
||||||
|
|
||||||
|
FacetRegistry::register_impl<ASequence, DArray>();
|
||||||
|
|
||||||
log && log(xtag("DList.tseq", typeseq::id<DList>()));
|
log && log(xtag("DList.tseq", typeseq::id<DList>()));
|
||||||
log && log(xtag("DFloat.tseq", typeseq::id<DFloat>()));
|
log && log(xtag("DFloat.tseq", typeseq::id<DFloat>()));
|
||||||
log && log(xtag("DInteger.tseq", typeseq::id<DInteger>()));
|
log && log(xtag("DInteger.tseq", typeseq::id<DInteger>()));
|
||||||
log && log(xtag("DString.tseq", typeseq::id<DString>()));
|
log && log(xtag("DString.tseq", typeseq::id<DString>()));
|
||||||
|
log && log(xtag("DArray.tseq", typeseq::id<DArray>()));
|
||||||
|
|
||||||
log && log(xtag("AAllocator.tseq", typeseq::id<AAllocator>()));
|
log && log(xtag("AAllocator.tseq", typeseq::id<AAllocator>()));
|
||||||
log && log(xtag("APrintable.tseq", typeseq::id<APrintable>()));
|
log && log(xtag("APrintable.tseq", typeseq::id<APrintable>()));
|
||||||
log && log(xtag("AGCObject.tseq", typeseq::id<AGCObject>()));
|
log && log(xtag("AGCObject.tseq", typeseq::id<AGCObject>()));
|
||||||
|
log && log(xtag("ASequence.tseq", typeseq::id<ASequence>()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue