MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / generateUID

Method generateUID

src/Plugin/PluginFactory.cpp:137–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135 *****************************************************************************/
136
137uint16_t PluginFactory::generateUID()
138{
139 uint16_t uid;
140 bool isFound;
141
142 do
143 {
144 isFound = false;
145 uid = random(UINT16_MAX);
146
147 if (0U < m_plugins.size())
148 {
149 ListOfPlugins::const_iterator it = m_plugins.begin();
150
151 /* Ensure that UID is really unique. */
152 while ((it != m_plugins.end()) && (false == isFound))
153 {
154 const IPluginMaintenance* currentPlugin = *it;
155
156 if (currentPlugin->getUID() == uid)
157 {
158 isFound = true;
159 }
160
161 ++it;
162 }
163 }
164 }
165 while (true == isFound);
166
167 return uid;
168}
169
170/******************************************************************************
171 * External Functions

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.80
getUIDMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected