/[svn]/linuxsampler/trunk/src/common/Pool.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/Pool.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3292 by schoenebeck, Fri Apr 21 13:33:03 2017 UTC revision 3293 by schoenebeck, Tue Jun 27 22:19:19 2017 UTC
# Line 693  class Pool : public RTList<T> { Line 693  class Pool : public RTList<T> {
693              if (data)  delete[] data;              if (data)  delete[] data;
694          }          }
695    
696            /**
697             * Returns true if there is at least one free element that could be
698             * allocated from the pool with i.e. allocAppend() or allocPreprend().
699             *
700             * @see poolHasFreeElements()
701             */
702          inline bool poolIsEmpty() const {          inline bool poolIsEmpty() const {
703              return freelist.isEmpty();              return freelist.isEmpty();
704          }          }
705    
706          /**          /**
707             * Returns true if at least the requested amount of free @a elements is
708             * currently available for being allocated from the pool with i.e.
709             * allocAppend() or allocPreprend().
710             *
711             * @see poolIsEmpty()
712             */
713            bool poolHasFreeElements(int elements) {
714                for (Iterator it = freelist.first(); it != freelist.end() && elements >= 0; ++it)
715                    --elements;
716                return elements <= 0;
717            }
718    
719            /**
720           * Returns the current size of the pool, that is the amount of           * Returns the current size of the pool, that is the amount of
721           * pre-allocated elements from the operating system. It equals the           * pre-allocated elements from the operating system. It equals the
722           * amount of elements given to the constructor unless resizePool()           * amount of elements given to the constructor unless resizePool()

Legend:
Removed from v.3292  
changed lines
  Added in v.3293

  ViewVC Help
Powered by ViewVC