summaryrefslogtreecommitdiffstats
path: root/src/include/usr/targeting/predicates/predicatectm.H
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2011-08-16 12:40:36 -0500
committerNicholas E. Bofferding <bofferdn@us.ibm.com>2011-08-23 14:10:24 -0500
commit213b45cd7d8b0367f85ee68b79941f6d548c1e9c (patch)
tree8f78e3999420f6b1b2ca00ccb79f88cf54441d5c /src/include/usr/targeting/predicates/predicatectm.H
parent91b39e52483cc5a8cc1cb7c7d15c281a150d9572 (diff)
downloadtalos-hostboot-213b45cd7d8b0367f85ee68b79941f6d548c1e9c.tar.gz
talos-hostboot-213b45cd7d8b0367f85ee68b79941f6d548c1e9c.zip
Add target iterator and predicate support
Change-Id: I728bb312277591d81c0575e74878fba9f816b962 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/260 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
Diffstat (limited to 'src/include/usr/targeting/predicates/predicatectm.H')
-rw-r--r--src/include/usr/targeting/predicates/predicatectm.H118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/include/usr/targeting/predicates/predicatectm.H b/src/include/usr/targeting/predicates/predicatectm.H
new file mode 100644
index 000000000..760f0d02d
--- /dev/null
+++ b/src/include/usr/targeting/predicates/predicatectm.H
@@ -0,0 +1,118 @@
+
+#ifndef TARG_PREDICATECTM_H
+#define TARG_PREDICATECTM_H
+
+/**
+ * @file predicatectm.H
+ *
+ * @brief Interface for a predicate which fiters a target based on its class,
+ * type, and model.
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// STD
+
+// Other Host Boot Components
+
+// Targeting Component
+#include <targeting/target.H>
+#include <targeting/attributeenums.H>
+#include <targeting/predicates/predicatebase.H>
+
+//******************************************************************************
+// Macros
+//******************************************************************************
+
+#undef TARG_NAMESPACE
+#undef TARG_CLASS
+#undef TARG_FN
+
+//******************************************************************************
+// Interface
+//******************************************************************************
+
+namespace TARGETING
+{
+
+#define TARG_NAMESPACE "TARGETING::"
+#define TARG_CLASS "PredicateCTM::"
+
+class Target;
+
+/**
+ * @brief Predicate class which filters a target based on its class, type,
+ * and model
+ */
+class PredicateCTM : public PredicateBase
+{
+ public:
+
+ /**
+ * @brief Create a target class, type, model predicate
+ *
+ * @param[in] i_class Class of matching target, default NA (any)
+ * @param[in] i_type Type of matching target, default NA (any)
+ * @param[in] i_model Model of matching target, default NA (any)
+ */
+ PredicateCTM(
+ CLASS i_class = CLASS_NA,
+ TYPE i_type = TYPE_NA,
+ MODEL i_model = MODEL_NA);
+
+ /**
+ * @brief Destroy a class, type, model predicate
+ */
+ virtual ~PredicateCTM()
+ {
+ #define TARG_FUNC "~PredicateCTM()"
+ #undef TARG_FUNC
+ }
+
+ /**
+ * @brief Returns whether target matches the specified class, type,
+ * model
+ *
+ * @par Detailed Description:
+ * Returns whether target matches the specified class, type, model.
+ * Note that all three fields are always compared, so wildcards
+ * (CLASS_NA, TYPE_NA, MODEL_NA) must be used for any fields that
+ * do not matter. See PredicateBase class for parameter/return
+ * description.
+ */
+ virtual bool operator()(
+ const Target* i_pTarget) const;
+
+ private:
+
+ CLASS iv_class; ///< Class to compare with that of target
+ TYPE iv_type; ///< Type to compare with that of target
+ MODEL iv_model; ///< Model to compare with that of target
+
+ TARG_DISABLE_COPY_AND_ASSIGNMENT_OPERATORS(PredicateCTM);
+};
+
+//******************************************************************************
+// PredicateCTM::PredicateCTM
+//******************************************************************************
+
+inline PredicateCTM::PredicateCTM(
+ const CLASS i_class,
+ const TYPE i_type,
+ const MODEL i_model)
+: iv_class(i_class),
+ iv_type(i_type),
+ iv_model(i_model)
+{
+ #define TARG_FUNC "PredicateCTM(...)"
+ #undef TARG_FUNC
+}
+
+#undef TARG_CLASS
+#undef TARG_NAMESPACE
+
+} // End namespace TARGETING
+
+#endif // TARG_PREDICATECTM_H
OpenPOWER on IntegriCloud