* moved storage related classes to data/storage folder * implemented recording c++ unions as NODE_UNION instead of just using NODE_TYPE * added transformation to merge anonymous classes/structs/enums/unions and typedef nodes * added tests for this transformation * added setting for enabling/disabling this transformation
30 lines
723 B
C++
30 lines
723 B
C++
#ifndef STORAGE_PROVIDER_H
|
|
#define STORAGE_PROVIDER_H
|
|
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <list>
|
|
#include "data/storage/IntermediateStorage.h"
|
|
|
|
class StorageProvider
|
|
{
|
|
public:
|
|
int getStorageCount() const;
|
|
|
|
void insert(std::shared_ptr<IntermediateStorage> storage);
|
|
|
|
// returns empty shared_ptr if no storages available
|
|
std::shared_ptr<IntermediateStorage> consumeSecondLargestStorage();
|
|
|
|
// returns empty shared_ptr if no storages available
|
|
std::shared_ptr<IntermediateStorage> consumeLargestStorage();
|
|
|
|
void logCurrentState() const;
|
|
|
|
private:
|
|
std::list<std::shared_ptr<IntermediateStorage>> m_storages; // larger storages are in front
|
|
mutable std::mutex m_storagesMutex;
|
|
};
|
|
|
|
#endif // STORAGE_PROVIDER_H
|