Files
Upsilon/apps/apps_container_storage.h
2018-09-06 09:49:38 +02:00

32 lines
799 B
C++

#ifndef APPS_CONTAINER_STORAGE_H
#define APPS_CONTAINER_STORAGE_H
#include "apps_container.h"
#ifndef APPS_CONTAINER_SNAPSHOT_DECLARATIONS
#error Missing snapshot declarations
#endif
class AppsContainerStorage : public AppsContainer {
public:
static AppsContainerStorage * sharedContainer();
AppsContainerStorage();
int numberOfApps() override;
App::Snapshot * appSnapshotAtIndex(int index) override;
void * currentAppBuffer() override { return &m_apps; };
private:
union Apps {
public:
/* Enforce a trivial constructor and destructor that just leave the memory
* unmodified. This way, m_apps can be trivially destructed. */
Apps() {};
~Apps() {};
private:
APPS_CONTAINER_APPS_DECLARATION
};
Apps m_apps;
APPS_CONTAINER_SNAPSHOT_DECLARATIONS
};
#endif