Ejemplo n.º 1
0
 const TValue get(const TId id) const final {
     if (id >= m_elements.size()) {
         not_found_error(id);
     }
     if (m_elements[id] == osmium::index::empty_value<TValue>()) {
         not_found_error(id);
     }
     return m_elements[id];
 }
Ejemplo n.º 2
0
 const TValue get(const TId id) const final {
     try {
         const TValue& value = m_vector.at(id);
         if (value == osmium::index::empty_value<TValue>()) {
             not_found_error(id);
         }
         return value;
     } catch (std::out_of_range&) {
         not_found_error(id);
     }
 }
Ejemplo n.º 3
0
 const TValue get(const TId id) const override final {
     try {
         return m_elements.at(id);
     } catch (std::out_of_range&) {
         not_found_error(id);
     }
 }
Ejemplo n.º 4
0
 const TValue get(const TId id) const final {
     auto it = m_elements.find(id);
     if (it == m_elements.end()) {
         not_found_error(id);
     }
     return it->second;
 }
Ejemplo n.º 5
0
		void *data() const
		{
			if (m_index > m_size)
				throw not_found_error("null pointer exception");
			else if (m_index == m_size)
				return NULL;
			else
				return reinterpret_cast<char*>(m_data->get()) + m_index;
		}
Ejemplo n.º 6
0
HttpServlet& loader::get(request_rec* r) {
//         cout << "loader::get" << endl;
    if (r->finfo.filetype == APR_NOFILE)
        throw not_found_error(r->filename);
    if (r->finfo.filetype != APR_REG)
        throw runtime_error("Requested file is not a regural file. ");
    pool_entry &entry = load(r->filename);
    entry.atime = r->request_time;
    return *entry.servlet;
}
Ejemplo n.º 7
0
 const TValue get(const TId id) const final {
     const element_type element {
         id,
         osmium::index::empty_value<TValue>()
     };
     const auto result = std::lower_bound(m_vector.begin(), m_vector.end(), element, [](const element_type& a, const element_type& b) {
         return a.first < b.first;
     });
     if (result == m_vector.end() || result->first != id) {
         not_found_error(id);
     } else {
         return result->second;
     }
 }
Ejemplo n.º 8
0
static void throw_error_detail(int err, const std::string &message)
{
	switch (err) {
		case -ENOENT:
			throw not_found_error(message);
			break;
		case -ETIMEDOUT:
			throw timeout_error(message);
			break;
		default:
			throw error(err, message);
			break;
	}
}
Ejemplo n.º 9
0
void error_info::throw_error() const
{
	switch (m_code) {
		case -ENOENT:
			throw not_found_error(m_message);
			break;
		case -ETIMEDOUT:
			throw timeout_error(m_message);
			break;
		case -ENOMEM:
			throw std::bad_alloc();
			break;
		case -ENXIO:
			throw no_such_address_error(m_message);
			break;
		case 0:
			// Do nothing, it's not an error
			break;
		default:
			throw error(m_code, m_message);
			break;
	}
}
Ejemplo n.º 10
0
		T *data() const
		{
			if (m_index + sizeof(T) > m_size)
				throw not_found_error("null pointer exception");
			return reinterpret_cast<T *>(data());
		}
Ejemplo n.º 11
0
 const TValue get(const TId id) const override final {
     not_found_error(id);
 }