本文整理汇总了C++中ParameterList::getParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterList::getParameter方法的具体用法?C++ ParameterList::getParameter怎么用?C++ ParameterList::getParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterList
的用法示例。
在下文中一共展示了ParameterList::getParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: httpRequestRecieved
uHTTP::HTTP::StatusCode TestDevice::httpRequestRecieved(HTTPRequest *httpReq)
{
ParameterList paramList;
httpReq->getParameterList(paramList);
for (int n=0; n<paramList.size(); n++) {
Parameter *param = paramList.getParameter(n);
cout << "["<< n << "] : "<< param->getName() << "= "<< param->getValue() << endl;
}
string uri;
httpReq->getURI(uri);
if (uri.find(PRESENTATION_URI) == string::npos) {
return Device::httpRequestRecieved(httpReq);
}
string contents;
contents = "<HTML><BODY><H1>";
contents += "";
contents += "</H1></BODY></HTML>";
HTTPResponse httpRes;
httpRes.setStatusCode(HTTP::OK_REQUEST);
httpRes.setContent(contents);
return httpReq->post(&httpRes);
}
示例2: actionControlReceived
ClockDevice::ClockDevice() : Device(CLOCK_DESCRIPTION_FILE_NAME)
#else
ClockDevice::ClockDevice() : Device()
#endif
{
#if !defined(USE_CLOCK_DESCRIPTION_FILE)
loadDescription(CLOCK_DEVICE_DESCRIPTION);
Service *timeService = getService("urn:schemas-upnp-org:service:timer:1");
timeService->loadSCPD(CLOCK_SERVICE_DESCRIPTION);
#endif
Action *getTimeAction = getAction("GetTime");
getTimeAction->setActionListener(this);
Action *setTimeAction = getAction("SetTime");
setTimeAction->setActionListener(this);
ServiceList *serviceList = getServiceList();
Service *service = serviceList->getService(0);
service->setQueryListener(this);
m_timeVar = getStateVariable("Time");
setLeaseTime(60);
}
////////////////////////////////////////////////
// ActionListener
////////////////////////////////////////////////
bool ClockDevice::actionControlReceived(Action *action)
{
const char *actionName = action->getName();
if (strcmp("GetTime", actionName) == 0) {
std::string dateStr;
Clock clock;
clock.toString(dateStr);
Argument *timeArg = action->getArgument("CurrentTime");
timeArg->setValue(dateStr.c_str());
return true;
}
if (strcmp(actionName, "SetTime") == 0) {
Argument *timeArg = action->getArgument("NewTime");
const char *newTime = timeArg->getValue();
Argument *resultArg = action->getArgument("Result");
std::ostringstream valbuf;
valbuf << "Not implemented (" << newTime << ")";
resultArg->setValue(valbuf.str().c_str());
return true;
}
return false;
}
////////////////////////////////////////////////
// QueryListener
////////////////////////////////////////////////
bool ClockDevice::queryControlReceived(StateVariable *stateVar)
{
const char *varName = stateVar->getName();
Clock clock;
string clockVal;
stateVar->setValue(clock.toString(clockVal));
return true;
}
////////////////////////////////////////////////
// HttpRequestListner
////////////////////////////////////////////////
//void ClockDevice::httpRequestRecieved(HTTPRequest *httpReq)
HTTP::StatusCode ClockDevice::httpRequestRecieved(HTTPRequest *httpReq)
{
ParameterList paramList;
httpReq->getParameterList(paramList);
for (int n=0; n<paramList.size(); n++) {
Parameter *param = paramList.getParameter(n);
cout << "[" << n << "] : " << param->getName() << " = " << param->getValue() << endl;
}
string uri;
httpReq->getURI(uri);
if (uri.find(CLOCK_PRESENTATION_URI) == string::npos) {
Device::httpRequestRecieved(httpReq);
return HTTP::OK_REQUEST;
//return ;
}
string clockStr;
Clock clock;
clock.toString(clockStr);
string contents;
contents = "<HTML><BODY><H1>";
contents += clockStr;
contents += "</H1></BODY></HTML>";
HTTPResponse httpRes;
httpRes.setStatusCode(HTTP::OK_REQUEST);
httpRes.setContent(contents);
return httpReq->post(&httpRes) ? HTTP::OK_REQUEST : HTTP::INTERNAL_SERVER_ERROR;
//.........这里部分代码省略.........
示例3: main
int main(int args, char ** argv)
{
cout << "******************************************************************" << endl;
cout << "* Bio++ Distance Methods, version 2.2.0 *" << endl;
cout << "* Author: J. Dutheil Created 05/05/07 *" << endl;
cout << "* Last Modif. 04/02/15 *" << endl;
cout << "******************************************************************" << endl;
cout << endl;
if(args == 1)
{
help();
return 0;
}
try {
BppApplication bppdist(args, argv, "BppDist");
bppdist.startTimer();
Alphabet* alphabet = SequenceApplicationTools::getAlphabet(bppdist.getParams(), "", false);
auto_ptr<GeneticCode> gCode;
CodonAlphabet* codonAlphabet = dynamic_cast<CodonAlphabet*>(alphabet);
if (codonAlphabet) {
string codeDesc = ApplicationTools::getStringParameter("genetic_code", bppdist.getParams(), "Standard", "", true, true);
ApplicationTools::displayResult("Genetic Code", codeDesc);
gCode.reset(SequenceApplicationTools::getGeneticCode(codonAlphabet->getNucleicAlphabet(), codeDesc));
}
VectorSiteContainer* allSites = SequenceApplicationTools::getSiteContainer(alphabet, bppdist.getParams());
VectorSiteContainer* sites = SequenceApplicationTools::getSitesToAnalyse(* allSites, bppdist.getParams());
delete allSites;
ApplicationTools::displayResult("Number of sequences", TextTools::toString(sites->getNumberOfSequences()));
ApplicationTools::displayResult("Number of sites", TextTools::toString(sites->getNumberOfSites()));
SubstitutionModel* model = PhylogeneticsApplicationTools::getSubstitutionModel(alphabet, gCode.get(), sites, bppdist.getParams());
DiscreteDistribution* rDist = 0;
if (model->getNumberOfStates() > model->getAlphabet()->getSize())
{
//Markov-modulated Markov model!
rDist = new ConstantRateDistribution();
}
else
{
rDist = PhylogeneticsApplicationTools::getRateDistribution(bppdist.getParams());
}
DistanceEstimation distEstimation(model, rDist, sites, 1, false);
string method = ApplicationTools::getStringParameter("method", bppdist.getParams(), "nj");
ApplicationTools::displayResult("Tree reconstruction method", method);
TreeTemplate<Node>* tree;
AgglomerativeDistanceMethod* distMethod = 0;
if(method == "wpgma")
{
PGMA* wpgma = new PGMA(true);
distMethod = wpgma;
}
else if(method == "upgma")
{
PGMA* upgma = new PGMA(false);
distMethod = upgma;
}
else if(method == "nj")
{
NeighborJoining* nj = new NeighborJoining();
nj->outputPositiveLengths(true);
distMethod = nj;
}
else if(method == "bionj")
{
BioNJ* bionj = new BioNJ();
bionj->outputPositiveLengths(true);
distMethod = bionj;
}
else throw Exception("Unknown tree reconstruction method.");
string type = ApplicationTools::getStringParameter("optimization.method", bppdist.getParams(), "init");
ApplicationTools::displayResult("Model parameters estimation method", type);
if (type == "init") type = OptimizationTools::DISTANCEMETHOD_INIT;
else if (type == "pairwise") type = OptimizationTools::DISTANCEMETHOD_PAIRWISE;
else if (type == "iterations") type = OptimizationTools::DISTANCEMETHOD_ITERATIONS;
else throw Exception("Unknown parameter estimation procedure '" + type + "'.");
unsigned int optVerbose = ApplicationTools::getParameter<unsigned int>("optimization.verbose", bppdist.getParams(), 2);
string mhPath = ApplicationTools::getAFilePath("optimization.message_handler", bppdist.getParams(), false, false);
OutputStream* messenger =
(mhPath == "none") ? 0 :
(mhPath == "std") ? ApplicationTools::message :
new StlOutputStream(new ofstream(mhPath.c_str(), ios::out));
ApplicationTools::displayResult("Message handler", mhPath);
string prPath = ApplicationTools::getAFilePath("optimization.profiler", bppdist.getParams(), false, false);
OutputStream* profiler =
(prPath == "none") ? 0 :
//.........这里部分代码省略.........