本文整理汇总了C++中FWObject::getByType方法的典型用法代码示例。如果您正苦于以下问题:C++ FWObject::getByType方法的具体用法?C++ FWObject::getByType怎么用?C++ FWObject::getByType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FWObject
的用法示例。
在下文中一共展示了FWObject::getByType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// the IP address of the gateway RGtw has to be in a network of the interface RItf
bool RoutingCompiler::contradictionRGtwAndRItf::processNext()
{
RoutingRule *rule=getNext(); if (rule==NULL) return false;
tmp_queue.push_back(rule);
RuleElementRGtw *gtwrel=rule->getRGtw();
RuleElementRItf *itfrel=rule->getRItf();
FWObject *oRGtw = FWReference::cast(gtwrel->front())->getPointer();
FWObject *oRItf = FWReference::cast(itfrel->front())->getPointer();
if (oRItf->getName() == "Any") { return true; }
if (Host::cast(oRGtw) != NULL ||
Interface::cast(oRGtw) != NULL ||
Address::cast(oRGtw)->dimension()==1)
{
const InetAddr* ip_interface = NULL;
if ( Host::cast(oRGtw) != NULL)
{
Host *host=Host::cast(oRGtw);
ip_interface = host->getAddressPtr();
} else if (Interface::cast(oRGtw) != NULL)
{
Interface *intf=Interface::cast(oRGtw);
ip_interface = intf->getAddressPtr();
} else if (Address::cast(oRGtw)->dimension()==1)
{
Address *ipv4 = Address::cast(oRGtw);
ip_interface = ipv4->getAddressPtr();
}
if (ip_interface)
{
list<FWObject*> obj_list = oRItf->getByType(IPv4::TYPENAME);
for (list<FWObject*>::iterator i=obj_list.begin();
i!=obj_list.end(); ++i)
{
Address *addr = Address::cast(*i);
if (addr->belongs(*ip_interface))
return true;
}
}
string msg;
msg = "Object \"" + oRGtw->getName() +
"\" used as gateway in the routing rule " +
rule->getLabel() +
" is not in the same local network as interface " +
oRItf->getName();
compiler->abort(rule, msg.c_str());
}
return true;
}