本文整理汇总了C++中st::string::isvalidfile方法的典型用法代码示例。如果您正苦于以下问题:C++ string::isvalidfile方法的具体用法?C++ string::isvalidfile怎么用?C++ string::isvalidfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st::string
的用法示例。
在下文中一共展示了string::isvalidfile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parse
void usePathWrite::parse(const ST::string & usetext)
{
path = "";
errormessages.clear();
notext = true;
if (usetext.length() > 0)
{
notext = false;
int k = usetext.isvalidfile();
if (k == 1)
{
errormessages.push_back("ERROR: file " + usetext +
" could not be opened for writing\n");
alreadyexisting = false;
}
else if (k == 0)
alreadyexisting = false;
else
alreadyexisting = true;
if (errormessages.empty())
path = usetext;
}
}
示例2: outresults
void FC_nonp_variance_varselection::outresults(ofstream & out_stata,ofstream & out_R,
const ST::string & pathresults)
{
if (pathresults.isvalidfile() != 1)
{
ST::string pathresults_delta = pathresults.substr(0,pathresults.length()-4) + "_delta.res";
ST::string pathresults_omega = pathresults.substr(0,pathresults.length()-4) + "_omega.res";
FC_nonp_variance::outresults(out_stata,out_R,pathresults);
FC_delta.outresults(out_stata,out_R,"");
FC_omega.outresults(out_stata,out_R,pathresults_omega);
optionsp->out(" Inclusion probability: " + ST::doubletostring(FC_delta.betamean(0,0),6) + "\n");
optionsp->out("\n");
optionsp->out(" Results for the inclusion probabilities are also stored in file\n");
optionsp->out(" " + pathresults_delta + "\n");
optionsp->out("\n");
optionsp->out("\n");
optionsp->out(" Inclusion probability parameter omega:\n");
optionsp->out("\n");
FC_omega.outresults_singleparam(out_stata,out_R,"");
optionsp->out(" Results for the inclusion probability parameter omega are also stored in file\n");
optionsp->out(" " + pathresults_omega + "\n");
optionsp->out("\n");
optionsp->out("\n");
// deltas
ofstream ou(pathresults_delta.strtochar());
ou << "pmean" << endl;
ou << FC_delta.betamean(0,0) << endl;
}
// FC_nonp_variance::outresults(out_stata,out_R,pathresults);
}
示例3: outresults
void FC_predict_mult::outresults(ofstream & out_stata, ofstream & out_R,
const ST::string & pathresults)
{
if (pathresults.isvalidfile() != 1)
{
FC::outresults(out_stata,out_R,"");
FC_deviance.outresults(out_stata,out_R,"");
optionsp->out(" PREDICTED VALUES: \n",true);
optionsp->out("\n");
optionsp->out(" Results for the predictor, mean are stored in file\n");
optionsp->out(" " + pathresults + "\n");
optionsp->out("\n");
out_R << "predict=" << pathresults << ";" << endl;
ofstream outres(pathresults.strtochar());
optionsp->out("\n");
unsigned i,j;
ST::string l1 = ST::doubletostring(optionsp->lower1,4);
ST::string l2 = ST::doubletostring(optionsp->lower2,4);
ST::string u1 = ST::doubletostring(optionsp->upper1,4);
ST::string u2 = ST::doubletostring(optionsp->upper2,4);
l1 = l1.replaceallsigns('.','p');
l2 = l2.replaceallsigns('.','p');
u1 = u1.replaceallsigns('.','p');
u2 = u2.replaceallsigns('.','p');
outres << "intnr" << " ";
for (i=0;i<varnames.size();i++)
outres << varnames[i] << " ";
vector<double *> responsep;
vector<double *> weightpmat;
vector<double *> workmeanmat;
vector<datamatrix *> auxhelp;
for (j=0;j<likep.size();j++)
{
workmeanmat.push_back((betamean.getV()+j));
responsep.push_back(likep[j]->response.getV());
weightpmat.push_back(likep[j]->weight.getV());
auxhelp.push_back(likep[j]->get_auxiliary_parameter());
}
if (nosamplessave==false)
{
for (i=0;i<likep.size();i++)
{
if (likep[i]->outpredictor)
{
outres << "pmean_pred_" << likep[i]->predictor_name << " ";
if (optionsp->samplesize > 1)
{
outres << "pqu" << l1 << "_pred_" << likep[i]->predictor_name << " ";
outres << "pqu" << l2 << "_pred_" << likep[i]->predictor_name << " ";
outres << "pmed_pred_" << likep[i]->predictor_name << " ";
outres << "pqu" << u1 << "_pred_" << likep[i]->predictor_name << " ";
outres << "pqu" << u2 << "_pred_" << likep[i]->predictor_name << " ";
}
}
}
for (i=0;i<likep.size();i++)
{
if (likep[i]->outexpectation)
{
outres << "pmean_E_" << likep[i]->predictor_name << " ";
if (optionsp->samplesize > 1)
{
outres << "pqu" << l1 << "_E_" << likep[i]->predictor_name << " ";
outres << "pqu" << l2 << "_E_" << likep[i]->predictor_name << " ";
outres << "pmed_E_" << likep[i]->predictor_name << " ";
outres << "pqu" << u1 << "_E_" << likep[i]->predictor_name << " ";
outres << "pqu" << u2 << "_E_" << likep[i]->predictor_name << " ";
}
}
}
for (i=0;i<likep.size();i++)
{
if (likep[i]->outpredictor)
{
outres << "pmean_" << likep[i]->predictor_name << " ";
//.........这里部分代码省略.........
示例4: outresults
void FC_cv::outresults(ofstream & out_stata, ofstream & out_R,
const ST::string & pathresults)
{
if (pathresults.isvalidfile() != 1)
{
FC::outresults(out_stata,out_R,pathresults);
optionsp->out(" Marshall-Spiegelhalter Cross Validation: \n",true);
optionsp->out("\n");
optionsp->out(" Estimated individual observation samples are stored in\n");
optionsp->out(" " + pathresults + "\n");
optionsp->out("\n");
ST::string pathresults_like = pathresults.substr(0,pathresults.length()-4)+
"_like.res";
FC_sampled_l.outresults(out_stata,out_R,pathresults_like);
optionsp->out(" Estimated individual observation likelihoods are stored in\n");
optionsp->out(" " + pathresults_like + "\n");
optionsp->out("\n");
// unsigned nrobs = sampled_etas.rows();
unsigned i;
/*
ofstream outres(pathresults.strtochar());
for(j=0;j<sampled_etas.cols();j++)
outres << "s_eta_" << (j+1) << " ";
for(j=0;j<sampled_etas.cols();j++)
outres << "s_resp_" << (j+1) << " ";
outres << endl;
for (i=0;i<nrobs;i++)
{
for(j=0;j<sampled_etas.cols();j++)
outres << sampled_etas(i,j) << " ";
for(j=0;j<sampled_responses.cols();j++)
outres << sampled_responses(i,j) << " ";
outres << endl;
}
*/
// Energy score
double es = compute_energyscore();
ST::string pathresults_e = pathresults.substr(0,pathresults.length()-4)+
"_energy.res";
ofstream out2(pathresults_e.strtochar());
out2 << "id score" << endl;
for (i=0;i<e_score.rows();i++)
out2 << effectvalues[i] << " " << e_score(i,0) << endl;
// Log-score
double ls = compute_logscore();
ST::string pathresults_l = pathresults.substr(0,pathresults.length()-4)+
"_logscore.res";
ofstream out3(pathresults_l.strtochar());
out3 << "id score" << endl;
for (i=0;i<e_score.rows();i++)
out3 << effectvalues[i] << " " << log_score(i,0) << endl;
optionsp->out(" Estimated energy scores are stored in\n");
optionsp->out(" " + pathresults_e + "\n");
optionsp->out("\n");
optionsp->out(" Estimated log-scores are stored in\n");
optionsp->out(" " + pathresults_l + "\n");
optionsp->out("\n");
optionsp->out(" Mean energy score: " + ST::doubletostring(es,8) + "\n");
optionsp->out(" Mean log score: " + ST::doubletostring(ls,8) + "\n");
} // end if (pathresults.isvalidfile() != 1)
//.........这里部分代码省略.........