本文整理汇总了C++中GetArgs函数的典型用法代码示例。如果您正苦于以下问题:C++ GetArgs函数的具体用法?C++ GetArgs怎么用?C++ GetArgs使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetArgs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: packet
/*
Extract the exit code out of a PP_FINISH packet (used in SysMan)
*/
int
getExitCode(int nbytes, GlobalTaskId *sender_idp) {
int exitCode=0;
if (nbytes==4) { // Notification from a task doing pvm_exit
GetArgs(sender_idp,1); // Presumably this must be MainPE Id
exitCode = -1;
} else if (nbytes==8) { // Doing a controlled shutdown
GetArgs(&exitCode,1); // HACK: controlled shutdown == 2 values
GetArgs(&exitCode,1);
} else {
exitCode = -2; // everything else
}
return exitCode;
}
示例2: GetArgs
bool CTestCacheApp::TestApp_Init(void)
{
NcbiCout << NcbiEndl
<< "Testing cache with "
<< NStr::IntToString(s_NumThreads)
<< " threads..."
<< NcbiEndl;
const CArgs& args = GetArgs();
m_CacheSize = args["cache_size"].AsInt8();
m_ElementDataSize = args["element_size"].AsInt8();
if (args["size_type"].AsString() == "ubyte") {
m_UCharCache.reset(new TUCharCache((unsigned char)(m_CacheSize)));
}
else if (args["size_type"].AsString() == "uint") {
m_UIntCache.reset(new TUIntCache((unsigned int)(m_CacheSize)));
}
else if (args["size_type"].AsString() == "uint8") {
m_UInt8Cache.reset(new TUInt8Cache(m_CacheSize));
}
else if (args["size_type"].AsString() == "byte") {
m_IntCache.reset(new TIntCache((signed char)(m_CacheSize)));
}
return true;
}
示例3: GetArgs
void
CSeqDBPerfApp::x_InitApplicationData()
{
CStopWatch sw;
sw.Start();
const CArgs& args = GetArgs();
const CSeqDB::ESeqType kSeqType = ParseMoleculeTypeString(args["dbtype"].AsString());
const string& kDbName(args["db"].AsString());
m_BlastDb.Reset(new CSeqDBExpert(kDbName, kSeqType));
m_DbIsProtein = static_cast<bool>(m_BlastDb->GetSequenceType() == CSeqDB::eProtein);
int kNumThreads = 1;
#if (defined(_OPENMP) && defined(NCBI_THREADS))
kNumThreads = args["num_threads"].AsInteger();
#endif
m_DbHandles.reserve(kNumThreads);
m_DbHandles.push_back(m_BlastDb);
if (kNumThreads > 1) {
for (int i = 1; i < kNumThreads; i++) {
m_BlastDb.Reset(new CSeqDBExpert(kDbName, kSeqType));
m_DbHandles.push_back(m_BlastDb);
}
}
m_MemoryUsage.assign(kNumThreads, SMemUsage());
sw.Stop();
cout << "Initialization time: " << sw.AsSmartString() << endl;
}
示例4: GetArgs
int CTestDateApp::Run(void)
{
const CArgs& args = GetArgs();
CDate date;
CDate_std& std = date.SetStd();
std.SetYear(args["Y"].AsInteger());
if (args["M"]) {
std.SetMonth(args["M"].AsInteger());
}
if (args["D"]) {
std.SetDay(args["D"].AsInteger());
}
if (args["S"]) {
std.SetSeason(args["S"].AsString());
}
// ...
string s;
date.GetDate(&s);
NcbiCout << '\"' << s << '\"' << NcbiEndl;
s.erase();
date.GetDate(&s, args["f"].AsString());
NcbiCout << '\"' << s << '\"' << NcbiEndl;
s.erase();
date.GetDate(&s, "%Y-%M-%D");
NcbiCout << '\"' << s << '\"' << NcbiEndl;
return 0;
}
示例5: Optimize
void SubExpressionTap::Optimize(Block *block){
blocks.push(block);
SubExpressionBlock *exprList = block->GetExprBlock();
const int size = block->body.size();
for(int i = 0; i < size; i++){
Node *expr = block->body[i + temp_counter];
if(expr->isCycle())
continue;
if(Block* b = dynamic_cast<Block*>(expr)){
Optimize(b);
continue;
}
if(FuncCallNode *cNode = dynamic_cast<FuncCallNode*>(expr)){
for(Node *arg : cNode->args)
GetArgs(*exprList, arg);
continue;
}
if(IfStatement *$if = dynamic_cast<IfStatement*>(expr)){
Optimize(dynamic_cast<Block*>($if->if_branch));
if($if->else_branch)
Optimize(dynamic_cast<Block*>($if->else_branch));
continue;
}
if(ReturnStatement *retNode = dynamic_cast<ReturnStatement*>(expr))
expr = retNode->value;
if(!expr->isExpression())
continue;
Node *t = OptimizeExpression(expr);
if(t != expr){
block->body[i + temp_counter] = t;
}
}
ReplaceFirstOccur();
blocks.pop();
}
示例6: Main
Int2 Main (void)
{
Char buf[256] = { '\0' }; /* Used below for name and version. */
Int2 status = 0; /* return value of function. */
StringCpy(buf, "bl2seq ");
StringNCat(buf, BlastGetVersionNumber(), sizeof(buf)-StringLen(buf)-1);
if (! GetArgs (buf, NUMARG, myargs)) {
return (1);
}
UseLocalAsnloadDataAndErrMsg ();
if (! SeqEntryLoad())
return 1;
ErrSetMessageLevel(SEV_WARNING);
if (myargs[ARG_FORCE_OLD].intvalue != 0)
status = Main_old();
else
status = Main_new();
FreeArgs(NUMARG, myargs);
return status;
}
示例7: Nlm_Main
Int2 Nlm_Main(void) {
Boolean use_new_engine=FALSE;
char buf[256] = { '\0' };
StringCpy(buf, "mgblast ");
StringNCat(buf, BlastGetVersionNumber(), sizeof(buf)-StringLen(buf)-1);
if (! GetArgs (buf, NUMARG, myargs))
return (1);
UseLocalAsnloadDataAndErrMsg ();
if (! SeqEntryLoad())
return 1;
ErrSetMessageLevel(SEV_WARNING);
/*
if (myargs[ARG_FORCE_OLD].intvalue == 0 &&
myargs[ARG_OUTTYPE].intvalue > 1 &&
myargs[ARG_GILIST].strvalue == NULL)
use_new_engine = readdb_use_new_blast(myargs[ARG_DB].strvalue);
if (myargs[ARG_MASKEDQUERY].strvalue)
use_new_engine = FALSE;
*/
/*if (use_new_engine)
return Main_new();
else */
return Main_old();
}
示例8: wxLogError
void dlgFunction::OnChangeArg(wxCommandEvent &ev)
{
if (GetSelectedDirection() == wxT("VARIADIC") &&
!cbDatatype->GetValue().EndsWith(wxT("[]")))
{
wxLogError(_("Only array types can be VARIADIC."));
return;
}
int row = lstArguments->GetSelection();
if (row >= 0)
{
lstArguments->SetItem(row, 0, cbDatatype->GetValue());
lstArguments->SetItem(row, 1, GetSelectedDirection());
lstArguments->SetItem(row, 2, txtArgName->GetValue());
if (isBackendMinVer84)
lstArguments->SetItem(row, 3, txtArgDefVal->GetValue());
if (!function)
argOids.Item(row) = typOids.Item(cbDatatype->GetGuessedSelection());
txtArguments->SetValue(GetArgs());
}
OnChangeArgName(ev);
CheckChange();
}
示例9: GetArgs
void CTest::RunInternalTest(void)
{
const CArgs& args = GetArgs();
string test = args["fmt"].AsString();
// Set a random starting point
unsigned int seed = (unsigned int)time(0);
//LOG_POST("Random seed = " << seed);
srand(seed);
// Preparing test data
m_BufLen = 10*100*1024; // 10MB
AutoArray<char> src_buf_arr(m_BufLen);
m_Buf = src_buf_arr.get();
assert(m_Buf);
for (size_t i=0; i<m_BufLen; i++) {
m_Buf[i] = (char)(rand() % 255);
}
// Prepare source tree
CreateSourceTree();
// Run tests
if (test == "all" || test == "zip") {
_TRACE("-------------- Zip ---------------\n");
RunInternalTestFormat(CArchive::eZip);
}
// Cleanup
CDir(GetDir("test_archive_in")).Remove();
CDir(GetDir("test_archive_out")).Remove();
}
示例10: QScrollArea
void MainWindow::OpenImage(const QString &fileName)
{
QScrollArea* area = new QScrollArea();
ImageWidget* img = new ImageWidget();
// Nur les- und schreibbare Bildformate werden unterstützt
if (img->OpenImage(fileName)) {
QString shortFileName = ParseFileName(fileName);
shortFileName = shortFileName.mid(0, shortFileName.lastIndexOf('.'));
// Bild in die ScrollArea laden
area->setWidget(img);
area->setStyleSheet("background: qlineargradient(x1: 0, y0: 1, x2:1, y2: 0, stop: 0.96 #383838, stop: 0.99 #2e2e2e);");
// neuen Tab hinzufügen
int index = ui->imagetab->addTab(area, shortFileName);
ui->imagetab->setTabToolTip(index, shortFileName);
ui->imagetab->setCurrentIndex(index);
// schließlich Signalhandler setzen
connect(this, SIGNAL(Arguments(QHash<QString,QString>)), img, SLOT(Arguments(QHash<QString,QString>)));
connect(this, SIGNAL(Operation(IOperation*,QHash<QString,QString>)), img, SLOT(Operation(IOperation*,QHash<QString,QString>)));
connect(this, SIGNAL(Operation(IOperation*,QHash<QString,QString>,OperationType)), img, SLOT(Operation(IOperation*,QHash<QString,QString>,OperationType)));
emit Operation(mOperation, GetArgs());
}
示例11: LowLevelTest
int CBAMTestApp::Run(void)
{
#ifdef CALL
return LowLevelTest();
#endif
// Get arguments
const CArgs& args = GetArgs();
string path;
vector<string> dirs;
if ( args["dir"] ) {
dirs.push_back(args["dir"].AsString());
}
else {
vector<string> reps;
reps.push_back(string(NCBI_GetTestDataPath())+"/traces02");
reps.push_back(string(NCBI_GetTestDataPath())+"/traces04");
ITERATE ( vector<string>, it, reps ) {
dirs.push_back(CFile::MakePath(*it, BAM_DIR1));
dirs.push_back(CFile::MakePath(*it, BAM_DIR2));
dirs.push_back(CFile::MakePath(*it, BAM_DIR3));
dirs.push_back(CFile::MakePath(*it, BAM_DIR4));
dirs.push_back(CFile::MakePath(*it, BAM_DIR5));
}
}
示例12: GetArgs
int CTestApplication::Run(void)
{
//export CONN_DEBUG_PRINTOUT=data
//CORE_SetLOG(LOG_cxx2c());
//SetDiagTrace(eDT_Enable);
//SetDiagPostLevel(eDiag_Info);
//SetDiagPostFlag(eDPF_All);
//test_id1_calls();
const CArgs& args = GetArgs();
int count = args["count"].AsInteger();
Int8 gi_from = args["gi_from"].AsInt8();
Int8 gi_to = args["gi_to"].AsInt8();
CRef<CObjectManager> om = CObjectManager::GetInstance();
for ( int i = 0; i < 100; ++i ) {
CGBDataLoader::RegisterInObjectManager(*om, new CId1Reader);
}
for ( int pass = 0; pass < count; ++pass ) {
CRef<CReadDispatcher> dispatcher(new CReadDispatcher);
CRef<CReader> reader(new CId1Reader);
dispatcher->InsertReader(0, reader);
for ( Int8 gi = gi_from; gi <= gi_to; gi++ ) {
NcbiCout << "gi: " << gi << ": " << NcbiEndl;
CSeq_id_Handle seq_id = CSeq_id_Handle::GetGiHandle(gi);
CStandaloneRequestResult request(seq_id);
dispatcher->LoadSeq_idSeq_ids(request, seq_id);
CLoadLockSeqIds seq_ids(request, seq_id);
NcbiCout << " ids:";
CFixedSeq_ids ids2 = seq_ids.GetSeq_ids();
ITERATE ( CFixedSeq_ids, i, ids2 ) {
NcbiCout << " " << i->AsString();
}
NcbiCout << NcbiEndl;
CLoadLockBlobIds blob_ids(request, seq_id, 0);
dispatcher->LoadSeq_idBlob_ids(request, seq_id, 0);
CFixedBlob_ids ids = blob_ids.GetBlob_ids();
ITERATE ( CFixedBlob_ids, i, ids ) {
const CBlob_Info& blob_info = *i;
CConstRef<CBlob_id> blob_id = blob_info.GetBlob_id();
NcbiCout << " " << blob_id->ToString() << NcbiEndl;
if ( !blob_id->IsMainBlob() ) {
continue;
}
CLoadLockBlob blob(request, *blob_id);
dispatcher->LoadBlob(request, *blob_id);
if ( !blob.IsLoadedBlob() ) {
NcbiCout << "blob is not available" << NcbiEndl;
continue;
}
NcbiCout << " loaded" << NcbiEndl;
}
}
}
return 0;
}
示例13: main
int main(int Argc, char ** Argv)
{
GetArgs(Argc,Argv);
ProcessData();
PrintResults();
}
示例14: OnRemoveArg
void dlgFunction::OnRemoveArg(wxCommandEvent &ev)
{
unsigned int sel = lstArguments->GetSelection();
argOids.RemoveAt(sel);
lstArguments->DeleteItem(sel);
btnRemove->Disable();
txtArguments->SetValue(GetArgs());
OnChangeArgName(ev);
}
示例15: printf
TStrV TEnv::GetIfArgPrefixStrV(
const TStr& PrefixStr, TStrV& DfValV, const TStr& DNm) const {
TStrV ArgValV;
if (Env.GetArgs()<=MnArgs) {
// 'usage' argument message
if (!SilentP) {
printf(" %s%s (default:", PrefixStr.CStr(), DNm.CStr());
for (int DfValN=0; DfValN<DfValV.Len(); DfValN++) {
if (DfValN>0) {
printf(", ");
}
printf("'%s'", DfValV[DfValN].CStr());
}
printf(")\n");
}
return ArgValV;
} else {
// argument & value message
TStr ArgValVChA;
for (int ArgN=0; ArgN<GetArgs(); ArgN++) {
// get argument string
TStr ArgStr=GetArg(ArgN);
if (ArgStr.StartsWith(PrefixStr)) {
// extract & add argument value
ArgStr.DelStr(PrefixStr);
ArgValV.Add(ArgStr);
// add to message string
if (ArgValV.Len()>1) {
ArgValVChA+=", ";
}
ArgValVChA+=ArgValV.Last();
}
}
if (ArgValV.Empty()) {
ArgValV=DfValV;
}
// output argument values
TChA MsgChA;
MsgChA+=" "+DNm;
MsgChA+=" (";
MsgChA+=PrefixStr;
MsgChA+=")=";
for (int ArgValN=0; ArgValN<ArgValV.Len(); ArgValN++) {
if (ArgValN>0) {
MsgChA+=", ";
}
MsgChA+="'";
MsgChA+=ArgValV[ArgValN];
MsgChA+="'";
}
if (!SilentP) {
TNotify::OnStatus(Notify, MsgChA);
}
return ArgValV;
}
}