本文整理汇总了C++中getUsage函数的典型用法代码示例。如果您正苦于以下问题:C++ getUsage函数的具体用法?C++ getUsage怎么用?C++ getUsage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUsage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseCommandLine
static int
parseCommandLine( int argc, const char ** argv )
{
int c;
const char * optarg;
while(( c = tr_getopt( getUsage( ), argc, argv, options, &optarg )))
{
switch( c )
{
case 'a': add = optarg;
break;
case 'd': deleteme = optarg;
break;
case 'r': replace[0] = optarg;
c = tr_getopt( getUsage( ), argc, argv, options, &optarg );
if( c != TR_OPT_UNK ) return 1;
replace[1] = optarg;
break;
case TR_OPT_UNK: files[fileCount++] = optarg; break;
default: return 1;
}
}
return 0;
}
示例2: main
int main(int argc, char *argv[])
{
try
{
libmaus2::util::ArgInfo const arginfo(argc,argv);
libmaus2::util::ArgParser const arg(argc,argv);
if ( arg.argPresent("h") || arg.argPresent("help") )
{
std::cerr << getUsage(arg);
return EXIT_SUCCESS;
}
else if ( arg.argPresent("version") )
{
std::cerr << "This is " << PACKAGE_NAME << " version " << PACKAGE_VERSION << std::endl;
return EXIT_SUCCESS;
}
else if ( arg.size() < 2 )
{
std::cerr << getUsage(arg);
return EXIT_FAILURE;
}
return lassort(arg,arginfo);
}
catch(std::exception const & ex)
{
std::cerr << ex.what() << std::endl;
return EXIT_FAILURE;
}
}
示例3: glBufferData
void GLBuffer::unmapStream()
{
// "orphan" current buffer to avoid implicit synchronisation on the GPU:
// http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
glBufferData(getTarget(), (GLsizeiptr) getSize(), nullptr, getUsage());
glBufferData(getTarget(), (GLsizeiptr) getSize(), memory_map, getUsage());
}
示例4: getUsage
const std::string& CmdWriteOSGFile::execute( const std::vector< std::string >& arguments )
{
bool hasinputfile = false;
if ( arguments.size() < 1 )
{
_cmdResult = getUsage();
return _cmdResult;
}
else if ( ( arguments.size() > 2 ) && ( arguments[ 0 ] == "-i" ) )
{
hasinputfile = true;
}
else
{
_cmdResult = getUsage();
return _cmdResult;
}
EnConsole* p_console = static_cast< EnConsole* >( yaf3d::EntityManager::get()->findEntity( ENTITY_NAME_CONSOLE ) );
assert( p_console && "CmdWriteOSGFile::execute: console entity could not be found!" );
std::string cwd = yaf3d::Application::get()->getMediaPath() + p_console->getCWD() + "/";
if ( !hasinputfile )
{
osg::Group* grp = yaf3d::Application::get()->getSceneRootNode();
if ( grp )
{
_cmdResult = "writing scene to osg file '" + arguments[ 0 ] + "\n";
std::string filename = cwd + arguments[ 0 ];
if ( !osgDB::writeNodeFile( *grp, filename ) )
{
_cmdResult += " warning: problem writing file '" + filename + "\n";
}
}
}
else
{
_cmdResult = "reading scene file " + arguments[ 1 ] + " ...\n";
std::string infilename = cwd + arguments[ 1 ];
osg::ref_ptr< osg::Node > node = osgDB::readNodeFile( infilename );
if ( node.get() )
{
std::string outfilename = cwd + arguments[ 2 ];
_cmdResult += "writing scene to file " + outfilename + "\n";
if ( !osgDB::writeNodeFile( *( node.get() ), outfilename ) )
{
_cmdResult += " warning: problem writing file " + outfilename + "\n";
}
}
else
{
_cmdResult += "cannot read scene file " + infilename + "\n";
}
}
return _cmdResult;
}
示例5: glBufferDataARB
void VBO::unmap()
{
if (!is_mapped)
return;
// "orphan" current buffer to avoid implicit synchronisation on the gpu:
// http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
glBufferDataARB(getTarget(), getSize(), NULL, getUsage());
glBufferDataARB(getTarget(), getSize(), memory_map, getUsage());
is_mapped = false;
}
示例6: if
int RespondTemplate::execute(int argc, char* argv[])
{
int status = CommandProcessor::COMMAND_FAILED;
UtlString usage;
//printf("no operation command with %d arguments\n", argc);
if(argc == 1)
{
status = CommandProcessor::COMMAND_SUCCESS;
messageProcessor->stopResponding();
}
else if(argc == 2)
{
{
UtlString fileName;
fileName = argv[1];
messageProcessor->startResponding(fileName.data(), -1 );
status = CommandProcessor::COMMAND_SUCCESS;
}
}
else
{
UtlString usage;
getUsage(argv[0], &usage);
printf("%s", usage.data());
status = CommandProcessor::COMMAND_BAD_SYNTAX;
}
return(status);
}
示例7: CHECK_GL_ERROR
void nuVertexBuffer::update(void)
{
if(!isInitialized()) {
CHECK_GL_ERROR(glGenBuffers(1, &mVertexBufferID));
NU_ASSERT(mVertexBufferID != 0, "Cannot generate vertex buffer object.\n");
CHECK_GL_ERROR(glBindBuffer(GL_ARRAY_BUFFER, mVertexBufferID));
CHECK_GL_ERROR(glBufferData(GL_ARRAY_BUFFER, mSize, mpBuffer, getResourceUsage()));
if(getUsage() == nuGResource::STATIC_RESOURCE)
releaseBuffer();
mCommitSize = 0;
setInitialized(true);
} else {
CHECK_GL_ERROR(glBindBuffer(GL_ARRAY_BUFFER, mVertexBufferID));
if(mCommitSize > VERTEX_BUFFER_MAP_THRESHOLD) {
void* p_buffer;
CHECK_GL_ERROR(p_buffer = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY));
memcpy(p_buffer, mpBuffer, mCommitSize);
CHECK_GL_ERROR(glUnmapBuffer(GL_ARRAY_BUFFER));
} else {
CHECK_GL_ERROR(glBufferSubData(GL_ARRAY_BUFFER, 0, mCommitSize, mpBuffer));
}
mCommitSize = 0;
}
}
示例8: end
string Clocker::readResetDetailed() {
ostringstream str;
long dsec, usec;
double utime, stime;
end();
double diff = getTimediff();
unsigned long usage = getUsage();
double timeUsed = usage / 1E6;
dsec = r_usageEnd.ru_utime.tv_sec - r_usageStart.ru_utime.tv_sec;
usec = r_usageEnd.ru_utime.tv_usec - r_usageStart.ru_utime.tv_usec;
utime = (1000000* dsec + usec) / 1E6;
dsec = r_usageEnd.ru_stime.tv_sec - r_usageStart.ru_stime.tv_sec;
usec = r_usageEnd.ru_stime.tv_usec - r_usageStart.ru_stime.tv_usec;
stime = (1000000* dsec + usec) / 1E6;
long maxrss = r_usageEnd.ru_maxrss;
long nvcsw = r_usageEnd.ru_nvcsw ;
long nivcsw = r_usageEnd.ru_nivcsw;
str << ":: " << now << " :: " << setfill('0') << setprecision(6) << setw(10) << diff << " sec elapsed";
str << " (since " << since << ")" << endl;
str << ":: " << now << " :: time(user) " << setfill(' ') << setprecision(4) << utime;
str << " :: time(system) " << setfill(' ') << setprecision(4) << stime;
str << " :: time(total) " << setfill(' ') << setprecision(4) << timeUsed;
str << "\n:: " << now
<< " :: maxRss=" << maxrss
<< " :: cntxSwitch(user)=" << nvcsw
<< " :: cntxSwitch(forc)=" << nivcsw;
begin();
return str.str();
}
示例9: getUsage
void Options::parseFromCommandLine(int argc, char **argv) {
po::variables_map options;
po::command_line_parser parser { argc, argv };
auto usage = getUsage();
auto positional = getPositional();
try {
po::store(
parser.options(usage)
.positional(positional)
.run(),
options
);
if (options.count("help")) {
std::cerr << usage << std::endl;
exit(0);
}
po::notify(options);
}
catch (const po::error & exception) {
std::cerr << exception.what() << std::endl << std::endl;
std::cerr << usage << std::endl;
exit(1);
}
}
示例10: parseCommandLine
static int
parseCommandLine( int argc, const char ** argv )
{
int c;
const char * optarg;
while(( c = tr_getopt( getUsage( ), argc, argv, options, &optarg )))
{
switch( c )
{
case 'p': isPrivate = TRUE; break;
case 'o': outfile = optarg; break;
case 'c': comment = optarg; break;
case 't': if( trackerCount + 1 < MAX_TRACKERS ) {
trackers[trackerCount].tier = trackerCount;
trackers[trackerCount].announce = (char*) optarg;
++trackerCount;
}
break;
case TR_OPT_UNK: infile = optarg; break;
default: return 1;
}
}
return 0;
}
示例11: getUsage
const std::string& CmdEntityAttributeSet::execute( const std::vector< std::string >& arguments )
{
_cmdResult = "";
if ( arguments.size() < 3 )
{
_cmdResult = getUsage();
return _cmdResult;
}
yaf3d::BaseEntity* p_entity = yaf3d::EntityManager::get()->findInstance( arguments[ 0 ] );
if ( ! p_entity )
{
_cmdResult = "* entity instance '" + arguments[ 0 ] + "' does not exist";
return _cmdResult;
}
// set attribute value using value string
if ( !p_entity->getAttributeManager().setAttributeValueByString( arguments[ 1 ], arguments[ 2 ] ) )
{
_cmdResult = "* error setting attribute value, check the value format!";
}
else
{
// now send out a notification to the entity this way letting it know that we changed an attribute value
// the entity can decide itself if an appropriate action is necessary in this case
yaf3d::EntityNotification notification( YAF3D_NOTIFY_ENTITY_ATTRIBUTE_CHANGED );
yaf3d::EntityManager::get()->sendNotification( notification, p_entity );
}
return _cmdResult;
}
示例12: dbgf
HRESULT IDirect3DDevice9New::CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle)
{
dbgf("dev: CreateIndexBuffer %s %s", getUsage(Usage), getPool(Pool));
if(config.debug.compatibleIB)
{
// Compatible index buffer mode - do not use emulated IB, set dynamic memory instead
if(Pool == D3DPOOL_MANAGED)
{
ONCE dbg("DEBUG: using compatible index buffers (manage-emulation disabled)");
Pool = D3DPOOL_DEFAULT;
Usage |= D3DUSAGE_DYNAMIC;
}
return dev->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle);
}
#if USE_D3DEX || MANAGE_DEBUG_IB
/*if(Pool == D3DPOOL_MANAGED && Usage == D3DUSAGE_WRITEONLY)
Pool = D3DPOOL_DEFAULT; // No need for manage-emulation for writeonly buffers, just set pool to default*/
if(Pool == D3DPOOL_MANAGED)
{
*ppIndexBuffer = new IDirect3DIndexBuffer9Managed((IDirect3DDevice9Ex*)dev, this, Length, Usage, Format, Pool, pSharedHandle);
// TODO: check for failure
return D3D_OK;
}
#endif
return dev->CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, pSharedHandle);
}
示例13: printf
int KeyCommand::execute(int argc, char* argv[])
{
int commandStatus = CommandProcessor::COMMAND_FAILED;
if(argc == 1)
{
printf("\t\t\t Shortcut Keys\n");
printf("al ---------> addline\t\t\taacc ---------> autoaccept\n");
printf("aans ---------> autoanswer\t\tarej ---------> autoreject\n");
printf("cacc ---------> callaccept\t\tcans ---------> callanswer\n");
printf("cco ---------> callconnect\t\tccr --------->callcreate\n");
printf("cd ---------> calldestroy\t\tch ---------> callhold\n");
printf("pf ---------> callplayfile\t\tcr ---------> callredirect\n");
printf("si ---------> callsendinfo\t\tst ---------> callstarttone\n");
printf("csub ---------> callsubscribe\t\tcu ---------> callunhold\n");
printf("cfa ---------> conferenceadd\t\tcfcr ---------> conferencecreate\n");
printf("cfd ---------> conferencedestroy\tcfgc ---------> conferencegetcalls\n");
printf("cfh ---------> conferencehold\t\tcfj ---------> conferencejoin\n");
printf("cfu ---------> conferenceunhold\t\tcp ---------> createpublisher\n");
printf("dp ---------> destroypublisher\t\tup ---------> updatepublisher\n");
printf("es ---------> enablestun\t\ter ---------> enablerport\n");
printf("\t\t\thi ---------> history\n");
}
else
{
UtlString usage;
getUsage(argv[0], &usage);
printf("%s", usage.data());
commandStatus = CommandProcessor::COMMAND_BAD_SYNTAX;
}
return commandStatus;
}
示例14: getUsage
const std::string& CmdEntityAttributeList::execute( const std::vector< std::string >& arguments )
{
if ( arguments.size() < 1 )
{
_cmdResult = getUsage();
return _cmdResult;
}
_cmdResult = "list of entity attributes:\n";
yaf3d::BaseEntity* p_entity = yaf3d::EntityManager::get()->findInstance( arguments[ 0 ] );
if ( ! p_entity )
{
_cmdResult = "* entity instance '" + arguments[ 0 ] + "' does not exist";
return _cmdResult;
}
std::vector< std::vector< std::string > > attributes;
p_entity->getAttributeManager().getAttributesAsString( attributes );
std::string info;
std::vector< std::vector< std::string > >::iterator p_beg = attributes.begin(), p_end = attributes.end();
for ( ; p_beg != p_end; ++p_beg )
{
info += ( *p_beg )[ 0 ] + " [ " + ( *p_beg )[ 1 ] + " ] \n";
}
_cmdResult = info;
return _cmdResult;
}
示例15: getConfigDir
static char const* getConfigDir(int argc, char const* const* argv)
{
int c;
char const* configDir = NULL;
char const* optarg;
int const ind = tr_optind;
while ((c = tr_getopt(getUsage(), argc, argv, options, &optarg)) != TR_OPT_DONE)
{
if (c == 'g')
{
configDir = optarg;
break;
}
}
tr_optind = ind;
if (configDir == NULL)
{
configDir = tr_getDefaultConfigDir(MY_NAME);
}
return configDir;
}