Filter description (API) More...
Public Member Functions | |
GenericFilter< Type > | operator! () const |
virtual Filter< Type > * | getClone () const =0 |
virtual bool | accept (Type type) const =0 |
Filter description (API)
A filter is a functional object which, used in conjunction with a collection, allows to get only the elements of this collection which meet some criteria.
This class is an abstract class which must be derived in order to get the appropriate behaviour.
You will have also to define the default constructor, the copy constructor, the assignment operator and overload the two following member functions :
Definition of the filter selecting external nets of a cell :
Implementation of the accessor getExternalNets for the cells :
Similarly, the accessor getInternalNets can be implemented using the ! operator :
In order to implement previous examples we could have used filter with a simpler interface. Now the filters as they are defined open the door to much more complex processing.
As a matter of fact the function accept receives only one argument which represents the element of the collection to be accepted or rejected.
Sometimes the filter must take into account other criteria. For example to print the external nets of a cell whose name start with a given character. Those additional criteria will then become attributes of the filter as shown in the following example :
Filter definition :
Afterwards do
Although this example is not of great interest, it illustrates the way to proceed to create a complex filter.
|
inline |
Returns: the inverse filter of the filter <this>
(accepted elements are those rejected and conversely).
|
pure virtual |
It is wise to use filters only when it is trully necessary, that is to produce useful collections to be used extensively.
Indeed, for the previous example, preferably write it like this :
or more simply :
Filters are objects like any other : they can be passed as function arguments as shown below :
As far as the type NetFilter is defined as being a GenericFilter<Net*> the previous function can be written like this :
Returns: a filter copy.
|
pure virtual |
This member function returns true if the filter accepts the element else false.
Generated by doxygen 1.9.1 on Thu Aug 11 2022 | Return to top of page |
Hurricane VLSI Database | Copyright © 2000-2020 Bull S.A. All rights reserved |