+/*
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
#ifndef SQUID_DESCRIPTOR_SET_H
#define SQUID_DESCRIPTOR_SET_H
-#include "squid.h"
-
-/** \ingroup Comm
+#include <iosfwd>
- \todo: Should we use std::set<int> with its flexibility? Our implementation
+/* TODO: Should we use std::set<int> with its flexibility? Our implementation
has constant overhead, which is smaller than log(n) of std::set.
-
-an unordered collection of unique descriptors with O(1) add/del/has ops */
-class DescriptorSet {
+*/
+/// An unordered collection of unique descriptors with O(1) add/del/has ops
+class DescriptorSet
+{
public:
// for STL compatibility, should we decide to switch to std::set or similar
typedef const int *const_iterator;
~DescriptorSet();
/// checks whether fd is in the set
- bool has(const int fd) const { return 0 <= fd && fd < capacity_ &&
- index_[fd] >= 0; }
+ bool has(const int fd) const {
+ return 0 <= fd && fd < capacity_ &&
+ index_[fd] >= 0;
+ }
bool add(int fd); ///< adds if unique; returns true if added
bool del(int fd); ///< deletes if there; returns true if deleted