1b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner/* 29368eea42a1afb01dd44110582f997115b50e742François Gaffie * Copyright (c) 2011-2015, Intel Corporation 3b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * All rights reserved. 4b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 5b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * Redistribution and use in source and binary forms, with or without modification, 6b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * are permitted provided that the following conditions are met: 7b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 8b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 1. Redistributions of source code must retain the above copyright notice, this 9b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * list of conditions and the following disclaimer. 10b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 11b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 2. Redistributions in binary form must reproduce the above copyright notice, 12b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * this list of conditions and the following disclaimer in the documentation and/or 13b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * other materials provided with the distribution. 14b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 15b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 3. Neither the name of the copyright holder nor the names of its contributors 16b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * may be used to endorse or promote products derived from this software without 17b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * specific prior written permission. 18b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 19b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 23b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2968a912857707864bbaaff9808717813105072a6ePatrick Benavoli */ 3068a912857707864bbaaff9808717813105072a6ePatrick Benavoli#pragma once 3168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 3268a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "Element.h" 3368a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "SelectionCriterionType.h" 3468a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "SelectionCriterionInterface.h" 359368eea42a1afb01dd44110582f997115b50e742François Gaffie#include <log/Logger.h> 369368eea42a1afb01dd44110582f997115b50e742François Gaffie#include <NonCopyable.hpp> 3768a912857707864bbaaff9808717813105072a6ePatrick Benavoli 38d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve#include <string> 3968a912857707864bbaaff9808717813105072a6ePatrick Benavoli 409368eea42a1afb01dd44110582f997115b50e742François Gaffieclass CSelectionCriterion : public CElement, 419368eea42a1afb01dd44110582f997115b50e742François Gaffie public ISelectionCriterionInterface, 429368eea42a1afb01dd44110582f997115b50e742François Gaffie private utility::NonCopyable 4368a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 4468a912857707864bbaaff9808717813105072a6ePatrick Benavolipublic: 459368eea42a1afb01dd44110582f997115b50e742François Gaffie CSelectionCriterion(const std::string &strName, const CSelectionCriterionType *pType, 469368eea42a1afb01dd44110582f997115b50e742François Gaffie core::log::Logger &logger); 4768a912857707864bbaaff9808717813105072a6ePatrick Benavoli 4868a912857707864bbaaff9808717813105072a6ePatrick Benavoli /// From ISelectionCriterionInterface 4968a912857707864bbaaff9808717813105072a6ePatrick Benavoli // State 50b71ccf75a1b2c718543783b277bb9c104c97e490Patrick Benavoli virtual void setCriterionState(int iState); 5168a912857707864bbaaff9808717813105072a6ePatrick Benavoli virtual int getCriterionState() const; 5268a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Name 53d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve virtual std::string getCriterionName() const; 5468a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Type 559368eea42a1afb01dd44110582f997115b50e742François Gaffie virtual const ISelectionCriterionTypeInterface *getCriterionType() const; 56daaa63ce33fa4795403f9339bc872694c9ab6113Frédéric Boisnard // Modified status 57daaa63ce33fa4795403f9339bc872694c9ab6113Frédéric Boisnard bool hasBeenModified() const; 58daaa63ce33fa4795403f9339bc872694c9ab6113Frédéric Boisnard void resetModifiedStatus(); 5968a912857707864bbaaff9808717813105072a6ePatrick Benavoli 6068a912857707864bbaaff9808717813105072a6ePatrick Benavoli /// Match methods 616ba361d96bc2581667b3400f87ff89fae6449e1fPatrick Benavoli bool is(int iState) const; 626ba361d96bc2581667b3400f87ff89fae6449e1fPatrick Benavoli bool isNot(int iState) const; 636ba361d96bc2581667b3400f87ff89fae6449e1fPatrick Benavoli bool includes(int iState) const; 646ba361d96bc2581667b3400f87ff89fae6449e1fPatrick Benavoli bool excludes(int iState) const; 656ba361d96bc2581667b3400f87ff89fae6449e1fPatrick Benavoli 666ba361d96bc2581667b3400f87ff89fae6449e1fPatrick Benavoli /// User request 67d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::string getFormattedDescription(bool bWithTypeInfo, bool bHumanReadable) const; 6868a912857707864bbaaff9808717813105072a6ePatrick Benavoli 6968a912857707864bbaaff9808717813105072a6ePatrick Benavoli /// From CElement 70d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve virtual std::string getKind() const; 710548523ab6bbca766dcce4be97a0c50efd529d90Patrick Benavoli 720548523ab6bbca766dcce4be97a0c50efd529d90Patrick Benavoli /** 730548523ab6bbca766dcce4be97a0c50efd529d90Patrick Benavoli * Export to XML 740548523ab6bbca766dcce4be97a0c50efd529d90Patrick Benavoli * 750548523ab6bbca766dcce4be97a0c50efd529d90Patrick Benavoli * @param[in] xmlElement The XML element to export to 760548523ab6bbca766dcce4be97a0c50efd529d90Patrick Benavoli * @param[in] serializingContext The serializing context 770548523ab6bbca766dcce4be97a0c50efd529d90Patrick Benavoli * 780548523ab6bbca766dcce4be97a0c50efd529d90Patrick Benavoli */ 799368eea42a1afb01dd44110582f997115b50e742François Gaffie virtual void toXml(CXmlElement &xmlElement, CXmlSerializingContext &serializingContext) const; 809368eea42a1afb01dd44110582f997115b50e742François Gaffie 8168a912857707864bbaaff9808717813105072a6ePatrick Benavoliprivate: 8268a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Current state 839368eea42a1afb01dd44110582f997115b50e742François Gaffie int _iState{0}; 8468a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Type 859368eea42a1afb01dd44110582f997115b50e742François Gaffie const CSelectionCriterionType *_pType; 8668a912857707864bbaaff9808717813105072a6ePatrick Benavoli 879368eea42a1afb01dd44110582f997115b50e742François Gaffie /** Counter to know how many modifications have been applied to this criterion */ 889368eea42a1afb01dd44110582f997115b50e742François Gaffie uint32_t _uiNbModifications{0}; 899368eea42a1afb01dd44110582f997115b50e742François Gaffie 909368eea42a1afb01dd44110582f997115b50e742François Gaffie /** Application logger */ 919368eea42a1afb01dd44110582f997115b50e742François Gaffie core::log::Logger &_logger; 929368eea42a1afb01dd44110582f997115b50e742François Gaffie}; 93