ParameterMap Driver::parameters() { if(!isValid()) { return ParameterMap(); } ParameterMap parameterMap; const JSList *parameters = jackctl_driver_get_parameters(_jackDriver); while(parameters) { Parameter p = Parameter((jackctl_parameter_t*)parameters->data); parameterMap.insert(p.name(), p); parameters = parameters->next; } return parameterMap; }
// Attempts to instance a font effect from an instancer registered with the factory. FontEffect* Factory::InstanceFontEffect(const String& name, const PropertyDictionary& properties) { bool set_colour = false; Colourb colour(255, 255, 255); bool set_z_index = false; float z_index = 0; int specificity = -1; FontEffectInstancerMap::iterator iterator = font_effect_instancers.find(name); if (iterator == font_effect_instancers.end()) return NULL; FontEffectInstancer* instancer = iterator->second; // Turn the generic, un-parsed properties we've got into a properly parsed dictionary. const PropertySpecification& property_specification = (*iterator).second->GetPropertySpecification(); PropertyDictionary parsed_properties; for (PropertyMap::const_iterator i = properties.GetProperties().begin(); i != properties.GetProperties().end(); ++i) { specificity = Math::Max(specificity, i->second.specificity); // Check for the 'z-index' property; we don't want to send this through. if (i->first == Z_INDEX) { set_z_index = true; z_index = i->second.value.Get< float >(); } else if (i->first == COLOR) { static PropertyParserColour colour_parser; Property colour_property; if (colour_parser.ParseValue(colour_property, i->second.value.Get< String >(), ParameterMap())) { colour = colour_property.value.Get< Colourb >(); set_colour = true; } } else { property_specification.ParsePropertyDeclaration(parsed_properties, (*i).first, (*i).second.value.Get< String >(), (*i).second.source, (*i).second.source_line_number); } } // Set the property defaults for all unset properties. property_specification.SetPropertyDefaults(parsed_properties); // Compile an ordered list of the values of the properties used to generate the effect's // textures and geometry. typedef Container::list< Container::pair< String, String >::Type >::Type GenerationPropertyList; GenerationPropertyList generation_properties; for (PropertyMap::const_iterator i = parsed_properties.GetProperties().begin(); i != parsed_properties.GetProperties().end(); ++i) { if (instancer->volatile_properties.find(i->first) != instancer->volatile_properties.end()) { GenerationPropertyList::iterator j = generation_properties.begin(); while (j != generation_properties.end() && j->first < i->first) ++j; generation_properties.insert(j, GenerationPropertyList::value_type(i->first, i->second.value.Get< String >())); } } String generation_key; for (GenerationPropertyList::iterator i = generation_properties.begin(); i != generation_properties.end(); ++i) { generation_key += i->second; generation_key += ";"; } // Now we can actually instance the effect! FontEffect* font_effect = (*iterator).second->InstanceFontEffect(name, parsed_properties); if (font_effect == NULL) return NULL; font_effect->name = name; font_effect->generation_key = generation_key; if (set_z_index) font_effect->SetZIndex(z_index); if (set_colour) font_effect->SetColour(colour); font_effect->SetSpecificity(specificity); font_effect->instancer = (*iterator).second; return font_effect; }
// =========================================================================== // member method definitions // =========================================================================== MSOffTrafficLightLogic::MSOffTrafficLightLogic(MSTLLogicControl& tlcontrol, const std::string& id) : MSTrafficLightLogic(tlcontrol, id, "off", 0, ParameterMap()) { myDefaultCycleTime = TIME2STEPS(120); }