Move file suffixes out of the Session class and into filename_extensions.h/cc
[ardour.git] / libs / ardour / ardour / chan_count.h
index 2ef49793d1025a5b77f6e56a4fee37e260684543..35052e4aea27aad41fcb8b4a968d1af08e739d04 100644 (file)
@@ -34,7 +34,7 @@ public:
        ChanCount(DataType type, size_t channels)
        {
                reset();
-               set_count(type, channels);
+               set(type, channels);
        }
 
        void reset()
@@ -43,11 +43,15 @@ public:
                        _counts[(*t).to_index()] = 0;
                }
        }
+       
+       // -1 is what to_index does.  inlined for speed.  this should maybe be changed..
+       inline size_t n_audio() const { return _counts[DataType::AUDIO-1]; }
+       inline size_t n_midi()  const { return _counts[DataType::MIDI-1]; }
 
-       void   set_count(DataType type, size_t count) { _counts[type.to_index()] = count; }
-       size_t get_count(DataType type) const { return _counts[type.to_index()]; }
+       void   set(DataType type, size_t count) { _counts[type.to_index()] = count; }
+       size_t get(DataType type) const { return _counts[type.to_index()]; }
        
-       size_t get_total_count() const
+       size_t get_total() const
        {
                size_t ret = 0;
                for (size_t i=0; i < DataType::num_types; ++i)
@@ -70,7 +74,41 @@ public:
                return ! (*this == other);
        }
 
+       bool operator<(const ChanCount& other) const
+       {
+               for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
+                       if (_counts[(*t).to_index()] > other._counts[(*t).to_index()]) {
+                               return false;
+                       }
+               }
+               return (*this != other);
+       }
+
+       bool operator<=(const ChanCount& other) const
+       {
+               return ( (*this < other) || (*this == other) );
+       }
+       
+       bool operator>(const ChanCount& other) const
+       {
+               for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
+                       if (_counts[(*t).to_index()] < other._counts[(*t).to_index()]) {
+                               return false;
+                       }
+               }
+               return (*this != other);
+       }
+
+       bool operator>=(const ChanCount& other) const
+       {
+               return ( (*this > other) || (*this == other) );
+       }
+
+       static const ChanCount INFINITE;
+       static const ChanCount ZERO;
+
 private:
+       
        size_t _counts[DataType::num_types];
 };