Example #1
0
result_list runner::test_range(files_iterator begin, files_iterator end, std::reference_wrapper<report_type> report) const
{
    config defaults;
    result_list results;

    for (runner::files_iterator i = begin; i != end; i++)
    {
        runner::path_type const & file = *i;
        if (file.extension() == ".xml")
        {
            try
            {
                result_list r = test_one(file, defaults, report);
                std::move(r.begin(), r.end(), std::back_inserter(results));
            }
            catch (std::exception const& ex)
            {
                result r;
                r.state = STATE_ERROR;
                r.name = file.string();
                r.error_message = ex.what();
                results.emplace_back(r);
                mapnik::util::apply_visitor(report_visitor(r), report.get());
            }
        }
    }

    return results;
}
Example #2
0
 static std::shared_ptr<Data> get(std::reference_wrapper<T> obj, bool t_return_value)
 {
   auto p = &obj.get();
   return std::make_shared<Data>(
         detail::Get_Type_Info<T>::get(),
         chaiscript::detail::Any(std::move(obj)),
         true,
         p,
         t_return_value
       );
 }
Example #3
0
void jsonStoreInterpolations(std::reference_wrapper<RevisionThree> json, const InterpolationList &interpolations)
{
    namespace Base64VLQ = SourceMap::intern::Base64VLQ;
    if (interpolations.empty()) return; // nothing to store

    QString encoded;
    for(const auto& p : interpolations) {
        Base64VLQ::encode(encoded, static_cast<int>(p.first));
        Base64VLQ::encode(encoded, p.second);
    }
    json.get().insert(INTERPOLATIONS_KEY, encoded);
}
Example #4
0
result_list runner::test_range(files_iterator begin,
                               files_iterator end,
                               std::reference_wrapper<report_type> report,
                               std::reference_wrapper<std::atomic<std::size_t>> fail_count) const
{
    result_list results;

    for (runner::files_iterator i = begin; i != end; i++)
    {
        runner::path_type const & file = *i;
        if (file.extension() == ".xml")
        {
            try
            {
                result_list r = test_one(file, report, fail_count.get());
                std::move(r.begin(), r.end(), std::back_inserter(results));
            }
            catch (std::exception const& ex)
            {
                result r;
                r.state = STATE_ERROR;
                r.name = file.string();
                r.error_message = ex.what();
                r.duration = std::chrono::high_resolution_clock::duration::zero();
                results.emplace_back(r);
                mapnik::util::apply_visitor(report_visitor(r), report.get());
                ++fail_count.get();
            }
        }
        if (fail_limit_ && fail_count.get() >= fail_limit_)
        {
            break;
        }
    }

    return results;
}
Example #5
0
 void operator() ()
 {
     results.get().call = true;
 }
 void consume(std::reference_wrapper<T>& x) {
   return consume(x.get());
 }
Example #7
0
 void operator()(msgpack::object::with_zone& o, const std::reference_wrapper<T>& v) const {
     msgpack::adaptor::object_with_zone<typename std::remove_const<T>::type>()(o, v.get());
 }
 /**
  * Write implementation delegated to the underlying sink
  * 
  * @param buffer source buffer
  * @param length number of bytes to process
  * @return number of bytes processed
  */
 std::streamsize write(const char* buffer, std::streamsize length) {
     return sink.get().write(buffer, length);
 }
Example #9
0
 ranges::reference_wrapper<T> operator()(std::reference_wrapper<T> ref) const
 {
     return ranges::ref(ref.get());
 }
Example #10
0
 output_stream(std::reference_wrapper<std::ostream> os)
   : write_f(make_std_ostream_write_function(os.get()))
 {}
 /**
  * Read implementation delegated to the underlying source
  * 
  * @param buffer output buffer
  * @param length number of bytes to process
  * @return number of bytes processed
  */
 std::streamsize read(char* buffer, std::streamsize length) {
     return src.get().read(buffer, length);
 }
 /**
  * Underlying source accessor
  * 
  * @return underlying source reference
  */
 Source& get_source() {
     return src.get();
 }
Example #13
0
		optional(const std::reference_wrapper<Tc>& t) : optional(std::addressof(t.get())) {

		}
 /**
  * Flushes destination sink
  * 
  * @return number of bytes flushed
  */
 std::streamsize flush() {
     return sink.get().flush();
 }
Example #15
0
 void wait() {
     m_task.get().wait();
 }
 /**
  * Underlying sink accessor
  * 
  * @return underlying sink reference
  */
 Sink& get_sink() {
     return sink.get();
 }
Example #17
0
 void cancel() {
     m_task.get().cancel();
 }
Example #18
0
 reference_wrapper<T> operator()(std::reference_wrapper<T> t) const
 {
     return {t.get()};
 }
Example #19
0
 bool completed() {
     return m_task.get().completed();
 }
Example #20
0
 static inline bool cmp(const T& lhs, const std::reference_wrapper<U>& rhs) {
     return vg_cmp<T>::_(lhs, rhs.get());
 }
