本文整理汇总了C++中Observer::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ Observer::Get方法的具体用法?C++ Observer::Get怎么用?C++ Observer::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Observer
的用法示例。
在下文中一共展示了Observer::Get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PersonPassedThrough
void PersonPassedThrough(const InterfaceDescription::Member* member, const char* path, Message& message) {
QCC_UNUSED(member);
char* name;
string location;
QStatus status = message->GetArgs("s", &name);
if (ER_OK == status) {
bus->EnableConcurrentCallbacks();
DoorProxy door(observer->Get(message->GetSender(), path), *bus);
if (door.IsValid()) {
status = door.GetLocation(location);
} else {
cerr << "Received a signal from a door we don't know." << endl;
status = ER_FAIL;
}
}
if (ER_OK == status) {
cout << "[listener] " << name << " passed through a door "
<< "@location " << location << endl;
cout << "> ";
cout.flush();
}
}
示例2: PropertiesChanged
virtual void PropertiesChanged(ProxyBusObject& obj,
const char* ifaceName,
const MsgArg& changed,
const MsgArg& invalidated,
void* context) {
QCC_UNUSED(ifaceName);
QCC_UNUSED(context);
QStatus status = ER_OK;
bus->EnableConcurrentCallbacks();
DoorProxy door(observer->Get(ObjectId(obj)), *bus);
if (!door.IsValid()) {
cerr << "Received a PropertiesChanged signal from a door we don't know." << endl;
status = ER_FAIL;
}
string location;
if (ER_OK == status) {
status = door.GetLocation(location);
}
if (ER_OK == status) {
cout << "Door @location " << location << " has updated state:" << endl;
}
size_t nelem = 0;
MsgArg* elems = NULL;
if (ER_OK == status) {
status = changed.Get("a{sv}", &nelem, &elems);
}
if (ER_OK == status) {
for (size_t i = 0; i < nelem; ++i) {
const char* prop;
MsgArg* val;
status = elems[i].Get("{sv}", &prop, &val);
if (ER_OK == status) {
string propname = prop;
if (propname == "Location") {
const char* newloc;
status = val->Get("s", &newloc);
if (ER_OK == status) {
cout << " location: " << newloc << endl;
}
} else if (propname == "IsOpen") {
bool isopen;
status = val->Get("b", &isopen);
if (ER_OK == status) {
cout << " is open: " << isopen << endl;
}
}
} else {
break;
}
}
}
if (ER_OK == status) {
status = invalidated.Get("as", &nelem, &elems);
}
if (ER_OK == status) {
for (size_t i = 0; i < nelem; ++i) {
char* prop;
status = elems[i].Get("s", &prop);
if (status == ER_OK) {
cout << " invalidated " << prop << endl;
}
}
}
cout << "> ";
cout.flush();
}