2010-11-12 16:16:22 +01:00
|
|
|
#ifndef __BUFFERS_H_
|
|
|
|
#define __BUFFERS_H_
|
|
|
|
|
|
|
|
/* This is a thread-safe wrapper around a standard library
|
|
|
|
vector of pointers to "Buffer" objects. It automates locking during
|
|
|
|
all operations and generates "ID" hashes for the buffers upon creation. */
|
|
|
|
|
|
|
|
/* TODO: * create hashes during buffer creation
|
|
|
|
* throw and handle exceptions */
|
|
|
|
|
|
|
|
#include <glibmm.h>
|
|
|
|
#include <vector>
|
2010-11-12 21:37:12 +01:00
|
|
|
#include <string>
|
2010-11-12 16:16:22 +01:00
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#include "defines.h"
|
|
|
|
#include "Buffer.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class Buffers : public sigc::trackable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Buffers();
|
|
|
|
Buffers(int);
|
|
|
|
|
|
|
|
~Buffers();
|
|
|
|
|
|
|
|
void add();
|
2010-11-12 21:37:12 +01:00
|
|
|
void remove(std::string);
|
2010-11-12 16:16:22 +01:00
|
|
|
|
2011-05-08 20:08:34 +02:00
|
|
|
void set_selected_buffer(std::string);
|
|
|
|
std::string get_selected_buffer();
|
|
|
|
|
2010-11-12 16:16:22 +01:00
|
|
|
Buffer* get(int);
|
|
|
|
|
|
|
|
private:
|
|
|
|
vector<Buffer*> buffers;
|
2010-11-12 21:37:12 +01:00
|
|
|
std::string id;
|
2010-11-12 16:16:22 +01:00
|
|
|
Glib::Mutex mutex_;
|
2011-05-08 20:08:34 +02:00
|
|
|
std::string selected_buffer;
|
2010-11-12 16:16:22 +01:00
|
|
|
};
|
|
|
|
#endif
|