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.

54 lines
1.7 KiB

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