int Task_Entry::merge_frames (ACE_Unbounded_Set <Dispatch_Entry *> &dispatch_entries, Task_Entry &owner, ACE_Ordered_MultiSet <Dispatch_Entry_Link> &dest, ACE_Ordered_MultiSet <Dispatch_Entry_Link> &src, u_long &dest_period, u_long src_period, u_long number_of_calls, u_long starting_dest_sub_frame) { int status = 0; // reframe dispatches in the destination set to the new frame size // (expands the destination set's period to be the new enclosing frame) if (reframe (dispatch_entries, owner, dest, dest_period, ACE::minimum_frame_size (dest_period, src_period)) < 0) return -1; // use iterator for efficient insertion into the destination set ACE_Ordered_MultiSet_Iterator <Dispatch_Entry_Link> dest_iter (dest); // do virtual iteration over the source set in the new frame, adding // adjusted dispatch entries to the destination Dispatch_Proxy_Iterator src_iter (src, src_period, dest_period, number_of_calls, starting_dest_sub_frame); for (src_iter.first (starting_dest_sub_frame); src_iter.done () == 0; src_iter.advance ()) { // Policy: disjunctively dispatched operations get their // deadline and priority from the original dispatch - when and // if it is useful to change any of the merge policies, this // should be one of the decisions factored out into the // disjunctive merge strategy class. Dispatch_Entry *entry_ptr; ACE_NEW_RETURN (entry_ptr, Dispatch_Entry (src_iter.arrival (), src_iter.deadline (), src_iter.priority (), src_iter.OS_priority (), owner), -1); // if even one new dispatch was inserted, status is "something happened". status = 1; // add the new dispatch entry to the set of all dispatches, and // a link to it to the dispatch links for this task entry if (dispatch_entries.insert (entry_ptr) < 0) return -1; else if (dest.insert (Dispatch_Entry_Link (*entry_ptr), dest_iter) < 0) return -1; // TBD - Clients are not assigned priority, but rather obtain it // from their call dependencies. We could complain here if // there is a priority specified that doesn't match (or is lower // QoS?) } return status; }
void apply_layout_parameters( layout_attributes_t& data, const dictionary_t& parameters) { ADOBE_ONCE_INSTANCE(adobe_eve_evaluate); get_value(parameters, key_indent, data.indent_m); if (parameters.count(key_horizontal)) { (*alignment_table_g)( get_value(parameters, key_horizontal).cast<name_t>(), data.slice_m[extents_slices_t::horizontal].alignment_m); } if (parameters.count(key_vertical)) { (*alignment_table_g)( get_value(parameters, key_vertical).cast<name_t>(), data.slice_m[extents_slices_t::vertical].alignment_m); } // REVISIT (sparent) If we had named guides then named guide suppression would go here. if (parameters.count(key_guide_mask)) // an empty array would allow baselines out. { // Turn on all guides - then selectively suppress data.slice_m[extents_slices_t::vertical].suppress_m = false; data.slice_m[extents_slices_t::horizontal].suppress_m = false; array_t guide_mask(get_value(parameters, key_guide_mask).cast<array_t>()); for (array_t::const_iterator iter(guide_mask.begin()), last(guide_mask.end()); iter != last; ++iter) { if (iter->cast<name_t>() == key_guide_baseline) data.slice_m[extents_slices_t::vertical].suppress_m = true; if (iter->cast<name_t>() == key_guide_label) data.slice_m[extents_slices_t::horizontal].suppress_m = true; } } // REVISIT (sparent) : If we had named guides then named guide balancing would go here... /* Balanced guides must be supressed to avoid having them attach to outside guides which could overconstrain the system. */ if (parameters.count(key_guide_balance)) { data.slice_m[extents_slices_t::vertical].balance_m = false; data.slice_m[extents_slices_t::horizontal].balance_m = false; array_t guide_balance(get_value(parameters, key_guide_balance).cast<array_t>()); for (array_t::const_iterator iter(guide_balance.begin()), last(guide_balance.end()); iter != last; ++iter) { if (iter->cast<name_t>() == key_guide_baseline) { data.slice_m[extents_slices_t::vertical].balance_m = true; data.slice_m[extents_slices_t::vertical].suppress_m = true; } if (iter->cast<name_t>() == key_guide_label) { data.slice_m[extents_slices_t::horizontal].balance_m = true; data.slice_m[extents_slices_t::horizontal].suppress_m = true; } } } // REVISIT (sparent) : I'm seeing a pattern here - with three cases this could be factored { dictionary_t::const_iterator iter (parameters.find(key_placement)); if (iter != parameters.end()) { (*placement_table_g)(iter->second.cast<name_t>(), data.placement_m); } // Adjust defaults // Specifying a row from the parameters implies enabling baselines unless otherwise specified. if (iter != parameters.end() && data.placement_m == layout_attributes_placement_t::place_row && !parameters.count(key_guide_mask)) { data.slice_m[extents_slices_t::vertical].suppress_m = false; } } { dictionary_t::const_iterator iter (parameters.find(key_child_horizontal)); if (iter != parameters.end()) { (*alignment_table_g)( iter->second.cast<name_t>(), data.slice_m[extents_slices_t::horizontal].child_alignment_m); } } { dictionary_t::const_iterator iter (parameters.find(key_child_vertical)); if (iter != parameters.end()) { (*alignment_table_g)( iter->second.cast<name_t>(), data.slice_m[extents_slices_t::vertical].child_alignment_m); } } // spacing { dictionary_t::const_iterator iter (parameters.find(key_spacing)); if (iter != parameters.end()) { if (iter->second.type_info() == type_info<array_t>()) { const array_t& spacing_array = iter->second.cast<array_t>(); data.spacing_m.resize(spacing_array.size() + 1); layout_attributes_t::spacing_t::iterator dest_iter(data.spacing_m.begin() + 1); for (array_t::const_iterator iter(spacing_array.begin()); iter != spacing_array.end(); ++iter) { *dest_iter = iter->cast<long>(); ++dest_iter; } } else { double tmp(data.spacing_m[1]); iter->second.cast(tmp); // Try getting as number data.spacing_m[1] = long(tmp); } } } // margin { dictionary_t::const_iterator iter(parameters.find(key_margin)); if (iter != parameters.end()) { if (iter->second.type_info() == type_info<array_t>()) { const array_t& margin_array = iter->second.cast<array_t>(); data.vertical().margin_m.first = margin_array[0].cast<long>(); data.horizontal().margin_m.first = margin_array[1].cast<long>(); data.vertical().margin_m.second = margin_array[2].cast<long>(); data.horizontal().margin_m.second = margin_array[3].cast<long>(); } else { long margin = iter->second.cast<long>(); data.vertical().margin_m.first = margin; data.horizontal().margin_m.first = margin; data.vertical().margin_m.second = margin; data.horizontal().margin_m.second = margin; } } } }