本文整理汇总了C++中dbobject::Ptr类的典型用法代码示例。如果您正苦于以下问题:C++ Ptr类的具体用法?C++ Ptr怎么用?C++ Ptr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ptr类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: StateChangedHandler
void DbObject::StateChangedHandler(const ConfigObject::Ptr& object)
{
DbObject::Ptr dbobj = GetOrCreateByObject(object);
if (!dbobj)
return;
dbobj->SendStatusUpdate();
}
开发者ID:ogg1980,项目名称:icinga2,代码行数:9,代码来源:dbobject.cpp
示例2: VersionChangedHandler
void DbObject::VersionChangedHandler(const ConfigObject::Ptr& object)
{
DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object);
if (dbobj) {
dbobj->SendConfigUpdate();
dbobj->SendStatusUpdate();
}
}
开发者ID:ogg1980,项目名称:icinga2,代码行数:9,代码来源:dbobject.cpp
示例3: VarsChangedHandler
void DbObject::VarsChangedHandler(const CustomVarObject::Ptr& object)
{
DbObject::Ptr dbobj = GetOrCreateByObject(object);
Log(LogDebug, "DbObject")
<< "Vars changed for object '" << object->GetName() << "'";
if (!dbobj)
return;
dbobj->SendVarsStatusUpdate();
}
开发者ID:ogg1980,项目名称:icinga2,代码行数:12,代码来源:dbobject.cpp
示例4: UpdateAllObjects
void DbConnection::UpdateAllObjects(void)
{
DynamicType::Ptr type;
BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) {
BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) {
DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object);
if (dbobj) {
if (!GetObjectActive(dbobj))
ActivateObject(dbobj);
dbobj->SendConfigUpdate();
dbobj->SendStatusUpdate();
}
}
}
开发者ID:carroarmato0,项目名称:icinga2,代码行数:16,代码来源:dbconnection.cpp
示例5: UpdateObject
void DbConnection::UpdateObject(const ConfigObject::Ptr& object)
{
if (!GetConnected())
return;
DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object);
if (dbobj) {
bool active = object->IsActive();
if (active) {
ActivateObject(dbobj);
dbobj->SendConfigUpdate();
dbobj->SendStatusUpdate();
} else
DeactivateObject(dbobj);
}
}
开发者ID:ogg1980,项目名称:icinga2,代码行数:19,代码来源:dbconnection.cpp
示例6: 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;
}
开发者ID:ogg1980,项目名称:icinga2,代码行数:42,代码来源:dbobject.cpp
示例7: InternalActivateObject
void IdoPgsqlConnection::InternalActivateObject(const DbObject::Ptr& dbobj)
{
AssertOnWorkQueue();
if (!GetConnected())
return;
DbReference dbref = GetObjectID(dbobj);
std::ostringstream qbuf;
if (!dbref.IsValid()) {
if (!dbobj->GetName2().IsEmpty()) {
qbuf << "INSERT INTO " + GetTablePrefix() + "objects (instance_id, objecttype_id, name1, name2, is_active) VALUES ("
<< static_cast<long>(m_InstanceID) << ", " << dbobj->GetType()->GetTypeID() << ", "
<< "E'" << Escape(dbobj->GetName1()) << "', E'" << Escape(dbobj->GetName2()) << "', 1)";
} else {
qbuf << "INSERT INTO " + GetTablePrefix() + "objects (instance_id, objecttype_id, name1, is_active) VALUES ("
<< static_cast<long>(m_InstanceID) << ", " << dbobj->GetType()->GetTypeID() << ", "
<< "E'" << Escape(dbobj->GetName1()) << "', 1)";
}
Query(qbuf.str());
SetObjectID(dbobj, GetSequenceValue(GetTablePrefix() + "objects", "object_id"));
} else {
qbuf << "UPDATE " + GetTablePrefix() + "objects SET is_active = 1 WHERE object_id = " << static_cast<long>(dbref);
Query(qbuf.str());
}
}
开发者ID:LMNetworks,项目名称:icinga2,代码行数:28,代码来源:idopgsqlconnection.cpp
示例8: GetOrCreateByObject
DbObject::Ptr DbObject::GetOrCreateByObject(const DynamicObject::Ptr& object)
{
DbObject::Ptr dbobj = static_pointer_cast<DbObject>(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();
if (!host)
return DbObject::Ptr();
name1 = service->GetHost()->GetName();
name2 = service->GetShortName();
} else {
name1 = object->GetName();
}
dbobj = dbtype->GetOrCreateObjectByName(name1, name2);
{
ObjectLock olock(object);
dbobj->SetObject(object);
object->SetExtension("DbObject", dbobj);
}
return dbobj;
}
开发者ID:gpend,项目名称:icinga2,代码行数:39,代码来源:dbobject.cpp
示例9: UpdateObject
void DbConnection::UpdateObject(const ConfigObject::Ptr& object)
{
if (!GetConnected())
return;
DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object);
if (dbobj) {
bool dbActive = GetObjectActive(dbobj);
bool active = object->IsActive();
if (active && !dbActive) {
ActivateObject(dbobj);
dbobj->SendConfigUpdate();
dbobj->SendStatusUpdate();
} else if (!active) {
/* Deactivate the deleted object no matter
* which state it had in the database.
*/
DeactivateObject(dbobj);
}
}
}
开发者ID:IPnett,项目名称:icinga2,代码行数:23,代码来源:dbconnection.cpp
示例10: UpdateObject
void DbConnection::UpdateObject(const ConfigObject::Ptr& object)
{
if (!GetConnected() || Application::IsShuttingDown())
return;
DbObject::Ptr dbobj = DbObject::GetOrCreateByObject(object);
if (dbobj) {
bool dbActive = GetObjectActive(dbobj);
bool active = object->IsActive();
if (active) {
if (!dbActive)
ActivateObject(dbobj);
Dictionary::Ptr configFields = dbobj->GetConfigFields();
String configHash = dbobj->CalculateConfigHash(configFields);
ASSERT(configHash.GetLength() <= 64);
configFields->Set("config_hash", configHash);
String cachedHash = GetConfigHash(dbobj);
if (cachedHash != configHash) {
dbobj->SendConfigUpdateHeavy(configFields);
dbobj->SendStatusUpdate();
} else {
dbobj->SendConfigUpdateLight();
}
} else if (!active) {
/* Deactivate the deleted object no matter
* which state it had in the database.
*/
DeactivateObject(dbobj);
}
}
}
开发者ID:spjmurray,项目名称:icinga2,代码行数:36,代码来源:dbconnection.cpp
示例11: GetInsertID
DbReference DbConnection::GetInsertID(const DbObject::Ptr& dbobj) const
{
return GetInsertID(dbobj->GetType(), GetObjectID(dbobj));
}
开发者ID:spjmurray,项目名称:icinga2,代码行数:4,代码来源:dbconnection.cpp
示例12: SetInsertID
void DbConnection::SetInsertID(const DbObject::Ptr& dbobj, const DbReference& dbref)
{
SetInsertID(dbobj->GetType(), GetObjectID(dbobj), dbref);
}
开发者ID:spjmurray,项目名称:icinga2,代码行数:4,代码来源:dbconnection.cpp
示例13: GetConfigHash
String DbConnection::GetConfigHash(const DbObject::Ptr& dbobj) const
{
return GetConfigHash(dbobj->GetType(), GetObjectID(dbobj));
}
开发者ID:spjmurray,项目名称:icinga2,代码行数:4,代码来源:dbconnection.cpp
示例14: SetConfigHash
void DbConnection::SetConfigHash(const DbObject::Ptr& dbobj, const String& hash)
{
SetConfigHash(dbobj->GetType(), GetObjectID(dbobj), hash);
}
开发者ID:spjmurray,项目名称:icinga2,代码行数:4,代码来源:dbconnection.cpp
注:本文中的dbobject::Ptr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论