KiCad PCB EDA Suite
collectors.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
5  * Copyright (C) 2004-2018 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 
29 #ifndef COLLECTORS_H
30 #define COLLECTORS_H
31 
32 
33 /* This module contains a number of COLLECTOR implementations which are used
34  * to augment the functionality of class PCB_EDIT_FRAME.
35  */
36 
37 
38 #include <collector.h>
39 #include <layers_id_colors_and_visibility.h> // LAYER_COUNT, layer defs
40 #include <view/view.h>
41 
42 
43 class BOARD_ITEM;
44 
45 
65 {
66 
67 public:
68  virtual ~COLLECTORS_GUIDE() {}
69 
73  virtual bool IsLayerLocked( PCB_LAYER_ID layer ) const = 0;
74 
78  virtual bool IsLayerVisible( PCB_LAYER_ID layer ) const = 0;
79 
83  virtual bool IgnoreLockedLayers() const = 0;
84 
88  virtual bool IgnoreNonVisibleLayers() const = 0;
89 
93  virtual PCB_LAYER_ID GetPreferredLayer() const = 0;
94 
100  virtual bool IgnorePreferredLayer() const = 0;
101 
105  virtual bool IgnoreLockedItems() const = 0;
106 
112  virtual bool IncludeSecondary() const = 0;
113 
117  virtual bool IgnoreMTextsMarkedNoShow() const = 0;
118 
122  virtual bool IgnoreMTextsOnBack() const = 0;
123 
127  virtual bool IgnoreMTextsOnFront() const = 0;
128 
132  virtual bool IgnoreModulesOnBack() const = 0;
133 
137  virtual bool IgnoreModulesOnFront() const = 0;
138 
142  virtual bool IgnorePadsOnBack() const = 0;
143 
147  virtual bool IgnorePadsOnFront() const = 0;
148 
152  virtual bool IgnoreThroughHolePads() const = 0;
153 
157  virtual bool IgnorePads() const
158  {
160  }
161 
165  virtual bool IgnoreModulesVals() const = 0;
166 
170  virtual bool IgnoreModulesRefs() const = 0;
171 
175  virtual bool IgnoreThroughVias() const = 0;
176 
180  virtual bool IgnoreBlindBuriedVias() const = 0;
181 
185  virtual bool IgnoreMicroVias() const = 0;
186 
190  virtual bool IgnoreTracks() const = 0;
191 
195  virtual bool IgnoreZoneFills() const = 0;
196 
197  virtual double OnePixelInIU() const = 0;
198 
204 };
205 
206 
207 
217 class PCB_COLLECTOR : public COLLECTOR
218 {
219 public:
226  BOARD_ITEM* operator[]( int ndx ) const
227  {
228  if( (unsigned)ndx < (unsigned)GetCount() )
229  return (BOARD_ITEM*) m_List[ ndx ];
230 
231  return NULL;
232  }
233 };
234 
235 
246 {
247 protected:
254  std::vector<BOARD_ITEM*> m_List2nd;
255 
260 
266 
267 public:
268 
272  static const KICAD_T AllBoardItems[];
273 
277  static const KICAD_T AllButZones[];
278 
282  static const KICAD_T Zones[];
283 
288  static const KICAD_T BoardLevelItems[];
289 
293  static const KICAD_T Modules[];
294 
298  static const KICAD_T PadsOrModules[];
299 
303  static const KICAD_T PadsOrTracks[];
304 
309 
313  static const KICAD_T ModuleItems[];
314 
318  static const KICAD_T Tracks[];
319 
323  static const KICAD_T LockableItems[];
324 
329  {
330  m_Guide = NULL;
331  m_PrimaryLength = 0;
333  }
334 
335  void Empty2nd()
336  {
337  m_List2nd.clear();
338  }
339 
340  void Append2nd( BOARD_ITEM* item )
341  {
342  m_List2nd.push_back( item );
343  }
344 
350  void SetGuide( const COLLECTORS_GUIDE* aGuide ) { m_Guide = aGuide; }
351 
352  const COLLECTORS_GUIDE* GetGuide() { return m_Guide; }
353 
358 
370  SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override;
371 
382  void Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[],
383  const wxPoint& aRefPos, const COLLECTORS_GUIDE& aGuide );
384 };
385 
386 
392 {
393 private:
394  // the storage architecture here is not important, since this is only
395  // a carrier object and its functions are what is used, and data only indirectly.
396 
399 
402 
405 
408 
424 
426 
427 public:
428 
437  GENERAL_COLLECTORS_GUIDE( LSET aVisibleLayerMask, PCB_LAYER_ID aPreferredLayer,
438  KIGFX::VIEW* aView )
439  {
440  VECTOR2I one( 1, 1 );
441 
442  m_PreferredLayer = aPreferredLayer;
443  m_IgnorePreferredLayer = false;
444  m_LayerVisible = aVisibleLayerMask;
445  m_IgnoreLockedLayers = true;
447  m_IgnoreLockedItems = false;
448 
449 #if defined(USE_MATCH_LAYER)
450  m_IncludeSecondary = false;
451 #else
452  m_IncludeSecondary = true;
453 #endif
454 
455  m_IgnoreMTextsMarkedNoShow = true; // g_ModuleTextNOVColor;
456  m_IgnoreMTextsOnBack = true;
457  m_IgnoreMTextsOnFront = false;
458  m_IgnoreModulesOnBack = true; // !Show_Modules_Cmp;
459  m_IgnoreModulesOnFront = false;
460 
461  m_IgnorePadsOnFront = false;
462  m_IgnorePadsOnBack = false;
463  m_IgnoreThroughHolePads = false;
464 
465  m_IgnoreModulesVals = false;
466  m_IgnoreModulesRefs = false;
467 
468  m_IgnoreThroughVias = false;
469  m_IgnoreBlindBuriedVias = false;
470  m_IgnoreMicroVias = false;
471  m_IgnoreTracks = false;
472  m_IgnoreZoneFills = true;
473 
474  m_OnePixelInIU = aView->ToWorld( one, false ).x;
475  }
476 
480  bool IsLayerLocked( PCB_LAYER_ID aLayerId ) const override
481  {
482  return m_LayerLocked[aLayerId];
483  }
484 
485  void SetLayerLocked( PCB_LAYER_ID aLayerId, bool isLocked )
486  {
487  m_LayerLocked.set( aLayerId, isLocked );
488  }
489 
493  bool IsLayerVisible( PCB_LAYER_ID aLayerId ) const override
494  {
495  return m_LayerVisible[aLayerId];
496  }
497  void SetLayerVisible( PCB_LAYER_ID aLayerId, bool isVisible )
498  {
499  m_LayerVisible.set( aLayerId, isVisible );
500  }
501  void SetLayerVisibleBits( LSET aLayerBits ) { m_LayerVisible = aLayerBits; }
502 
506  bool IgnoreLockedLayers() const override { return m_IgnoreLockedLayers; }
507  void SetIgnoreLockedLayers( bool ignore ) { m_IgnoreLockedLayers = ignore; }
508 
512  bool IgnoreNonVisibleLayers() const override { return m_IgnoreNonVisibleLayers; }
513  void SetIgnoreNonVisibleLayers( bool ignore ) { m_IgnoreLockedLayers = ignore; }
514 
518  PCB_LAYER_ID GetPreferredLayer() const override { return m_PreferredLayer; }
519  void SetPreferredLayer( PCB_LAYER_ID aLayer ) { m_PreferredLayer = aLayer; }
520 
526  bool IgnorePreferredLayer() const override { return m_IgnorePreferredLayer; }
527  void SetIgnorePreferredLayer( bool ignore ) { m_IgnorePreferredLayer = ignore; }
528 
532  bool IgnoreLockedItems() const override { return m_IgnoreLockedItems; }
533  void SetIgnoreLockedItems( bool ignore ) { m_IgnoreLockedItems = ignore; }
534 
540  bool IncludeSecondary() const override { return m_IncludeSecondary; }
541  void SetIncludeSecondary( bool include ) { m_IncludeSecondary = include; }
542 
546  bool IgnoreMTextsMarkedNoShow() const override { return m_IgnoreMTextsMarkedNoShow; }
547  void SetIgnoreMTextsMarkedNoShow( bool ignore ) { m_IgnoreMTextsMarkedNoShow = ignore; }
548 
552  bool IgnoreMTextsOnBack() const override { return m_IgnoreMTextsOnBack; }
553  void SetIgnoreMTextsOnBack( bool ignore ) { m_IgnoreMTextsOnBack = ignore; }
554 
558  bool IgnoreMTextsOnFront() const override { return m_IgnoreMTextsOnFront; }
559  void SetIgnoreMTextsOnFront( bool ignore ) { m_IgnoreMTextsOnFront = ignore; }
560 
564  bool IgnoreModulesOnBack() const override { return m_IgnoreModulesOnBack; }
565  void SetIgnoreModulesOnBack( bool ignore ) { m_IgnoreModulesOnBack = ignore; }
566 
570  bool IgnoreModulesOnFront() const override { return m_IgnoreModulesOnFront; }
571  void SetIgnoreModulesOnFront( bool ignore ) { m_IgnoreModulesOnFront = ignore; }
572 
576  bool IgnorePadsOnBack() const override { return m_IgnorePadsOnBack; }
577  void SetIgnorePadsOnBack(bool ignore) { m_IgnorePadsOnBack = ignore; }
578 
582  bool IgnorePadsOnFront() const override { return m_IgnorePadsOnFront; }
583  void SetIgnorePadsOnFront(bool ignore) { m_IgnorePadsOnFront = ignore; }
584 
588  bool IgnoreThroughHolePads() const override { return m_IgnoreThroughHolePads; }
589  void SetIgnoreThroughHolePads(bool ignore) { m_IgnoreThroughHolePads = ignore; }
590 
594  bool IgnoreModulesVals() const override { return m_IgnoreModulesVals; }
595  void SetIgnoreModulesVals(bool ignore) { m_IgnoreModulesVals = ignore; }
596 
600  bool IgnoreModulesRefs() const override { return m_IgnoreModulesRefs; }
601  void SetIgnoreModulesRefs(bool ignore) { m_IgnoreModulesRefs = ignore; }
602 
603  bool IgnoreThroughVias() const override { return m_IgnoreThroughVias; }
604  void SetIgnoreThroughVias( bool ignore ) { m_IgnoreThroughVias = ignore; }
605 
606  bool IgnoreBlindBuriedVias() const override { return m_IgnoreBlindBuriedVias; }
607  void SetIgnoreBlindBuriedVias( bool ignore ) { m_IgnoreBlindBuriedVias = ignore; }
608 
609  bool IgnoreMicroVias() const override { return m_IgnoreMicroVias; }
610  void SetIgnoreMicroVias( bool ignore ) { m_IgnoreMicroVias = ignore; }
611 
612  bool IgnoreTracks() const override { return m_IgnoreTracks; }
613  void SetIgnoreTracks( bool ignore ) { m_IgnoreTracks = ignore; }
614 
615  bool IgnoreZoneFills() const override { return m_IgnoreZoneFills; }
616  void SetIgnoreZoneFills( bool ignore ) { m_IgnoreZoneFills = ignore; }
617 
618  double OnePixelInIU() const override { return m_OnePixelInIU; }
619 };
620 
621 
628 {
629 public:
630 
639  SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override;
640 
647  void Collect( BOARD_ITEM* aBoard, const KICAD_T aScanList[] );
648 };
649 
650 
657 {
659 
660 public:
662  m_layer_id( aLayerId )
663  {
664  }
665 
666  void SetLayerId( PCB_LAYER_ID aLayerId ) { m_layer_id = aLayerId; }
667 
676  SEARCH_RESULT Inspect( EDA_ITEM* testItem, void* testData ) override;
677 
684  void Collect( BOARD_ITEM* aBoard, const KICAD_T aScanList[] );
685 };
686 
687 #endif // COLLECTORS_H
virtual bool IsLayerLocked(PCB_LAYER_ID layer) const =0
void SetIgnoreTracks(bool ignore)
Definition: collectors.h:613
static const KICAD_T BoardLevelItems[]
A scan list for all primary board items, omitting items which are subordinate to a MODULE...
Definition: collectors.h:288
bool IgnoreModulesOnFront() const override
Definition: collectors.h:570
virtual bool IgnoreBlindBuriedVias() const =0
COLLECTOR class definition.
void SetLayerLocked(PCB_LAYER_ID aLayerId, bool isLocked)
Definition: collectors.h:485
virtual bool IgnoreModulesOnFront() const =0
static const KICAD_T AllBoardItems[]
A scan list for all editable board items, like PcbGeneralLocateAndDisplay()
Definition: collectors.h:272
void SetIgnoreBlindBuriedVias(bool ignore)
Definition: collectors.h:607
static const KICAD_T Tracks[]
A scan list for only TRACKS.
Definition: collectors.h:318
BOARD_ITEM * operator[](int ndx) const
Overload the COLLECTOR::operator[](int) to return a BOARD_ITEM instead of an EDA_ITEM.
Definition: collectors.h:226
SEARCH_RESULT Inspect(EDA_ITEM *testItem, void *testData) override
The examining function within the INSPECTOR which is passed to the iterate function.
Definition: collectors.cpp:530
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
static const KICAD_T Modules[]
A scan list for only MODULEs.
Definition: collectors.h:293
bool IgnoreModulesOnBack() const override
Definition: collectors.h:564
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Function ToWorld() Converts a screen space point/vector to a point/vector in world space coordinates...
Definition: view.cpp:475
bool IgnoreMicroVias() const override
Definition: collectors.h:609
void SetScanTypes(const KICAD_T *scanTypes)
Function SetScanTypes records the list of KICAD_T types to consider for collection by the Inspect() f...
Definition: collector.h:215
void Collect(BOARD_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class&#39;s Inspector method, which does the collection. ...
Definition: collectors.cpp:482
virtual double OnePixelInIU() const =0
void SetIgnoreModulesVals(bool ignore)
Definition: collectors.h:595
PCB_LAYER_ID m_PreferredLayer
Definition: collectors.h:397
void SetIgnoreMicroVias(bool ignore)
Definition: collectors.h:610
void SetIgnoreModulesOnBack(bool ignore)
Definition: collectors.h:565
void SetIgnorePreferredLayer(bool ignore)
Definition: collectors.h:527
virtual bool IgnoreZoneFills() const =0
virtual bool IgnoreNonVisibleLayers() const =0
void Append2nd(BOARD_ITEM *item)
Definition: collectors.h:340
bool IgnoreThroughVias() const override
Definition: collectors.h:603
void SetIgnoreModulesRefs(bool ignore)
Definition: collectors.h:601
virtual PCB_LAYER_ID GetPreferredLayer() const =0
void Collect(BOARD_ITEM *aBoard, const KICAD_T aScanList[])
Tests a BOARD_ITEM using this class&#39;s Inspector method, which does the collection.
Definition: collectors.cpp:546
bool IgnoreModulesVals() const override
Definition: collectors.h:594
PCB_LAYER_ID m_layer_id
Definition: collectors.h:658
static const KICAD_T AllButZones[]
A scan list for all editable board items, except zones.
Definition: collectors.h:277
virtual bool IgnoreTracks() const =0
std::vector< BOARD_ITEM * > m_List2nd
A place to hold collected objects which don&#39;t match precisely the search criteria, but would be acceptable if nothing else is found.
Definition: collectors.h:254
double OnePixelInIU() const override
Definition: collectors.h:618
virtual bool IgnoreMicroVias() const =0
virtual bool IgnoreModulesVals() const =0
static const KICAD_T PadsOrTracks[]
A scan list for PADs, TRACKs, or VIAs.
Definition: collectors.h:303
Collect all BOARD_ITEM objects on a given layer.
Definition: collectors.h:656
const COLLECTORS_GUIDE * GetGuide()
Definition: collectors.h:352
bool IgnorePadsOnBack() const override
Definition: collectors.h:576
int m_PrimaryLength
The number of items that were originally in the primary list before the m_List2nd was concatenated on...
Definition: collectors.h:265
PCB_LAYER_ID GetPreferredLayer() const override
Definition: collectors.h:518
bool IgnorePreferredLayer() const override
Provide wildcard behavior regarding the preferred layer.
Definition: collectors.h:526
virtual bool IgnorePreferredLayer() const =0
Provide wildcard behavior regarding the preferred layer.
void SetLayerId(PCB_LAYER_ID aLayerId)
Definition: collectors.h:666
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
static const KICAD_T ModulesAndTheirItems[]
A scan list for MODULEs and their items (for Modedit)
Definition: collectors.h:308
virtual bool IgnorePadsOnFront() const =0
void SetGuide(const COLLECTORS_GUIDE *aGuide)
Record which COLLECTORS_GUIDE to use.
Definition: collectors.h:350
virtual bool IgnoreThroughHolePads() const =0
void SetLayerVisibleBits(LSET aLayerBits)
Definition: collectors.h:501
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:114
SEARCH_RESULT Inspect(EDA_ITEM *testItem, void *testData) override
The examining function within the INSPECTOR which is passed to the Iterate function.
Definition: collectors.cpp:512
PCB_LAYER_ID
A quick note on layer IDs:
void SetPreferredLayer(PCB_LAYER_ID aLayer)
Definition: collectors.h:519
Class LSET is a set of PCB_LAYER_IDs.
LSET m_LayerLocked
bit-mapped layer locked bits
Definition: collectors.h:400
virtual bool IgnoreMTextsOnBack() const =0
void SetIgnoreMTextsOnBack(bool ignore)
Definition: collectors.h:553
void SetIgnorePadsOnFront(bool ignore)
Definition: collectors.h:583
void SetIgnoreMTextsOnFront(bool ignore)
Definition: collectors.h:559
void SetLayerVisible(PCB_LAYER_ID aLayerId, bool isVisible)
Definition: collectors.h:497
bool IgnoreMTextsOnBack() const override
Definition: collectors.h:552
bool IgnoreZoneFills() const override
Definition: collectors.h:615
Collect BOARD_ITEM objects.
Definition: collectors.h:217
bool IgnoreTracks() const override
Definition: collectors.h:612
static const KICAD_T Zones[]
A scan list for zones outlines only.
Definition: collectors.h:282
bool IgnoreModulesRefs() const override
Definition: collectors.h:600
const COLLECTORS_GUIDE * m_Guide
Determines which items are to be collected by Inspect()
Definition: collectors.h:259
bool IgnoreThroughHolePads() const override
Definition: collectors.h:588
void SetIgnoreMTextsMarkedNoShow(bool ignore)
Definition: collectors.h:547
virtual bool IgnoreMTextsMarkedNoShow() const =0
void Collect(BOARD_ITEM *aBoard, const KICAD_T aScanList[])
Collect BOARD_ITEM objects using this class&#39;s Inspector method, which does the collection.
Definition: collectors.cpp:522
virtual bool IgnoreThroughVias() const =0
virtual bool IgnoreModulesRefs() const =0
bool IsLayerLocked(PCB_LAYER_ID aLayerId) const override
Definition: collectors.h:480
bool IgnoreMTextsOnFront() const override
Definition: collectors.h:558
bool IgnoreLockedLayers() const override
Definition: collectors.h:506
static const KICAD_T LockableItems[]
A scan list for TRACKS, VIAS, MODULES.
Definition: collectors.h:323
bool IsLayerVisible(PCB_LAYER_ID aLayerId) const override
Definition: collectors.h:493
GENERAL_COLLECTORS_GUIDE(LSET aVisibleLayerMask, PCB_LAYER_ID aPreferredLayer, KIGFX::VIEW *aView)
Grab stuff from global preferences and uses reasonable defaults.
Definition: collectors.h:437
bool IgnoreBlindBuriedVias() const override
Definition: collectors.h:606
bool IgnoreLockedItems() const override
Definition: collectors.h:532
static const KICAD_T PadsOrModules[]
A scan list for PADs or MODULEs.
Definition: collectors.h:298
Board layer functions and definitions.
virtual bool IgnorePads() const
Definition: collectors.h:157
PCB_LAYER_COLLECTOR(PCB_LAYER_ID aLayerId=UNDEFINED_LAYER)
Definition: collectors.h:661
static const KICAD_T ModuleItems[]
A scan list for primary module items.
Definition: collectors.h:313
void SetIgnoreModulesOnFront(bool ignore)
Definition: collectors.h:571
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:245
void SetIgnoreLockedItems(bool ignore)
Definition: collectors.h:533
void SetIgnoreThroughVias(bool ignore)
Definition: collectors.h:604
GENERAL_COLLECTOR()
Constructor GENERALCOLLECTOR.
Definition: collectors.h:328
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
Class COLLECTOR is an abstract class that will find and hold all the objects according to an inspecti...
Definition: collector.h:55
bool IgnoreNonVisibleLayers() const override
Definition: collectors.h:512
virtual bool IsLayerVisible(PCB_LAYER_ID layer) const =0
virtual bool IgnorePadsOnBack() const =0
An abstract base class whose derivatives may be passed to a GENERAL_COLLECTOR, telling GENERAL_COLLEC...
Definition: collectors.h:64
bool IgnorePadsOnFront() const override
Definition: collectors.h:582
virtual bool IgnoreLockedItems() const =0
void SetIgnoreLockedLayers(bool ignore)
Definition: collectors.h:507
Class VIEW.
Definition: view.h:61
virtual bool IgnoreLockedLayers() const =0
Collect all BOARD_ITEM objects of a given set of KICAD_T type(s).
Definition: collectors.h:627
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:391
SEARCH_RESULT
Definition: base_struct.h:66
std::vector< EDA_ITEM * > m_List
A place to hold collected objects without taking ownership of their memory.
Definition: collector.h:65
LSET m_LayerVisible
bit-mapped layer visible bits
Definition: collectors.h:403
virtual bool IgnoreModulesOnBack() const =0
virtual bool IgnoreMTextsOnFront() const =0
virtual bool IncludeSecondary() const =0
Determine if the secondary criteria or 2nd choice items should be included.
bool IgnoreMTextsMarkedNoShow() const override
Definition: collectors.h:546
void SetIgnoreNonVisibleLayers(bool ignore)
Definition: collectors.h:513
SEARCH_RESULT Inspect(EDA_ITEM *testItem, void *testData) override
The examining function within the INSPECTOR which is passed to the Iterate function.
Definition: collectors.cpp:151
bool IncludeSecondary() const override
Determine if the secondary criteria, or 2nd choice items should be included.
Definition: collectors.h:540
void SetIgnoreThroughHolePads(bool ignore)
Definition: collectors.h:589
void SetIgnoreZoneFills(bool ignore)
Definition: collectors.h:616
void SetIncludeSecondary(bool include)
Definition: collectors.h:541
virtual ~COLLECTORS_GUIDE()
Definition: collectors.h:68
void SetIgnorePadsOnBack(bool ignore)
Definition: collectors.h:577