| 23 | } |
| 24 | |
| 25 | void ConfigType::RegisterObject(const ConfigObject::Ptr& object) |
| 26 | { |
| 27 | String name = object->GetName(); |
| 28 | |
| 29 | { |
| 30 | std::unique_lock<decltype(m_Mutex)> lock (m_Mutex); |
| 31 | |
| 32 | auto it = m_ObjectMap.find(name); |
| 33 | |
| 34 | if (it != m_ObjectMap.end()) { |
| 35 | if (it->second == object) |
| 36 | return; |
| 37 | |
| 38 | auto *type = dynamic_cast<Type *>(this); |
| 39 | |
| 40 | BOOST_THROW_EXCEPTION(ScriptError("An object with type '" + type->GetName() + "' and name '" + name + "' already exists (" + |
| 41 | Convert::ToString(it->second->GetDebugInfo()) + "), new declaration: " + Convert::ToString(object->GetDebugInfo()), |
| 42 | object->GetDebugInfo())); |
| 43 | } |
| 44 | |
| 45 | m_ObjectMap[name] = object; |
| 46 | m_ObjectVector.push_back(object); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | void ConfigType::UnregisterObject(const ConfigObject::Ptr& object) |
| 51 | { |
no test coverage detected