本文整理汇总了C++中OptionsParser::ParseOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionsParser::ParseOptions方法的具体用法?C++ OptionsParser::ParseOptions怎么用?C++ OptionsParser::ParseOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionsParser
的用法示例。
在下文中一共展示了OptionsParser::ParseOptions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char **argv) {
OptionsParser parser;
if (parser.ParseOptions(argc, argv) < 0 || parser.m_Help) {
parser.Usage(argv[0]);
return -1;
}
Sid::SkypePCMInterfaceServer *pcmif_server = new Sid::SkypePCMInterfaceServer();
Sid::SkypePCMCallbackInterfaceClient *pcmif_cb_client = new Sid::SkypePCMCallbackInterfaceClient();
SkypePCMInterface* pcmif = SkypePCMInterfaceGet(pcmif_cb_client);
pcmif_server->set_if(pcmif);
Sid::String fromskypekitkey;
Sid::String toskypekitkey;
fromskypekitkey.Format( "%spcm_from_skypekit_key", parser.m_IpcPrefix);
toskypekitkey.Format( "%spcm_to_skypekit_key", parser.m_IpcPrefix);
pcmif_server->Connect(fromskypekitkey.data(), 0);
pcmif_cb_client->Connect(toskypekitkey.data(), 500);
if(parser.m_OutFile)
{
Sid::String cmd;
Sid::String response;
cmd.Format("OUT:%s",parser.m_OutFile);
pcmif->CustomCommand(cmd, response);
}
if(parser.m_InFile)
{
Sid::String cmd;
Sid::String response;
cmd.Format("IN:%s",parser.m_InFile);
pcmif->CustomCommand(cmd,response);
}
if(parser.m_Loop)
{
Sid::String cmd = "LOOP:1";
Sid::String response;
pcmif->CustomCommand("LOOP:1", response);
}
Sid::Protocol::Status status;
do {
status =pcmif_server->ProcessCommands();
} while (status == Sid::Protocol::OK);
SkypePCMInterfaceRelease(pcmif);
pcmif_server->Disconnect();
pcmif_cb_client->Disconnect();
delete pcmif_server;
delete pcmif_cb_client;
printf("PCMServerTransport disconnected, exiting from pcmtesthost\n");
}
示例2: main
int main(int argc, const char * argv[])
{
OptionsParser parser;
if (parser.ParseOptions(argc, argv) < 0 || parser.m_Help) {
parser.Usage(argv[0]);
return -1;
}
if (parser.m_List) {
CPPUNIT_NS::Test *test = CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
for (int i = 0; i < test->getChildTestCount(); i++) {
printf("test %s\n", test->getChildTestAt(i)->getName().c_str());
for (int j = 0; j < test->getChildTestAt(i)->getChildTestCount(); j++) {
printf("test %s\n", test->getChildTestAt(i)->getChildTestAt(j)->getName().c_str());
}
}
return 0;
}
CPPUNIT_NS::TestResult controller;
// Add a listener that colllects test result
CPPUNIT_NS::TestResultCollector result;
controller.addListener( &result );
// Add a listener that print dots as test run.
CPPUNIT_NS::BriefTestProgressListener progress;
controller.addListener( &progress );
CPPUNIT_NS::TestRunner runner;
// Add the single test to the test runner
if (parser.m_RunSingle) {
runner.addTest(
CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest()->findTest(parser.m_TestName));
// Add the top suite to the test runner
} else {
runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
}
runner.run( controller );
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
outputter.write();
return result.wasSuccessful() ? 0 : 1;
}
示例3: main
// ==================================================================================================================
// BEGIN: main
// ==================================================================================================================
int main(int argc, char *argv[])
{
OptionsParser op;
if (!op.ParseOptions(argc, argv))
return -1;
std::string outputDir = utils::GetParentDirectory(op.outputFilename);
communicator_type com;
com.allocateGPU();
agile::GPUTimer timer;
timer.start();
agile::GPUEnvironment::printInformation(std::cout);
std::cout << std::endl;
// kdata
CVector kdata;
// kspace mask/trajectory
RVector mask;
// density compensation in case of nonuniform data
RVector w(0);
// get data dimensions
std::string extension = utils::GetFileExtension(op.kdataFilename);
std::cout << "Extension:" << extension << std::endl;
Dimension dims; // = op.dims;
if (extension.compare(".bin") == 0)
dims = op.dims;
else if (extension.compare(".cfl") == 0)
{
long dimensions[4];
utils::ReadCflHeader(op.kdataFilename, dimensions);
dims.width=dimensions[0];
dims.height=dimensions[1];
dims.depth=dimensions[2];
dims.readouts=dimensions[0];
dims.encodings=dimensions[1];
dims.encodings2=dimensions[2];
dims.coils=dimensions[3];
dims.frames=dimensions[3];
std::cout << "DIMS main; nx: " << dims.width << " / ny:" << dims.height << " / nz:" << dims.depth << " / nc:" << dims.coils << std::endl;
std::cout << "DIMS main; nRO: " << dims.readouts << " / nENC1:" << dims.encodings << " / nENC2:" << dims.encodings2 << " / nframes:" << dims.frames << std::endl;
}
if (op.rawdata)
{
PerformRawDataPreparation(dims, op, kdata, mask, w);
}
else
{
std::cout << "Binary files defined...." << std::endl;
if (!LoadGPUVectorFromFile(op.kdataFilename, kdata))
return -1;
else
std::cout << "Data File " << op.kdataFilename << " successfully loaded." << std::endl;
if (!LoadGPUVectorFromFile(op.maskFilename, mask))
return -1;
else
std::cout << "Mask File " << op.maskFilename << " successfully loaded." << std::endl;
// set values in data-array to zero according to mask
if (!op.nonuniform)
{
if (op.method==TGV2_3D)
{
for (unsigned coil = 0; coil < dims.coils; coil++)
{
unsigned offset = dims.width * dims.height * dims.depth * coil;
agile::lowlevel::multiplyElementwise(
kdata.data() + offset, mask.data(),
kdata.data() + offset, dims.width * dims.height * dims.depth);
}
}
else
{
for (unsigned frame = 0; frame < dims.frames; frame++)
{
unsigned offset = dims.width * dims.height * dims.coils * frame;
for (unsigned coil = 0; coil < dims.coils; coil++)
{
unsigned int x_offset = offset + coil * dims.width * dims.height;
agile::lowlevel::multiplyElementwise(
kdata.data() + x_offset, mask.data() + dims.width * dims.height * frame,
kdata.data() + x_offset, dims.width * dims.height);
}
}
}
}
}
//.........这里部分代码省略.........