You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.9 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2017 CERN
  5. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * @author Maciej Suminski <maciej.suminski@cern.ch>
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, you may find one here:
  21. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  22. * or you may search the http://www.gnu.org website for the version 2 license,
  23. * or you may write to the Free Software Foundation, Inc.,
  24. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  25. */
  26. #ifndef HASH_EDA_H_
  27. #define HASH_EDA_H_
  28. /**
  29. * @brief Hashing functions for EDA_ITEMs.
  30. */
  31. #include <cstdlib>
  32. #include <functional>
  33. class EDA_ITEM;
  34. ///< Enables/disables properties that will be used for calculating the hash.
  35. ///< The properties might be combined using the bitwise 'or' operator.
  36. enum HASH_FLAGS
  37. {
  38. HASH_POS = 0x01,
  39. ///< use coordinates relative to the parent object
  40. REL_COORD = 0x02,
  41. HASH_ROT = 0x04,
  42. HASH_LAYER = 0x08,
  43. HASH_NET = 0x10,
  44. HASH_REF = 0x20,
  45. HASH_VALUE = 0x40,
  46. HASH_ALL = 0xff
  47. };
  48. /**
  49. * Calculate hash of an EDA_ITEM.
  50. *
  51. * @param aItem is the item for which the hash will be computed.
  52. * @return Hash value.
  53. */
  54. std::size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags = HASH_FLAGS::HASH_ALL );
  55. #endif