text: #pragma once
  
  #include <vector>
  
  #include <api/render/handler/BufferHandler.h>
  #include <api/render/model/DataContainer.h>
  
  namespace urchin {
  
      /**
       * The goal of this class is to encapsulate an unique buffer (BufferHandler). However, if the buffer needs to be updated: the buffer is duplicated.
       * This duplication prevents to update a buffer which is currently used in the graphic pipeline.
       * This mechanism allows to have a minimum memory footprint on the static buffers and support parallelism for the dynamic/updated buffers.
       */
      class AlterableBufferHandler {
          public:
              AlterableBufferHandler();
              ~AlterableBufferHandler();
  
              void initialize(BufferHandler::BufferType, BufferHandler::BufferKind, std::size_t, std::size_t, const void* dataPtr);
              void cleanup();
  
              bool updateData(std::size_t, std::size_t, const void*);
  
              VkBuffer getBuffer(std::size_t) const;
  
          private:
              void cleanupBuffers();
              void createDynamicBuffers(std::size_t, const void*);
  
              bool isInitialized;
              bool isStaticBuffer;
  
              BufferHandler::BufferType bufferType;
              std::size_t numFramebuffer;
  
              std::vector<BufferHandler> buffers;
      };
  
  }
  