if (tt == InternalGetTypeMap().end()) {
Type::Ptr type = Type::GetByName(name);
- if (!type || !Type::GetByName("DynamicObject")->IsAssignableFrom(type)
+ if (!type || !DynamicObject::TypeInstance->IsAssignableFrom(type)
|| type->IsAbstract())
return DynamicType::Ptr();
Type::Ptr ScriptUtils::TypeOf(const Value& value)
{
- switch (value.GetType()) {
- case ValueEmpty:
- return Type::GetByName("Object");
- case ValueNumber:
- return Type::GetByName("Number");
- case ValueBoolean:
- return Type::GetByName("Boolean");
- case ValueString:
- return Type::GetByName("String");
- case ValueObject:
- return static_cast<Object::Ptr>(value)->GetReflectionType();
- default:
- VERIFY(!"Invalid value type.");
- }
+ return value.GetReflectionType();
}
Array::Ptr ScriptUtils::Keys(const Dictionary::Ptr& dict)
{
switch (GetType()) {
case ValueEmpty:
- return Type::GetByName("Object");
+ return Object::TypeInstance;
case ValueNumber:
return Type::GetByName("Number");
case ValueBoolean:
void CheckerComponent::ObjectHandler(const DynamicObject::Ptr& object)
{
- if (!Type::GetByName("Checkable")->IsAssignableFrom(object->GetReflectionType()))
- return;
+ Checkable::Ptr checkable = dynamic_pointer_cast<Checkable>(object);
- Checkable::Ptr checkable = static_pointer_cast<Checkable>(object);
+ if (!checkable)
+ return;
Zone::Ptr zone = Zone::GetByName(checkable->GetZoneName());
bool same_zone = (!zone || Zone::GetLocalZone() == zone);
/* Make sure the type is valid. */
Type::Ptr type = Type::GetByName(GetType());
- ASSERT(type && Type::GetByName("DynamicObject")->IsAssignableFrom(type));
+ ASSERT(type && DynamicObject::TypeInstance->IsAssignableFrom(type));
if (IsAbstract())
return DynamicObject::Ptr();
}
}
- Type::Ptr dotype = Type::GetByName("DynamicObject");
BOOST_FOREACH(const Type::Ptr& type, all_types) {
- if (dotype->IsAssignableFrom(type))
+ if (DynamicObject::TypeInstance->IsAssignableFrom(type))
types.insert(type->GetName());
}
Type::Ptr type = Type::GetByName(idoType);
- if (!type || !Type::GetByName("DbConnection")->IsAssignableFrom(type)) {
+ if (!type || !DbConnection::TypeInstance->IsAssignableFrom(type)) {
cr->SetOutput("IDO type '" + idoType + "' is invalid.");
cr->SetState(ServiceUnknown);
checkable->ProcessCheckResult(cr);