本文整理汇总了C++中Library::Env方法的典型用法代码示例。如果您正苦于以下问题:C++ Library::Env方法的具体用法?C++ Library::Env怎么用?C++ Library::Env使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Library
的用法示例。
在下文中一共展示了Library::Env方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int CDECL main(int aArgc, char* aArgv[])
{
InitialisationParams* initParams = InitialisationParams::Create();
OptionParser parser;
OptionUint optionDuration("-d", "--duration", 30, "Number of seconds to run the test");
parser.AddOption(&optionDuration);
if (!parser.Parse(aArgc, aArgv)) {
return (1);
}
Library* lib = new Library(initParams);
std::vector<NetworkAdapter*>* subnetList = lib->CreateSubnetList();
TIpAddress subnet = (*subnetList)[0]->Subnet();
Library::DestroySubnetList(subnetList);
CpStack* cpStack = lib->StartCp(subnet);
// Debug::SetLevel(Debug::kTopology);
ReceiverManager1Logger* logger = new ReceiverManager1Logger(*cpStack);
Blocker* blocker = new Blocker(lib->Env());
blocker->Wait(optionDuration.Value());
delete blocker;
delete (logger);
Print("Closing ... ");
delete lib;
Print("closed\n");
}
示例2: duration
void OpenHome::TestFramework::Runner::Main(TInt aArgc, TChar* aArgv[], InitialisationParams* aInitParams)
{
OptionParser parser;
OptionUint duration("-d", "--duration", 30, "Number of seconds to run the test");
OptionUint adapter("-i", "--interface", 0, "index of network adapter to use");
parser.AddOption(&duration);
parser.AddOption(&adapter);
if (!parser.Parse(aArgc, aArgv) || parser.HelpDisplayed()) {
return;
}
Library* lib = new Library(aInitParams);
std::vector<NetworkAdapter*>* ifs = Os::NetworkListAdapters(lib->Env(), InitialisationParams::ELoopbackExclude, "TestTopology2");
ASSERT(ifs->size() > 0 && adapter.Value() < ifs->size());
TIpAddress subnet = (*ifs)[adapter.Value()]->Subnet();
for (TUint i=0; i<ifs->size(); i++) {
(*ifs)[i]->RemoveRef("TestTopology2");
}
delete ifs;
CpStack* cpStack = lib->StartCp(subnet);
Endpoint endpt(0, subnet);
Endpoint::AddressBuf buf;
endpt.AppendAddress(buf);
Print("Using network interface %s\n\n", buf.Ptr());
// Debug::SetLevel(Debug::kTopology);
// Debug::SetLevel(Debug::kAll);
TopologyLogger logger;
CpTopology2* topology = new CpTopology2(*cpStack, logger);
if (topology != NULL) {
Blocker* blocker = new Blocker(lib->Env());
blocker->Wait(duration.Value());
delete blocker;
}
delete topology;
delete lib;
}
示例3: mx
void OpenHome::TestFramework::Runner::Main(TInt aArgc, TChar* aArgv[], Net::InitialisationParams* aInitParams)
{
std::vector<Brn> args = OptionParser::ConvertArgs(aArgc, aArgv);
OptionParser parser;
OptionUint mx("-mx", "--mx", 1, "[1..5] number of second to spread response over");
parser.AddOption(&mx);
if (!parser.Parse(args, true) || parser.HelpDisplayed()) {
return;
}
if (mx.Value() != 0) {
aInitParams->SetMsearchTime(mx.Value());
}
Library* lib = new Net::Library(aInitParams);
TestSsdpUListen(lib->Env(), args);
delete lib;
}