en:toolworks:docs:apparatus:filter

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:toolworks:docs:apparatus:filter [2021/09/03 13:41] vladiusen:toolworks:docs:apparatus:filter [2022/06/07 23:18] (current) vladius
Line 1: Line 1:
-====== Filters ======+====== Filtering ======
  
-Filters present a way to narrow down the iterating process down to Subjects and Subjectives with only certain combinations of Traits and Details. Filtering can be both including (positive) and excluding (negative). Including means that a Subject (or Subjective) must definitely have Traits (or Details) from the list. Excluding means otherwise - it must *not* have any of those.+//Filtering// represents a way to narrow down the [[en:toolworks:docs:apparatus:iterating|iterating]] (or [[en:toolworks:docs:apparatus:operating|operating]]) process down to Entities with only certain combinations of Components (or the lack of). The filtering specification is represented by a special data structure called //Filter//. Filtering can be both //including// (positive) and //excluding// (negative). In Apparatus you can combine any types of Components in the filters, i.e. both Traits and Details can be used __at the same time__ within the same Filter.
  
-The positive and negative parts can and should be used along with each other. Remember, that Apparatus is heavily optimized for all sorts of filtering involved, it doesn't exactly "search" for data but uses some fast masking procedures. Testing with a Filter of 100 Details is roughly the same as testing with a single one.+===== Including =====
  
-===== C++ Workflow =====+The including filtering specifies what Components a Subject (or Subjective) must certainly have in order to be matched by the filter (and thereby processed by the Mechanic). The including filterting of the Details supports the inheritance model, so if you include some base Detail class in the Filter, the descendants will match.
  
-What you do is you basically create a [[appi>struct_f_filter.html|FFilter]] instance. There are different constructors and methods available for this struct and you can use the most fitting for your case. As an example, let's create a Filter of one Trait and one Detail, valid for Booted Subjects only (this is the default):<code cpp> +===== Excluding =====
-#include "Filter.h"+
  
-...+The excluding filtering is exactly the opposite of the including oneIt specifies a list of Components (Traits and Details) that must __not__ exist within the Subject or Subjective in order to be matched by the filter. 
 + 
 +The positive and negative parts of the filters can and should be used along with each otherApparatus is heavily optimized for all sorts of filtering involved, so it doesn't exactly "search" for data but uses some fast masking procedures internally. Matching against a Filter of 100 Details is roughly the same as matching agains a single-Detail Filter. 
 + 
 +===== C++ Workflow =====
  
-FFilter MyFilter(EBootFilter::Booted); +What you do is you basically create a [[appi>struct_f_filter.html|FFilter]] instanceThere are different constructors, makers and methods available for this struct and you can use the most fitting for your case. As an example, let's create a Filter of one Trait and one Detail:<code cpp
-Filter.Include<UMyDetail>(); +FFilter MyFilter = FFilter::Make<UMyDetail, FMyTrait>();
-Filter.Include<FMyTrait>();+
 </code> </code>
  
  • en/toolworks/docs/apparatus/filter.1630665716.txt.gz
  • Last modified: 2021/09/03 13:41
  • by vladius