In addition to usual information such as name, stage and place notation, some method collections contain further information. For example, the Central Council method collections contain the date and place of the first peal in each method. To give access to such information, the Ringing Class Library has a fully typed system of method facets.
A facet is something which has a C++ type, and which may or may not be part of an entry in a method library. A few facets are declared as standard; library types are free to declare new facets of their own.
For example, one of the standard facets is called rw_ref
and is
of type string
. The facet is intended to contain a string citing
the method's appearance in the Ringing World. The following code
checks to see whether the first entry in the library l
contains
this information, and if so prints it.
library::iterator i = l.begin(); if( i->has_facet< rw_ref >() ) cout << i->get_facet< rw_ref >();
For more information on these functions, see The library_entry class.