xo-gc xo-object2 xo-facet: builds w/ ISequence,Dlist
This commit is contained in:
parent
519df04e34
commit
afc44e71fa
26 changed files with 717 additions and 75 deletions
|
|
@ -11,13 +11,23 @@ namespace xo {
|
|||
namespace scm {
|
||||
|
||||
struct DList {
|
||||
using size_type = std::size_t;
|
||||
using AGCObject = xo::mm::AGCObject;
|
||||
|
||||
DList(xo::obj<AGCObject> h,
|
||||
xo::obj<AGCObject> r) : head_{h}, rest_{r} {}
|
||||
DList * r) : head_{h}, rest_{r} {}
|
||||
|
||||
/** DList length is at least 1 **/
|
||||
bool is_empty() const noexcept { return false; };
|
||||
/** DList models a finite sequence **/
|
||||
bool is_finite() const noexcept { return true; };
|
||||
/** return number of elements in this DList **/
|
||||
size_type size() const noexcept;
|
||||
/** return element at 0-based index @p ix **/
|
||||
obj<AGCObject> at(size_type ix) const;
|
||||
|
||||
obj<AGCObject> head_;
|
||||
obj<AGCObject> rest_;
|
||||
DList * rest_ = nullptr;
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <xo/gc/Collector.hpp>
|
||||
#include <xo/alloc2/alloc/AAllocator.hpp>
|
||||
#include <xo/gc/detail/AGCObject.hpp>
|
||||
#include <xo/gc/detail/IGCObject_Xfer.hpp>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <xo/gc/Collector.hpp>
|
||||
#include "xo/alloc2/alloc/AAllocator.hpp"
|
||||
#include <xo/gc/detail/AGCObject.hpp>
|
||||
#include <xo/gc/detail/IGCObject_Xfer.hpp>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,19 @@
|
|||
#include "DList.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm { struct IGCObject_DList; }
|
||||
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject,
|
||||
xo::scm::DList>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DList,
|
||||
xo::scm::IGCObject_DList>;
|
||||
};
|
||||
}
|
||||
|
||||
namespace scm {
|
||||
/* changes here coordinate with:
|
||||
* IGCObject_XFer
|
||||
|
|
|
|||
61
xo-object2/include/xo/object2/ISequence_DList.hpp
Normal file
61
xo-object2/include/xo/object2/ISequence_DList.hpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
/** @file ISequence_DList.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/ISequence_DList.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/ISequence_DList.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Sequence.hpp"
|
||||
#include "sequence/ISequence_Xfer.hpp"
|
||||
#include "DList.hpp"
|
||||
|
||||
namespace xo { namespace scm { class ISequence_DList; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::scm::ASequence,
|
||||
xo::scm::DList>
|
||||
{
|
||||
using ImplType = xo::scm::ISequence_Xfer
|
||||
<xo::scm::DList,
|
||||
xo::scm::ISequence_DList>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class ISequence_DList
|
||||
**/
|
||||
class ISequence_DList {
|
||||
public:
|
||||
/** @defgroup scm-sequence-dlist-type-traits **/
|
||||
///@{
|
||||
using size_type = ASequence::size_type;
|
||||
using AGCObject = ASequence::AGCObject;
|
||||
///@}
|
||||
/** @defgroup scm-sequence-dlist-methods **/
|
||||
///@{
|
||||
/** true iff sequence is empty **/
|
||||
static bool is_empty(const DList & self) noexcept;
|
||||
/** true iff sequence is finite **/
|
||||
static bool is_finite(const DList & self) noexcept;
|
||||
/** return element @p index of this sequence **/
|
||||
static obj<AGCObject> at(const DList & self, size_type index);
|
||||
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
Loading…
Add table
Add a link
Reference in a new issue