/*
 * outputHelper.h
 *
 *  Created on: 01. 03. 2021
 *      Author: Martin Prokopic
 */

#pragma once

#include <iostream>
#include <chrono>

#include <alib/vector>
#include <alib/deque>
#include <alib/measure>
#include <object/Object.h>
#include <exception/CommonException.h>
#include <alib/random>

namespace helpers {

unsigned rand ( unsigned min, unsigned max );

template < class Data >
void printCsvRow(const Data & data, std::ostream & os = std::cout) {
    bool first = true;
    for(const auto & item : data) {
        if ( ! first )
            std::cout << ",";
        first = false;
        os << item;
    }
    os << std::endl;
}

const measurements::MeasurementFrame & findFrameByName(const measurements::MeasurementResults & results, const std::string & name);

void writeResults ( const measurements::MeasurementFrame & frame, ext::vector < object::Object > data );
void writeResults ( const std::string & name, ext::vector < object::Object > data );

ext::vector < measurements::MeasurementFrame >
findFramesByName ( const measurements::MeasurementResults & results, const std::string & name );

measurements::MeasurementFrame sumFrames ( const ext::vector < measurements::MeasurementFrame > & frames );

} /* namespace helpers */