#include "campmode.h"
#include <QString>
cAmpMode::cAmpMode()
{

}

cAmpMode::cAmpMode(std::string name, unsigned int ratedImp, unsigned int ratedPower){
    m_name=name;
    m_ratedImp=ratedImp;
    m_ratedPower=ratedPower;
}

std::string cAmpMode::getName()
{
    return m_name;
}

unsigned int cAmpMode::getRatedImp()
{
    return m_ratedImp;
}

unsigned int cAmpMode::getRatedPower()
{
    return m_ratedPower;
}

void cAmpMode::print()
{
    std::cout << "Mode: "<< m_name<<" ("<<m_ratedImp<<" Ohm, "<<m_ratedPower<<" W)"<<std::endl;
}

QDataStream& operator <<(QDataStream& out, cAmpMode& mode){
    out << QString::fromStdString(mode.m_name);
    out << (uint)mode.m_ratedImp;
    out << (uint)mode.m_ratedPower;
    return out;
}

QDataStream& operator >>(QDataStream& in, cAmpMode& mode){
    QString name;
    in >> name;
    mode.m_name=name.toStdString();

    uint imp;
    in >> imp;
    mode.m_ratedImp=(unsigned int)imp;

    uint power;
    in >> power;
    mode.m_ratedPower=(unsigned int)power;

    return in;
}
