mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-27 17:50:04 +01:00
[poincare] Fix Ghost, AllocationF an Uninitilized nodes staticNode methods
This commit is contained in:
@@ -16,8 +16,11 @@ public:
|
||||
// TreeNode
|
||||
bool isAllocationFailure() const override { return true; }
|
||||
size_t size() const override { return sizeof(AllocationFailureEvaluationNode<T, U>); }
|
||||
#if TREE_LOG
|
||||
const char * description() const override { return "AllocationFailureEvaluation"; }
|
||||
TreeNode * uninitializedStaticNode() const override { assert(false); return nullptr; }
|
||||
#if POINCARE_TREE_LOG
|
||||
virtual void logNodeName(std::ostream & stream) const override {
|
||||
stream << "AllocationFailureEvaluation";
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
// TreeNode
|
||||
size_t size() const override { return sizeof(AllocationFailureExpressionNode<T>); }
|
||||
bool isAllocationFailure() const override { return true; }
|
||||
TreeNode * uninitializedStaticNode() const override { assert(false); return nullptr; }
|
||||
#if POINCARE_TREE_LOG
|
||||
virtual void logNodeName(std::ostream & stream) const override {
|
||||
stream << "AllocationFailureExpression[";
|
||||
|
||||
@@ -10,6 +10,7 @@ class AllocationFailureLayoutNode : public ExceptionLayoutNode<T> {
|
||||
public:
|
||||
size_t size() const override { return sizeof(AllocationFailureLayoutNode<T>); }
|
||||
bool isAllocationFailure() const override { return true; }
|
||||
TreeNode * uninitializedStaticNode() const override { assert(false); return nullptr; }
|
||||
#if POINCARE_TREE_LOG
|
||||
virtual void logNodeName(std::ostream & stream) const override {
|
||||
stream << "AllocationFailureLayout";
|
||||
|
||||
@@ -22,22 +22,7 @@ public:
|
||||
static GhostNode * FailedAllocationStaticNode();
|
||||
TreeNode * failedAllocationStaticNode() override { return FailedAllocationStaticNode(); }
|
||||
// Uninitialized
|
||||
TreeNode * uninitializedStaticNode() const override;
|
||||
};
|
||||
|
||||
class UninitializedGhostNode : public GhostNode {
|
||||
public:
|
||||
static UninitializedGhostNode * UninitializedGhostStaticNode();
|
||||
|
||||
size_t size() const override { return sizeof(UninitializedGhostNode); }
|
||||
bool isUninitialized() const override { return true; }
|
||||
GhostNode * failedAllocationStaticNode() override { assert(false); return nullptr; } //TODO ?
|
||||
int numberOfChildren() const override { return 0; }
|
||||
#if POINCARE_TREE_LOG
|
||||
virtual void logNodeName(std::ostream & stream) const override {
|
||||
stream << "UninitializedGhost";
|
||||
}
|
||||
#endif
|
||||
TreeNode * uninitializedStaticNode() const override { assert(false); return nullptr; }
|
||||
};
|
||||
|
||||
class AllocationFailedGhostNode : public GhostNode {
|
||||
|
||||
@@ -16,7 +16,9 @@ public:
|
||||
static UninitializedEvaluationNode<T> * UninitializedEvaluationStaticNode();
|
||||
// TreeNode
|
||||
bool isUninitialized() const override { return true; }
|
||||
TreeNode * failedAllocationStaticNode() override { /*TODO*/ assert(false); return nullptr; /* Or call parent method ?*/ }
|
||||
/* There is only one static node, that should never be inserted in the pool,
|
||||
* so no need for an allocation failure. */
|
||||
TreeNode * failedAllocationStaticNode() override { assert(false); return nullptr; }
|
||||
size_t size() const override { return sizeof(UninitializedEvaluationNode); }
|
||||
#if POINCARE_TREE_LOG
|
||||
virtual void logNodeName(std::ostream & stream) const override {
|
||||
|
||||
@@ -26,7 +26,9 @@ public:
|
||||
|
||||
// TreeNode
|
||||
bool isUninitialized() const override { return true; }
|
||||
TreeNode * failedAllocationStaticNode() override { /*TODO*/ assert(false); return nullptr; /* Or call parent method ?*/ }
|
||||
/* There is only one static node, that should never be inserted in the pool,
|
||||
* so no need for an allocation failure. */
|
||||
TreeNode * failedAllocationStaticNode() override { assert(false); return nullptr; }
|
||||
size_t size() const override { return sizeof(UninitializedExpressionNode); }
|
||||
#if POINCARE_TREE_LOG
|
||||
virtual void logNodeName(std::ostream & stream) const override {
|
||||
|
||||
@@ -61,7 +61,9 @@ public:
|
||||
|
||||
// TreeNode
|
||||
bool isUninitialized() const override { return true; }
|
||||
TreeNode * failedAllocationStaticNode() override { /*TODO*/ assert(false); return nullptr; /* Or call parent method ?*/ }
|
||||
/* There is only one static node, that should never be inserted in the pool,
|
||||
* so no need for an allocation failure. */
|
||||
TreeNode * failedAllocationStaticNode() override { assert(false); return nullptr; }
|
||||
size_t size() const override { return sizeof(UninitializedLayoutNode); }
|
||||
#if POINCARE_TREE_LOG
|
||||
virtual void logNodeName(std::ostream & stream) const override {
|
||||
|
||||
@@ -3,20 +3,10 @@
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
TreeNode * GhostNode::uninitializedStaticNode() const {
|
||||
return UninitializedGhostNode::UninitializedGhostStaticNode();
|
||||
}
|
||||
|
||||
GhostNode * GhostNode::FailedAllocationStaticNode() {
|
||||
static AllocationFailedGhostNode failure;
|
||||
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
|
||||
return &failure;
|
||||
}
|
||||
|
||||
UninitializedGhostNode * UninitializedGhostNode::UninitializedGhostStaticNode() {
|
||||
static UninitializedGhostNode exception;
|
||||
TreePool::sharedPool()->registerStaticNodeIfRequired(&exception);
|
||||
return &exception;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user