kicad/pcbnew/router/pns_itemset.h

88 lines
2.1 KiB
C
Raw Normal View History

/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
2013-09-26 21:53:54 +00:00
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
2013-09-26 21:53:54 +00:00
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
2013-09-26 21:53:54 +00:00
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __PNS_ITEMSET_H
#define __PNS_ITEMSET_H
#include <vector>
#include "pns_item.h"
/**
* Class PNS_ITEMSET
*
* Holds a list of board items, that can be filtered against net, kinds,
2013-09-26 21:53:54 +00:00
* layers, etc.
**/
class PNS_ITEMSET
{
public:
typedef std::vector<PNS_ITEM*> ITEM_VECTOR;
PNS_ITEMSET( PNS_ITEM* aInitialItem = NULL );
PNS_ITEMSET( const PNS_ITEMSET& aOther )
{
m_items = aOther.m_items;
m_ownedItems = ITEM_VECTOR();
}
const PNS_ITEMSET& operator=( const PNS_ITEMSET& aOther )
{
m_items = aOther.m_items;
m_ownedItems = ITEM_VECTOR();
return *this;
}
2013-09-26 21:53:54 +00:00
~PNS_ITEMSET();
ITEM_VECTOR& Items() { return m_items; }
const ITEM_VECTOR& CItems() const { return m_items; }
2013-09-26 21:53:54 +00:00
PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1 );
PNS_ITEMSET& FilterKinds( int aKindMask );
PNS_ITEMSET& FilterNet( int aNet );
2013-09-26 21:53:54 +00:00
int Size() { return m_items.size(); }
void Add( PNS_ITEM* aItem )
2013-09-26 21:53:54 +00:00
{
m_items.push_back( aItem );
2013-09-26 21:53:54 +00:00
}
2013-09-26 21:53:54 +00:00
PNS_ITEM* Get( int index ) const { return m_items[index]; }
void Clear();
void AddOwned( PNS_ITEM *aItem )
{
m_items.push_back( aItem );
m_ownedItems.push_back( aItem );
}
private:
ITEM_VECTOR m_items;
ITEM_VECTOR m_ownedItems;
};
#endif