Example #21
0
 void setCompleteCallback(std::function<void(bool success)> func) {
     m_task.get().setCompleteCallback(func);
 }
			/// \brief Get the best architecture that can be achieved using one of the specified hits
			///        that all stop at the same boundary
			///
			/// \todo Consider getting arg_start_arrow from arg_bests
			///
			/// Note: Not using max_element because that'd probably call get_complex_hit_score() twice for many elements
			inline scored_arch_proxy_opt hit_resolver::get_best_scored_arch_with_one_of_hits(const boost::sub_range<boost::integer_range<hitidx_t>> &arg_hit_indices,  ///< The indices of the hits to consider
			                                                                                 const calc_hit_vec                                     &arg_mask,         ///< The active mask defining no-go regions
			                                                                                 const res_arrow                                        &arg_start_arrow,  ///< The start point of the current scan (from which arg_bests should have results (up to the one place before the stop of these hits))
			                                                                                                                                                           ///< Guaranteed to be at the boundary of a segment in arg_masks, or at the very start if arg_masks is empty
			                                                                                 const best_scan_arches                                 &arg_bests,        ///< The history of best-seen architectures so far in this layer of dynamic programming. This is setup to handle the current forbidden arg_masks.
			                                                                                 const resscr_t                                         &arg_score_to_beat ///< The existing score to beat. This is setup to handle the current forbidden arg_masks.
			                                                                                 ) {
				// Loop over each of the hits that stop at arg_current_arrow
				scored_arch_proxy_opt best_so_far;
				for (const auto &hit_index : arg_hit_indices) {
					const auto &the_hit = hits.get()[ hit_index ];

					// If this hit clashes with the forbidden regions marked out by arg_mask,
					// then it can't be used so skip to the next one
					if ( hit_overlaps_with_any_of_hits( the_hit, arg_mask ) ) {
						continue;
					}

					// If the hit is contiguous, then the score/arch is just the sum of:
					//  * the score/arch of this hit itself
					//  * the best score/arch before the start
					//
					// (and we know that the local best_scan_arches will include an entry for the hit's start_arrow because
					//  the hit must be within this scan because the hit is contiguous and arg_start_arrow is never within
					//  the middle of a free stretch)
					//
					// If that's an improvement on best_so_far/arg_score_to_beat then update best_so_far
					if ( ! the_hit.is_discontig() ) {
						update_best_if_hit_improves(
							best_so_far,
							the_hit.get_score(),
							hit_index,
							arg_bests.get_best_scored_arch_up_to_arrow( the_hit.get_start_arrow() ),
							arg_score_to_beat
						);
					}
					// Else if the hit is discontiguous...
					else {
						const auto &hit_start = the_hit.get_start_arrow();

						const scored_arch_proxy &best_hit_complement =
							// If the discontiguous hit is within this region
							//   (ie hit_start >= arg_start_arrow;
							//    we already know it must stop before the end of scan, else we wouldn't be considering it)
							//
							// Then the score/arch is the sum of:
							//  * the score/arch of this hit itself
							//  * the best score/arch that can be found by recursing into a new layer of dynamic-programming:
							//    [ up to the end of the hit that doesn't clash with arg_mask or the_hit;
							//      starting from the start of this hit, by using the (already calculated) best score/arch up to that point ]
							( hit_start >= arg_start_arrow ) ? get_best_score_and_arch_of_specified_regions(
								arg_mask + the_hit,
								get_stop_of_first_segment( the_hit ),
								get_start_of_last_segment( the_hit ),
								arg_bests.get_best_scored_arch_up_to_arrow( hit_start )
							) :

							// Else this is a discontiguous hit that starts before arg_start_arrow
							//
							// Then the score/arch is the sum of:
							//  * the score/arch of this hit itself
							//  * the best score/arch that can be found by recursing into a new layer of dynamic programming:
							//    [ up to the end of the hit that doesn't clash with arg_mask or the_hit;
							//      starting from start_arrow again, by using the previously recorded partial pickup of
							//      best score/arch up to there that doesn't clash with (arg_mask + the_hit) ]
							get_best_score_and_arch_of_specified_regions(
								arg_mask + the_hit,
								arg_start_arrow,
								get_start_of_last_segment( the_hit ),
								get_best_for_masks_up_to_arrow( the_masked_bests_cache, arg_mask + the_hit, arg_start_arrow )
							);

						// If that's an improvement on best_so_far/arg_score_to_beat then update best_so_far
						update_best_if_hit_improves(
							best_so_far,
							the_hit.get_score(),
							hit_index,
							best_hit_complement,
							arg_score_to_beat
						);
					}
				}

				// Return result
				return best_so_far;
			}
Example #23
0
 void setProblemCallback(std::function<void(Problem)> func) {
     m_task.get().setProblemCallback(func);
 }
Example #24
0
    int operator()(atapp::app &app, atbus::endpoint &ep, int status) {
        WLOGINFO("node 0x%llx disconnected, status: %d", static_cast<unsigned long long>(ep.get_id()), status);

        atproxy_mgr_module.get().on_disconnected(app, ep.get_id());
        return 0;
    }
Example #25
0
 auto operator()(std::reference_wrapper<T> rw){
   return (*this)(rw.get());
 }