1 /* 2 * This program source code file is part of KiCad, a free EDA CAD application. 3 * 4 * Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@nbee.es> 5 * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. 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 /* 26 27 NETCLASS is not exposed/generated via SWIG but rather class NETCLASSPTR is. This 28 is because we can never have a simple pointer to a NETCLASS, only can we have a 29 NETCLASSPTR. So we cannot build a python wrapper without using NETCLASSPTR to do 30 the pointing. 31 32 */ 33 34 %ignore NETCLASS; // no code generation for it 35 %include netclass.h 36 37 38 /* 39 40 Propagate important member functions from NETCLASS into SWIG's NETCLASSPTR. Do 41 this by dereferencing the pointer to the NETCLASSPTR proxy, then dereference the 42 std::share_ptr to get to the actual NETCLASS::member. Complete the member 43 function set if you see something missing from class NETCLASS that you need. 44 45 */ 46 47 //%extend NETCLASSPTR // would have thought the typedef in header above was golden here. 48 %extend std::shared_ptr<NETCLASS> 49 { 50 public: 51 std::shared_ptr<NETCLASS>( std::string name ) { return new std::shared_ptr<NETCLASS>( new NETCLASS(name) ); } 52 NetNames()53 STRINGSET& NetNames() { return (*self)->NetNames(); } 54 GetName()55 const wxString& GetName() { return (*self)->GetName(); } 56 GetCount()57 unsigned GetCount() const { return (*self)->GetCount(); } 58 GetDescription()59 const wxString& GetDescription() const { return (*self)->GetDescription(); } SetDescription(const wxString & aDesc)60 void SetDescription( const wxString& aDesc ) { (*self)->SetDescription( aDesc ); } 61 GetClearance()62 int GetClearance() const { return (*self)->GetClearance(); } SetClearance(int aClearance)63 void SetClearance( int aClearance ) { (*self)->SetClearance( aClearance ); } 64 GetTrackWidth()65 int GetTrackWidth() const { return (*self)->GetTrackWidth(); } SetTrackWidth(int aWidth)66 void SetTrackWidth( int aWidth ) { (*self)->SetTrackWidth( aWidth ); } 67 GetViaDiameter()68 int GetViaDiameter() const { return (*self)->GetViaDiameter(); } SetViaDiameter(int aDia)69 void SetViaDiameter( int aDia ) { (*self)->SetViaDiameter( aDia ); } 70 GetViaDrill()71 int GetViaDrill() const { return (*self)->GetViaDrill(); } SetViaDrill(int aSize)72 void SetViaDrill( int aSize ) { (*self)->SetViaDrill( aSize ); } 73 GetuViaDiameter()74 int GetuViaDiameter() const { return (*self)->GetuViaDiameter(); } SetuViaDiameter(int aSize)75 void SetuViaDiameter( int aSize ) { (*self)->SetuViaDiameter( aSize ); } 76 GetuViaDrill()77 int GetuViaDrill() const { return (*self)->GetuViaDrill(); } SetuViaDrill(int aSize)78 void SetuViaDrill( int aSize ) { (*self)->SetuViaDrill( aSize ); } 79 GetDiffPairWidth()80 int GetDiffPairWidth() const { return (*self)->GetDiffPairWidth(); } SetDiffPairWidth(int aSize)81 void SetDiffPairWidth( int aSize ) { (*self)->SetDiffPairWidth( aSize ); } 82 GetDiffPairGap()83 int GetDiffPairGap() const { return (*self)->GetDiffPairGap(); } SetDiffPairGap(int aSize)84 void SetDiffPairGap( int aSize ) { (*self)->SetDiffPairGap( aSize ); } 85 }; 86 87 88 %{ 89 #include <netclass.h> 90 %} 91