BlinkenArea - GitList
Repositories
Blog
Wiki
libetherpix
Code
Commits
Branches
Tags
Search
Tree:
653cc09
Branches
Tags
master
libetherpix
simulator
distri.cpp
continue implementing config file parsing
Stefan Schuermans
commited
653cc09
at 2017-06-10 20:17:07
distri.cpp
Blame
History
Raw
/* * EtherPix simulator * * Copyright 2017 Stefan Schuermans <stefan schuermans info> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <sstream> #include <stdexcept> #include "distri.h" /// constructor Distri::Distri(): m_distno(0), m_outputs(0), m_pixels(0) { } /** * @brief initialize * @param[in] distno distributor number * @param[in] outputs number of outputs * @param[in] pixels number of pixels per output */ void Distri::init(unsigned long distno, unsigned long outputs, unsigned long pixels) { m_distno = distno; m_outputs = outputs; m_pixels = pixels; } /** * @brief get mapping * @param[in] chan color channel * @return mapping mapping object of color channel * @throws std::exception in case of error */ Mapping const& Distri::getMapping(Mapping::Channel chan) const { if (chan >= Mapping::ChannelCount) { std::stringstream msg; msg << "invalid channel: " << chan; throw std::runtime_error(msg.str()); } return m_mappings[chan]; } /** * @brief set mapping * @param[in] chan color channel * @param[in] mapping new mapping object for color channel * @throws std::exception in case of error */ void Distri::setMapping(Mapping::Channel chan, Mapping const &mapping) { if (chan >= Mapping::ChannelCount) { std::stringstream msg; msg << "invalid channel: " << chan; throw std::runtime_error(msg.str()); } m_mappings[chan] = mapping; }