Extended MaximInterface

Dependents:   mbed_DS28EC20_GPIO

Revision:
8:211d1b8f730c
Parent:
7:471901a04573
--- a/Utilities/FlagSet.hpp	Tue Jul 24 08:33:31 2018 +0000
+++ b/Utilities/FlagSet.hpp	Wed Apr 03 12:33:10 2019 +0000
@@ -38,6 +38,7 @@
 
 namespace MaximInterface {
 
+/// @brief
 /// Provides functionality similar to std::bitset except using a bit flag,
 /// typically of an enum type, as the indexer.
 template <typename Flag, size_t flagBits> class FlagSet {
@@ -45,15 +46,20 @@
   class reference {
   public:
     reference(FlagSet & flagSet, Flag flag) : flagSet(&flagSet), flag(flag) {}
+    
     reference & operator=(bool x) {
       flagSet->set(flag, x);
       return *this;
     }
+    
     reference & operator=(const reference & x) {
       return operator=(static_cast<bool>(x));
     }
+    
     operator bool() const { return flagSet->test(flag); }
+    
     bool operator~() const { return reference(*this).flip(); }
+    
     reference & flip() {
       *this = !*this;
       return *this;
@@ -65,6 +71,7 @@
   };
 
   FlagSet() : bits() {}
+  
   FlagSet(unsigned long val) : bits(val) {}
 
   template <typename CharT, typename Traits, typename Alloc>
@@ -76,38 +83,58 @@
       : bits(str, pos, n) {}
 
   bool operator==(const FlagSet & rhs) const { return bits == rhs.bits; }
+  
   bool operator!=(const FlagSet & rhs) const { return !operator==(rhs); }
 
-  // Element access
+  /// @name Element access
+  /// @{
+  
   bool operator[](Flag flag) const { return test(flag); }
+  
   reference operator[](Flag flag) { return reference(*this, flag); }
+  
   bool test(Flag flag) const { return (bits.to_ulong() & flag) == flag; }
+  
   bool any() const { return bits.any(); }
+  
   bool none() const { return bits.none(); }
+  
   size_t count() const { return bits.count(); }
+  
+  /// @}
 
-  // Capacity
+  /// @name Capacity
+  /// @{
+  
   size_t size() const { return bits.size(); }
+  
+  /// @}
 
-  // Modifiers
+  /// @name Modifiers
+  /// @{
+  
   FlagSet & operator&=(const FlagSet & other) {
     bits &= other.bits;
     return *this;
   }
+  
   FlagSet & operator|=(const FlagSet & other) {
     bits |= other.bits;
     return *this;
   }
+  
   FlagSet & operator^=(const FlagSet & other) {
     bits ^= other.bits;
     return *this;
   }
+  
   FlagSet operator~() const { return ~bits; }
 
   FlagSet & set() {
     bits.set();
     return *this;
   }
+  
   FlagSet & set(Flag flag, bool value = true) {
     if (value) {
       bits |= flag;
@@ -116,26 +143,37 @@
     }
     return *this;
   }
+  
   FlagSet & reset() {
     bits.reset();
     return *this;
   }
+  
   FlagSet & reset(Flag flag) { return set(flag, false); }
+  
   FlagSet & flip() {
     bits.flip();
     return *this;
   }
+  
   FlagSet & flip(Flag flag) {
     bits ^= flag;
     return *this;
   }
+  
+  /// @}
 
-  // Conversions
+  /// @name Conversions
+  /// @{
+  
   template <typename CharT, typename Traits, typename Allocator>
   std::basic_string<CharT, Traits, Allocator> to_string() const {
     return bits.template to_string<CharT, Traits, Allocator>();
   }
+  
   unsigned long to_ulong() const { return bits.to_ulong(); }
+  
+  /// @}
 
 private:
   std::bitset<flagBits> bits;
@@ -185,4 +223,4 @@
 
 } // namespace MaximInterface
 
-#endif
\ No newline at end of file
+#endif