Blender  V2.93
AUD_Set.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2009-2011 Jörg Hermann Müller
3  *
4  * This file is part of AudaSpace.
5  *
6  * Audaspace is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AudaSpace is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Audaspace; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
25 #include <set>
26 
27 #include "AUD_Set.h"
28 
30 {
31  return new std::set<void *>();
32 }
33 
34 void AUD_destroySet(void *set)
35 {
36  delete reinterpret_cast<std::set<void *> *>(set);
37 }
38 
39 char AUD_removeSet(void *set, void *entry)
40 {
41  if (set)
42  return reinterpret_cast<std::set<void *> *>(set)->erase(entry);
43  return 0;
44 }
45 
46 void AUD_addSet(void *set, void *entry)
47 {
48  if (entry)
49  reinterpret_cast<std::set<void *> *>(set)->insert(entry);
50 }
51 
52 void *AUD_getSet(void *set)
53 {
54  if (set) {
55  std::set<void *> *rset = reinterpret_cast<std::set<void *> *>(set);
56  if (!rset->empty()) {
57  std::set<void *>::iterator it = rset->begin();
58  void *result = *it;
59  rset->erase(it);
60  return result;
61  }
62  }
63 
64  return (void *)0;
65 }
void * AUD_createSet()
Definition: AUD_Set.cpp:29
void * AUD_getSet(void *set)
Definition: AUD_Set.cpp:52
void AUD_addSet(void *set, void *entry)
Definition: AUD_Set.cpp:46
void AUD_destroySet(void *set)
Definition: AUD_Set.cpp:34
char AUD_removeSet(void *set, void *entry)
Definition: AUD_Set.cpp:39
void BLI_kdtree_nd_() insert(KDTree *tree, int index, const float co[KD_DIMS]) ATTR_NONNULL(1