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.

100 lines
2.1 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2018 CERN
  5. * @author Jon Evans <jon@craftyjon.com>
  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 along
  18. * with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef _BUS_ALIAS_H
  21. #define _BUS_ALIAS_H
  22. #include <memory>
  23. #include <wx/string.h>
  24. #include <wx/arrstr.h>
  25. class SCH_SCREEN;
  26. class BUS_ALIAS
  27. {
  28. public:
  29. BUS_ALIAS( SCH_SCREEN* aParent = NULL );
  30. ~BUS_ALIAS();
  31. std::shared_ptr< BUS_ALIAS > Clone() const
  32. {
  33. return std::make_shared< BUS_ALIAS >( *this );
  34. }
  35. wxString GetName()
  36. {
  37. return m_name;
  38. }
  39. void SetName( const wxString& aName )
  40. {
  41. m_name = aName;
  42. }
  43. void ClearMembers()
  44. {
  45. m_members.clear();
  46. }
  47. void AddMember( const wxString& aName )
  48. {
  49. m_members.push_back( aName );
  50. }
  51. int GetMemberCount()
  52. {
  53. return m_members.size();
  54. }
  55. wxArrayString& Members()
  56. {
  57. return m_members;
  58. }
  59. bool Contains( const wxString& aName );
  60. SCH_SCREEN* GetParent()
  61. {
  62. return m_parent;
  63. }
  64. void SetParent( SCH_SCREEN* aParent )
  65. {
  66. m_parent = aParent;
  67. }
  68. protected:
  69. wxString m_name;
  70. wxArrayString m_members;
  71. /**
  72. * The bus alias editor dialog can edit aliases from all open sheets.
  73. * This means we have to store a reference back to our parent so that
  74. * the dialog can update the parent if aliases are changed or removed.
  75. */
  76. SCH_SCREEN* m_parent;
  77. };
  78. #endif