void DeviceInstance::ThrowError(const std::string& message) const { CMMError e = CMMError(message, MakeException()); LOG_ERROR(Logger()) << e.getFullMsg(); throw e; }
void ACacheManager::PushIntoCache(double lat, double lng, uint x, uint y, std::vector<SpectrumChannel>& vec) { LogD(0, "PushIntoCache(%lf, %lf, %d, %d, *vec*)\n", lat, lng, x, y); if (m_ChannelsRAMCache == nullptr || m_ChannelsDiskCache == nullptr) throw MakeException(std::runtime_error, std::string("You have to initialize the cache before calling ") + __func__ + "() function"); m_ChannelsRAMCache->Push(x, y, vec); m_ChannelsDiskCache->WriteData(lat, lng, vec); }
void ACacheManager::InitializeCache(uint cell_width_count, uint cell_height_count) { LogD(0, "InitializeCache(%d, %d)\n", cell_width_count, cell_height_count); if (m_ChannelsRAMCache != nullptr || m_ChannelsDiskCache != nullptr) throw MakeException(std::runtime_error, std::string("The cache is already initialized.. which is a problem!")); m_ChannelsRAMCache = new SpectrumChannelsRAMCache(cell_width_count, cell_height_count); m_ChannelsDiskCache = new SpectrumChannelsDiskCache(GetCurrentConfiguration()); }
std::ostream& Image::serialize(std::ostream& ostr) const { if (ostr.bad()) throw MakeException("Bad output stream while serializing image"); ostr.put(0); ostr.put(0); ostr.put(2); /* RGB without compression */ ostr.put(0); ostr.put(0); ostr.put(0); ostr.put(0); ostr.put(0); ostr.put(0); ostr.put(0); /* X origin */ ostr.put(0); ostr.put(0); /* Y origin */ ostr.put((width & 0x00FF)); ostr.put((width & 0xFF00) / 256); ostr.put((height & 0x00FF)); ostr.put((height & 0xFF00) / 256); ostr.put(32); /* 32 bits*/ ostr.put(0); ostr.write((char*)rgba, sizeof(uint) * width * height); return ostr; }
void Run(void) override { MakeException(); }
std::vector<SpectrumChannel> ACacheManager::GetFromCache(uint x, uint y) { LogD(0, "GetFromCache(%d, %d)\n", x, y); if (m_ChannelsRAMCache == nullptr) throw MakeException(std::runtime_error, std::string("You have to initialize the cache before calling ") + __func__ + "() function"); return m_ChannelsRAMCache->Get(x, y); }