diff options
Diffstat (limited to 'src/include/usr/targeting/common')
3 files changed, 119 insertions, 5 deletions
diff --git a/src/include/usr/targeting/common/predicates/predicateisnonfunctional.H b/src/include/usr/targeting/common/predicates/predicateisnonfunctional.H new file mode 100644 index 000000000..86b754741 --- /dev/null +++ b/src/include/usr/targeting/common/predicates/predicateisnonfunctional.H @@ -0,0 +1,111 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/targeting/common/predicates/predicateisnonfunctional.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef __TARGETING_COMMON_PREDICATEISNONFUNCTIONAL_H +#define __TARGETING_COMMON_PREDICATEISNONFUNCTIONAL_H +/** + * @file targeting/common/predicates/predicateisnonfunctional.H + * + * PredicateIsNonFunctional class, used to filter targets for HWP wrapper. + * From the example tutorial page at + * https://w3-connections.ibm.com/wikis/home?lang=en_US#/wiki/Host%20Boot/page/Target%20And%20Attribute%20Usage%20Guide + * : + * Create Custom Predicate + * Take the following predicate "template" and customize to your needs. + * Make sure to: + * 1) Rename the class in the appropriate places + * 2) Implement the operator() function which should return "true" if + * the given Target matches the predicate criteria, false otherwise + * 3) Add any input arguments to the constructor, and any necessary + * private variables to store state + * 4) Implement the destructor, if needed + * 5) Update documentation + * + * See example in src/include/usr/targeting/predicate/predicatectm.H + * (and usr/targeting/predicate/predicatectm.C) + * + */ + + +/******************************************************************************/ +// Includes +/******************************************************************************/ +#include <stdint.h> + +// targeting support. +#include <targeting/common/attributes.H> +#include <targeting/common/entitypath.H> +#include <targeting/common/target.H> +#include <targeting/common/targetservice.H> +#include <targeting/common/iterators/rangefilter.H> +#include <targeting/common/predicates/predicatectm.H> + + +namespace TARGETING +{ + +class PredicateIsNonFunctional : public PredicateBase +{ + +public: + + /** + * @brief Create a predicate to select targets that + * are marked non-functional. + * + * @param[in] i_requirepresent + * Bool indicating whether to select targets which + * are present and non-functional (true)(default), or + * to select all non-functioal targets, regardless of + * present state (false) + */ + PredicateIsNonFunctional(bool i_requirePresent = true); + + + /** + * @brief Destroy the predicate + */ + virtual ~PredicateIsNonFunctional(); + + /** + * @brief returns true if target is marked non-functional + * + * @param[in] i_pTarget + * Handle to the target to perform the predicate check on + * + * @return bool indicating whether target is non-functional or not + */ + bool operator()(const TARGETING::Target* i_pTarget) const ; + +private: + + // Whether to return targets who are present and non-functional (true) + // or to return all non-functional targets, regardless of present state + // (false) + bool iv_requirePresent; + + TARG_DISABLE_COPY_AND_ASSIGNMENT_OPERATORS(PredicateIsNonFunctional); +}; + +}; // end namespace + +#endif // __TARGETING_COMMON_PREDICATEISNONFUNCTIONAL_H diff --git a/src/include/usr/targeting/common/predicates/predicates.H b/src/include/usr/targeting/common/predicates/predicates.H index 8c422b036..b62b9f843 100644 --- a/src/include/usr/targeting/common/predicates/predicates.H +++ b/src/include/usr/targeting/common/predicates/predicates.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* COPYRIGHT International Business Machines Corp. 2012,2014 */ /* */ /* p1 */ /* */ @@ -36,6 +36,7 @@ #include <targeting/common/predicates/predicatehwaschanged.H> #include <targeting/common/predicates/predicatepostfixexpr.H> #include <targeting/common/predicates/predicateattrval.H> +#include <targeting/common/predicates/predicateisnonfunctional.H> // please keep up to date... diff --git a/src/include/usr/targeting/common/utilFilter.H b/src/include/usr/targeting/common/utilFilter.H index 551f4cf85..d5a1afef4 100644 --- a/src/include/usr/targeting/common/utilFilter.H +++ b/src/include/usr/targeting/common/utilFilter.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2013 */ +/* COPYRIGHT International Business Machines Corp. 2012,2014 */ /* */ /* p1 */ /* */ @@ -43,9 +43,11 @@ namespace TARGETING */ enum ResourceState { - UTIL_FILTER_ALL, // All targets - UTIL_FILTER_PRESENT, // Present at minimum - UTIL_FILTER_FUNCTIONAL // Functional targets only + UTIL_FILTER_ALL, // All targets + UTIL_FILTER_PRESENT, // Present at minimum + UTIL_FILTER_FUNCTIONAL, // Functional targets only + UTIL_FILTER_PRESENT_NON_FUNCTIONAL, //All present and non-fucntional + UTIL_FILTER_NON_FUNCTIONAL //All non-fucntional }; |

