1 /* -----------------------------------------------------------------------------
2 *
3 * Giada - Your Hardcore Loopmachine
4 *
5 * -----------------------------------------------------------------------------
6 *
7 * Copyright (C) 2010-2020 Giovanni A. Zuliani | Monocasual
8 *
9 * This file is part of Giada - Your Hardcore Loopmachine.
10 *
11 * Giada - Your Hardcore Loopmachine is free software: you can
12 * redistribute it and/or modify it under the terms of the GNU General
13 * Public License as published by the Free Software Foundation, either
14 * version 3 of the License, or (at your option) any later version.
15 *
16 * Giada - Your Hardcore Loopmachine is distributed in the hope that it
17 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
18 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 * See the GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with Giada - Your Hardcore Loopmachine. If not, see
23 * <http://www.gnu.org/licenses/>.
24 *
25 * -------------------------------------------------------------------------- */
26
27
28 #include "idManager.h"
29
30
31 namespace giada::m
32 {
IdManager()33 IdManager::IdManager() : m_id(0)
34 {
35 }
36
37
38 /* -------------------------------------------------------------------------- */
39
40
set(ID id)41 void IdManager::set(ID id)
42 {
43 if (id != 0 && id > m_id)
44 m_id = id;
45 }
46
47
48 /* -------------------------------------------------------------------------- */
49
50
get(ID id)51 ID IdManager::get(ID id)
52 {
53 return id != 0 ? id : ++m_id;
54 }
55 } // giada::m::
56