本文整理汇总了C++中NestedContact::setTypeName方法的典型用法代码示例。如果您正苦于以下问题:C++ NestedContact::setTypeName方法的具体用法?C++ NestedContact::setTypeName怎么用?C++ NestedContact::setTypeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NestedContact
的用法示例。
在下文中一共展示了NestedContact::setTypeName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void update() {
if (nc.getTypeName()=="") {
if (!contactable) return;
Type typ = contactable->getType();
if (typ.isValid()) {
nc.setTypeName(typ.getName());
}
}
}
示例2: query
Contact NameServiceOnTriples::query(const yarp::os::ConstString& portName,
NameTripleState& act,
const yarp::os::ConstString& prefix,
bool nested) {
if (!nested) lock();
Triple t;
t.setNameValue("port",portName.c_str());
int result = act.mem.find(t, YARP_NULLPTR);
TripleContext context;
context.setRid(result);
if (result!=-1) {
ConstString host = "";
if (ConstString(prefix)!="") {
printf("LOOKING AT IPS FOR %s\n", prefix.c_str());
t.setNameValue("ips","*");
list<Triple> lst = act.mem.query(t,&context);
for (list<Triple>::iterator it=lst.begin();it!=lst.end();it++) {
printf("LOOKING AT IPS %s\n", it->value.c_str());
if (it->value.find(prefix)==0) {
host = it->value;
break;
}
}
}
if (host=="") {
t.setNameValue("host","*");
list<Triple> lst = act.mem.query(t,&context);
if (lst.size()>0) {
host = lst.begin()->value.c_str();
}
}
if (host=="") {
host = "localhost";
}
t.setNameValue("socket","*");
list<Triple> lst = act.mem.query(t,&context);
int sock = 10000;
if (lst.size()>0) {
sock = atoi(lst.begin()->value.c_str());
}
t.setNameValue("carrier","*");
ConstString carrier = "tcp";
lst = act.mem.query(t,&context);
if (lst.size()>0) {
carrier = lst.begin()->value.c_str();
}
t.setNameValue("type","*");
ConstString typ = "*";
lst = act.mem.query(t,&context);
if (lst.size()>0) {
typ = lst.begin()->value.c_str();
}
if (!nested) unlock();
Contact result = Contact(portName, carrier, host, sock);
if (typ!="" && typ!="*") {
NestedContact nc;
nc.fromString(result.getName());
nc.setTypeName(typ);
result.setNestedContact(nc);
}
return result;
}
if (!nested) unlock();
if (delegate && !nested) {
return delegate->queryName(portName);
}
return Contact();
}
示例3: open
//.........这里部分代码省略.........
newCore->configWaitAfterSend(currentCore->checkWaitAfterSend());
}
close();
delete ((PortCoreAdapter*)implementation);
implementation = newCore;
}
PortCoreAdapter& core = HELPER(implementation);
core.openable();
if (NetworkBase::localNetworkAllocation()&&contact2.getPort()<=0) {
YARP_DEBUG(Logger::get(),"local network allocation needed");
local = true;
}
bool success = true;
Contact caddress = Contact::bySocket(contact2.getCarrier(),
contact2.getHost(),
contact2.getPort())
.addName(contact2.getName());
caddress.setNested(contact2.getNested());
Contact address = caddress;
core.setReadHandler(core);
if (contact2.getPort()>0 && contact2.getHost()!="") {
registerName = false;
}
ConstString typ = getType().getName();
if (typ!="") {
NestedContact nc;
nc.fromString(contact2.getName());
nc.setTypeName(typ);
contact2.setNested(nc);
}
if (registerName&&!local) {
address = NetworkBase::registerContact(contact2);
}
core.setControlRegistration(registerName);
success = (address.isValid()||local)&&(fakeName==NULL);
if (success) {
// create a node if needed
Nodes& nodes = NameClient::getNameClient().getNodes();
nodes.prepare(address.getRegName().c_str());
}
// If we are a service client, go ahead and connect
if (success) {
NestedContact nc;
nc.fromString(address.getName());
if (nc.getNestedName()!="") {
if (nc.getCategory() == "+1") {
addOutput(nc.getNestedName());
}
}
}
ConstString blame = "invalid address";
if (success) {
success = core.listen(address,registerName);
blame = "address conflict";
if (success) {