int main() { Server server { ServerId("s1"), Interfaces { Interface { InterfaceId("i1"), Ports { { PortId("p11"), PortName("Jolly") }, { PortId("p12"), PortName("Billy") } } }, Interface { InterfaceId("i2"), Ports { { PortId("p21"), PortName("Bimbo") }, { PortId("p22"), PortName("Luffy") } } } } }; auto interfaces = server.get<Interfaces>(); std::cout << "InterfaceId: " << interfaces.at(0).get<InterfaceId>() << std::endl; auto ports = interfaces.at(0).get<Ports>(); std::cout << "Port name: " << ports.at(0).get<PortName>() << std::endl; Handy<ServerId, InterfaceId, PortId> handy(ServerId("s1"), InterfaceId("i1"), PortId("p1")); handy.get<ServerId>() = ServerId{"s2"}; handy.get<PortId>() = PortId {"p2"}; auto record = MakeRecord(ServerId("s1"), PortId("p2")); std::cout << Get<ServerId>(record) << std::endl; std::cout << Get<ServerId>(handy) << std::endl; std::cout << handy.get<PortId>() << std::endl; std::cout << handy.get(PortId {}) << std::endl; handy.get(PortId()) = PortId("Port2"); std::cout << handy.get(PortId {}) << std::endl; }
bool relation_handy_legacy(message_t* message, rule_t* rule) { return (handy(rule->from, message->from) && handy(rule->to, message->to)); }