本文整理汇总了C++中CTupleBase::getClient方法的典型用法代码示例。如果您正苦于以下问题:C++ CTupleBase::getClient方法的具体用法?C++ CTupleBase::getClient怎么用?C++ CTupleBase::getClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTupleBase
的用法示例。
在下文中一共展示了CTupleBase::getClient方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printf
TEST(tuple_gen,GenerateTupleMac) {
CFlowGenList fl;
fl.Create();
fl.load_from_mac_file("avl/mac_uit.yaml");
CClientPool gen;
gen.Create(cdSEQ_DIST,
0x10000001, 0x1000000f, 64000,2, &fl.m_mac_info,true,0,0);
CTupleBase result;
uint32_t result_src;
uint16_t result_port;
mac_addr_align_t* result_mac;
for(int i=0;i<10;i++) {
gen.GenerateTuple(result);
printf(" C:%x P:%d \n",result.getClient(),result.getClientPort());
result_src = result.getClient();
result_port = result.getClientPort();
result_mac = result.getClientMac();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i%2));
EXPECT_EQ(result_port, 1024+i/2);
printf("i:%d,mac:%d\n",i,result_mac->mac[3]);
if (i%2==0)
EXPECT_EQ(result_mac->mac[3], 5);
else
EXPECT_EQ(result_mac->mac[3], 1);
}
gen.Delete();
// EXPECT_EQ((size_t)0, gen.m_clients.size());
}
示例2:
TEST(tuple_gen,GenerateTuple2) {
CClientPool c_gen;
CClientPool c_gen_2;
c_gen.Create(cdSEQ_DIST,
0x10000001, 0x1000000f, 64000,4,NULL,false,
0,0);
CServerPool s_gen;
CServerPool s_gen_2;
s_gen.Create(cdSEQ_DIST,
0x30000001, 0x30000ff1, 64000,10);
CTupleBase result;
uint32_t result_src;
uint32_t result_dest;
uint16_t result_port;
for(int i=0;i<200;i++) {
c_gen.GenerateTuple(result);
s_gen.GenerateTuple(result);
// gen.Dump(stdout);
// fprintf(stdout, "i:%d\n",i);
result_src = result.getClient();
result_dest = result.getServer();
result_port = result.getClientPort();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i%15));
EXPECT_EQ(result_dest, (uint32_t)((0x30000001+i) ) );
EXPECT_EQ(result_port, 1024+i/15);
}
s_gen.Delete();
c_gen.Delete();
// EXPECT_EQ((size_t)0, gen.m_clients.size());
c_gen.Create(cdSEQ_DIST,
0x10000001, 0x1000000f, 64000,400,NULL,false,
0,0);
s_gen.Create(cdSEQ_DIST,
0x30000001, 0x30000001, 64000,10);
for(int i=0;i<200;i++) {
s_gen.GenerateTuple(result);
c_gen.GenerateTuple(result);
// gen.Dump(stdout);
// fprintf(stdout, "i:%d\n",i);
result_src = result.getClient();
result_dest = result.getServer();
result_port = result.getClientPort();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i%15));
EXPECT_EQ(result_dest, (uint32_t) (((0x30000001)) ) );
EXPECT_EQ(result_port, 1024+i/15);
}
s_gen.Delete();
c_gen.Delete();
}
示例3:
TEST(tuple_gen_2,GenerateTuple2) {
CTupleGeneratorSmart gen;
gen.Create(1, 1);
gen.add_client_pool(cdSEQ_DIST,0x10000001,0x1000000f,64000,4,g_dummy,0,0);
gen.add_server_pool(cdSEQ_DIST,0x30000001,0x40000001,64000,4,false);
CTupleTemplateGeneratorSmart template_1;
template_1.Create(&gen,0,0);
CTupleBase result;
uint32_t result_src;
uint32_t result_dest;
uint16_t result_port;
for(int i=0;i<200;i++) {
template_1.GenerateTuple(result);
// gen.Dump(stdout);
// fprintf(stdout, "i:%d\n",i);
result_src = result.getClient();
result_dest = result.getServer();
result_port = result.getClientPort();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i%15));
EXPECT_EQ(result_dest, (uint32_t)((0x30000001+i) ) );
EXPECT_EQ(result_port, 1024+i/15);
}
gen.Delete();
// EXPECT_EQ((size_t)0, gen.m_clients.size());
gen.Create(1, 1);
gen.add_client_pool(cdSEQ_DIST,0x10000001,0x1000000f,64000,4,g_dummy,0,0);
gen.add_server_pool(cdSEQ_DIST,0x30000001,0x40000001,64000,4,false);
template_1.Create(&gen,0,0);
for(int i=0;i<200;i++) {
template_1.GenerateTuple(result);
// gen.Dump(stdout);
// fprintf(stdout, "i:%d\n",i);
result_src = result.getClient();
result_dest = result.getServer();
result_port = result.getClientPort();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i%15));
EXPECT_EQ(result_dest, (uint32_t) (((0x30000001+i)) ) );
EXPECT_EQ(result_port, 1024+i/15);
}
}
示例4: printf
/* UIT of CClientPool, using CClientInfo */
TEST(tuple_gen,clientPool) {
CClientPool gen;
gen.Create(cdSEQ_DIST,
0x10000001, 0x10000021, 64000,1000, g_dummy,
0,0);
CTupleBase result;
uint32_t result_src;
uint16_t result_port;
for(int i=0;i<10;i++) {
gen.GenerateTuple(result);
printf(" C:%x P:%d \n",result.getClient(),result.getClientPort());
result_src = result.getClient();
result_port = result.getClientPort();
EXPECT_EQ(result_src, (uint32_t)(0x10000001+i));
EXPECT_EQ(result_port, 1024);
}
gen.Delete();
// EXPECT_EQ((size_t)0, gen.m_clients.size());
}