next up previous contents
Next: VisitorMap Up: Visitors Previous: Visitors   Contents


CascadingMap

CascadingMap is declared in suifkernel/cascading_map.h. A CascadingMap<T> is a template class which maps objects to T values. The T values must have copy operations and an inequality test. A default T value is provided to the constructor; this is returned for objects with no binding. The operations are

Here is an example of use:

        // register the data
        CascadingMap<char> *map = new CascadingMap<char>(suif_env);
        char *my_info1 ="procedure";
        char *my_info2 ="statement";
        map->assign( ProcedureDefinition::get_class_name(), my_info1 );
        map->assign( Statement::get_class_name(), my_info2 );
                      
        // Pick an object:
        SuifObject *so;
        ...
        map->lookup(so);
        // returns procedure for any procedure definition,
        // returns my_info2 for any statement (or subclass)
        // returns 0 for anything else



SUIF Nightly Build
2000-08-14