From 24d02815c1b403b26efc41a601c5e2a3eb22ee28 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adam=20Wardy=C5=84ski?= <no@email>
Date: Thu, 4 Nov 2010 19:28:32 +0100
Subject: [PATCH] Predicate, an abstract base class for operators that return
 Bool

---
 libwccl/ops/predicate.cpp |  9 +++++++++
 libwccl/ops/predicate.h   | 30 ++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 libwccl/ops/predicate.cpp
 create mode 100644 libwccl/ops/predicate.h

diff --git a/libwccl/ops/predicate.cpp b/libwccl/ops/predicate.cpp
new file mode 100644
index 0000000..66b0fb2
--- /dev/null
+++ b/libwccl/ops/predicate.cpp
@@ -0,0 +1,9 @@
+#include <libwccl/ops/predicate.h>
+
+namespace Wccl {
+
+const boost::scoped_ptr< Constant<Bool> > Predicate::True(new Constant<Bool>(Bool(true)));
+
+const boost::scoped_ptr< Constant<Bool> > Predicate::False(new Constant<Bool>(Bool(false)));
+
+} /* end ns Wccl */
diff --git a/libwccl/ops/predicate.h b/libwccl/ops/predicate.h
new file mode 100644
index 0000000..3c34e6b
--- /dev/null
+++ b/libwccl/ops/predicate.h
@@ -0,0 +1,30 @@
+#ifndef PREDICATE_H
+#define PREDICATE_H
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include <libwccl/values/bool.h>
+#include <libwccl/ops/functions.h>
+#include <libwccl/ops/constant.h>
+
+namespace Wccl {
+
+/**
+ * Abstract base class for Predicates (operators returning Bool)
+ */
+class Predicate : public Function<Bool> {
+public:
+	/**
+	 * Constant<Bool> holding true value, to use by predicates when returning value
+	 */
+	static const boost::scoped_ptr< Constant<Bool> > True;
+	/**
+	 * Constant<Bool> holding false value, to use by predicates when returning value
+	 */
+	static const boost::scoped_ptr< Constant<Bool> > False;
+};
+
+} /* end ns Wccl */
+
+#endif // PREDICATE_H
-- 
GitLab