#include "typedefs.h"
#include "sim/Car.h"
#include "sim/Sector.h"

std::ostream& operator<<(std::ostream &oss, const CarVector &cv)
{
	oss << "(" << cv.size() << ")[";
	for (unsigned i = 0; i < cv.size(); i++) oss << cv[i]->getID() << (i == cv.size()-1 ? "" : ",");
	oss << "]";
	return oss;
}

std::ostream& operator<<(std::ostream &oss, const Line &l)
{
	oss << "a=" << l._a << ", b=" << l._b; return oss;
}

std::ostream& operator<<(std::ostream &oss, const Polygon &p)
{
	oss << "P(" << p.size() << ";";
	for (unsigned i = 0; i < p.size(); i++) oss << p[i] << (i == p.size()-1 ? "" : ";");
	oss << ")";
	return oss;
}

std::ostream& operator<<(std::ostream &oss, const Polygon* p)
{
	oss << "P(" << p->size() << ";";
	for (unsigned i = 0; i < p->size(); i++) oss << p->at(i) << (i == p->size()-1 ? "" : ";");
	oss << ")";
	return oss;
}

std::ostream& operator<<(std::ostream &oss, const PVector3r &p)
{
	oss << "PV(" << p._pos << "," << p._dir << ")";
	return oss;
}

std::ostream& operator<<(std::ostream &oss, const PVector3r* p)
{
	oss << "PV(" << p->_pos << "," << p->_dir << ")";
	return oss;
}

std::ostream& operator<<(std::ostream &oss, const SectorCarMapping &sm)
{
	oss << "(" << sm.size() << ")[";
	for (SectorCarMapping::const_iterator it = sm.begin(); it != sm.end(); it++)
		oss << "S" << (*it).first->getID() << ":C" << (*it).second.first->getID() << "(" << (*it).second.second << "),";
	oss << "]";
	return oss;
}

std::ostream& operator<<(std::ostream &oss, const SectorDeque &sd)
{
	oss << "(" << sd.size() << ")[";
	for (unsigned i = 0; i < sd.size(); i++) oss << sd[i]->getID() << (i == sd.size()-1 ? "" : ",");
	oss << "]";
	return oss;
}
