Open Lighting Architecture: olad/plugin_api/UniverseStore.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
UniverseStore.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * UniverseStore.h
17 * The Universe Store class - this manages the universes
18 * Copyright (C) 2005 Simon Newton
19 */
20
21#ifndef OLAD_PLUGIN_API_UNIVERSESTORE_H_
22#define OLAD_PLUGIN_API_UNIVERSESTORE_H_
23
24#include <map>
25#include <set>
26#include <string>
27#include <vector>
28
29#include "ola/Clock.h"
30#include "ola/base/Macro.h"
31
32namespace ola {
33
34class Universe;
35
39 class UniverseStore {
40 public:
46 UniverseStore(class Preferences *preferences, class ExportMap *export_map);
47
51 ~UniverseStore();
52
58 Universe *GetUniverse(unsigned int universe_id) const;
59
65 Universe *GetUniverseOrCreate(unsigned int universe_id);
66
70 unsigned int UniverseCount() const { return m_universe_map.size(); }
71
77 void GetList(std::vector<Universe*> *universes) const;
78
82 void DeleteAll();
83
88 void AddUniverseGarbageCollection(Universe *universe);
89
93 void GarbageCollectUniverses();
94
95 private:
96 typedef std::map<unsigned int, Universe*> UniverseMap;
97
98 Preferences *m_preferences;
99 ExportMap *m_export_map;
100 UniverseMap m_universe_map;
101 std::set<Universe*> m_deletion_candidates; // list of universes we may be
102 // able to delete
103 Clock m_clock;
104
105 bool RestoreUniverseSettings(Universe *universe) const;
106 bool SaveUniverseSettings(Universe *universe) const;
107
108 static const unsigned int MINIMUM_RDM_DISCOVERY_INTERVAL;
109
110 UniverseStore(const UniverseStore &) = delete;
111 const UniverseStore &operator=(const UniverseStore &) = delete;
112};
113} // namespace ola
114#endif // OLAD_PLUGIN_API_UNIVERSESTORE_H_
Macro.h
Helper macros.
ola::Clock
Used to get the current time.
Definition Clock.h:230
ola::ExportMap
A container for the exported variables.
Definition ExportMap.h:324
ola::Preferences
Definition Preferences.h:148
ola::Universe
Definition Universe.h:46
ola::UniverseStore
Maintains a collection of Universe objects.
Definition UniverseStore.h:39
ola::UniverseStore::AddUniverseGarbageCollection
void AddUniverseGarbageCollection(Universe *universe)
Mark a universe as a candidate for garbage collection.
Definition UniverseStore.cpp:111
ola::UniverseStore::DeleteAll
void DeleteAll()
Delete all universes.
Definition UniverseStore.cpp:100
ola::UniverseStore::GetList
void GetList(std::vector< Universe * > *universes) const
Returns a list of universes. This must be freed when you're done with it.
Definition UniverseStore.cpp:96
ola::UniverseStore::GetUniverse
Universe * GetUniverse(unsigned int universe_id) const
Lookup a universe from its universe-id.
Definition UniverseStore.cpp:74
ola::UniverseStore::UniverseStore
UniverseStore(class Preferences *preferences, class ExportMap *export_map)
Create a new UniverseStore.
Definition UniverseStore.cpp:47
ola::UniverseStore::GetUniverseOrCreate
Universe * GetUniverseOrCreate(unsigned int universe_id)
Lookup a universe, or create it if it does not exist.
Definition UniverseStore.cpp:78
ola::UniverseStore::GarbageCollectUniverses
void GarbageCollectUniverses()
Garbage collect any pending universes.
Definition UniverseStore.cpp:115
ola::UniverseStore::UniverseCount
unsigned int UniverseCount() const
Return the number of universes.
Definition UniverseStore.h:70
ola::UniverseStore::~UniverseStore
~UniverseStore()
Destructor.
Definition UniverseStore.cpp:70
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44