本文整理汇总了C++中configobject::Ptr::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::GetType方法的具体用法?C++ Ptr::GetType怎么用?C++ Ptr::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configobject::Ptr
的用法示例。
在下文中一共展示了Ptr::GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetOrCreateByObject
DbObject::Ptr DbObject::GetOrCreateByObject(const ConfigObject::Ptr& object)
{
boost::mutex::scoped_lock lock(GetStaticMutex());
DbObject::Ptr dbobj = object->GetExtension("DbObject");
if (dbobj)
return dbobj;
DbType::Ptr dbtype = DbType::GetByName(object->GetType()->GetName());
if (!dbtype)
return DbObject::Ptr();
Service::Ptr service;
String name1, name2;
service = dynamic_pointer_cast<Service>(object);
if (service) {
Host::Ptr host = service->GetHost();
name1 = service->GetHost()->GetName();
name2 = service->GetShortName();
} else {
if (object->GetType() == ConfigType::GetByName("CheckCommand") ||
object->GetType() == ConfigType::GetByName("EventCommand") ||
object->GetType() == ConfigType::GetByName("NotificationCommand")) {
Command::Ptr command = dynamic_pointer_cast<Command>(object);
name1 = CompatUtility::GetCommandName(command);
}
else
name1 = object->GetName();
}
dbobj = dbtype->GetOrCreateObjectByName(name1, name2);
dbobj->SetObject(object);
object->SetExtension("DbObject", dbobj);
return dbobj;
}
示例2: Dictionary
BOOST_FOREACH(const Object::Ptr& pobj, DependencyGraph::GetParents((obj))) {
ConfigObject::Ptr configObj = dynamic_pointer_cast<ConfigObject>(pobj);
if (!configObj)
continue;
Dictionary::Ptr refInfo = new Dictionary();
refInfo->Set("type", configObj->GetType()->GetName());
refInfo->Set("name", configObj->GetName());
used_by->Add(refInfo);
}