Page MenuHomec4science

double_buffer.h
No OneTemporary

File Metadata

Created
Sun, Oct 6, 10:18

double_buffer.h

//
// Created by Arnaud Pannatier on 06.05.18.
// Based on the code of :
// - Nicolas Richart <nicolas.richart@epfl.ch>
// - Vincent Keller <vincent.keller@epfl.ch>
// - Vittoria Rezzonico <vittoria.rezzonico@epfl.ch>
// See the files AUTHORS and COPYRIGHT for the concerning informations
//
#ifndef PHPCTSUNAMIPROJECT_DOUBLE_BUFFER_H
#define PHPCTSUNAMIPROJECT_DOUBLE_BUFFER_H
#include <memory>
#include "grid.h"
class DoubleBuffer {
public:
// Constructor
DoubleBuffer() = default;
DoubleBuffer(int m, int n);
// return the current value
Grid & current();
// return the old value
Grid & old();
void swap();
private:
// Keep a pointer to the actual place in memory, assure that we don't duplicate the memory
std::unique_ptr<Grid> m_current;
std::unique_ptr<Grid> m_old;
};
#endif //PHPCTSUNAMIPROJECT_DOUBLE_BUFFER_H

Event Timeline