mirror of https://github.com/Icinga/icinga2.git
parent
954d2d53a2
commit
29f9117e58
|
@ -89,7 +89,7 @@ public:
|
||||||
{
|
{
|
||||||
DynamicObject::Ptr object = GetObject(T::GetTypeName(), name);
|
DynamicObject::Ptr object = GetObject(T::GetTypeName(), name);
|
||||||
|
|
||||||
return dynamic_pointer_cast<T>(object);
|
return static_pointer_cast<T>(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DumpObjects(const String& filename, int attributeTypes = FAState);
|
static void DumpObjects(const String& filename, int attributeTypes = FAState);
|
||||||
|
|
|
@ -134,7 +134,7 @@ DynamicObject::Ptr DynamicType::CreateObject(const Dictionary::Ptr& serializedUp
|
||||||
|
|
||||||
Deserialize(object, serializedUpdate, FAConfig);
|
Deserialize(object, serializedUpdate, FAConfig);
|
||||||
|
|
||||||
return dynamic_pointer_cast<DynamicObject>(object);
|
return static_pointer_cast<DynamicObject>(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::mutex& DynamicType::GetStaticMutex(void)
|
boost::mutex& DynamicType::GetStaticMutex(void)
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
std::vector<shared_ptr<T> > objects;
|
std::vector<shared_ptr<T> > objects;
|
||||||
|
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, GetObjects(T::GetTypeName())) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, GetObjects(T::GetTypeName())) {
|
||||||
shared_ptr<T> tobject = dynamic_pointer_cast<T>(object);
|
shared_ptr<T> tobject = static_pointer_cast<T>(object);
|
||||||
|
|
||||||
ASSERT(tobject);
|
ASSERT(tobject);
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,14 @@ public:
|
||||||
if (IsEmpty())
|
if (IsEmpty())
|
||||||
return shared_ptr<T>();
|
return shared_ptr<T>();
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
shared_ptr<T> object = dynamic_pointer_cast<T>(boost::get<Object::Ptr>(m_Value));
|
shared_ptr<T> object = dynamic_pointer_cast<T>(boost::get<Object::Ptr>(m_Value));
|
||||||
|
|
||||||
if (!object)
|
if (!object)
|
||||||
BOOST_THROW_EXCEPTION(std::bad_cast());
|
BOOST_THROW_EXCEPTION(std::bad_cast());
|
||||||
|
#else /* _DEBUG */
|
||||||
|
shared_ptr<T> object = static_pointer_cast<T>(boost::get<Object::Ptr>(m_Value));
|
||||||
|
#endif /* _DEBUG */
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue