本文整理汇总了C++中CommandLineArgument类的典型用法代码示例。如果您正苦于以下问题:C++ CommandLineArgument类的具体用法?C++ CommandLineArgument怎么用?C++ CommandLineArgument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CommandLineArgument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EvaluationBaseApplication
NeuroAndSimEvaluationBaseApplication::NeuroAndSimEvaluationBaseApplication()
: EvaluationBaseApplication()
{
Physics::install();
new ControllerFitnessFunctionParser(dynamic_cast<ControllerProvider*>(Physics::getPhysicsManager()));
CommandLineArgument *mPlayArgument =
new CommandLineArgument("playKeyFrames", "play", "<agent> <file>",
"Loads keyframe file <file> and starts to playback the keyframes on agent <agent>",
2, 0, true);
QStringList files = mPlayArgument->getEntries();
for(int i = 0; i < files.size(); ++i) {
QStringList args = files.at(i).split(" ");
if(args.size() == 2) {
QString keyFrameTarget(args.at(0));
QString keyFrameFileName(args.at(1));
KeyFramePlayer *player = new KeyFramePlayer(keyFrameTarget);
player->setKeyFrameFile(keyFrameFileName);
}
else {
cerr << "Warning: Size was " << args.size() << endl;
}
}
}
示例2: mPhysicalSimulationAlgorithm
/**
* Standard constructor.
*/
PhysicsManager::PhysicsManager() : mPhysicalSimulationAlgorithm(0), mCollisionManager(0),
mSynchronizeObjectsWithPhysicalModel(true), mNextStepEvent(0),
mCompletedNextStepEvent(0),
mResetEvent(0), mResetFinalizedEvent(0), mResetSettingsEvent(0),
mResetSettingsTerminatedEvent(0), mInitialResetDone(false), mCurrentSimulationTime(0),
mCurrentRealTime(0), mCurrentStep(0), mResetDuration(0), mStepExecutionDuration(0),
mPhysicalStepDuration(0), mSynchronizationDuration(0), mPostStepDuration(0),
mCollisionHandlingDuration(0), mDisablePhysics(0), mResetMutex(QMutex::Recursive)
{
EventManager *em = Core::getInstance()->getEventManager();
//make sure these events are created right at the beginning (required for morphology evolution)
em->getEvent(NerdConstants::EVENT_EXECUTION_RESET_SETTINGS, true);
em->getEvent(NerdConstants::EVENT_EXECUTION_RESET_SETTINGS_COMPLETED, true);
mPhysicsEnvironmentChangedEvent = em->createEvent(
SimulationConstants::EVENT_PHYSICS_ENVIRONMENT_CHANGED);
CommandLineArgument *switchXZArg = new CommandLineArgument("switchYZAxis", "switchYZAxis", "",
"The y-axis now means height, so that the position of a robot in the plane is (x,z).",
0, 0, true, false);
bool switchXZ = switchXZArg->getNumberOfEntries() > 0 ? false : true;
mSwitchYZAxes = new BoolValue(switchXZ);
mSwitchYZAxes->setDescription("Changes the XYZ space to a XZY space, so that X and Y are in the plain.");
Core::getInstance()->getValueManager()->addValue(SimulationConstants::VALUE_SWITCH_YZ_AXES, mSwitchYZAxes);
mDisablePhysics = new BoolValue(false);
mDisablePhysics->setDescription("If true, then the physical simulation is skipped and no update or resets of the physics takes place.");
Core::getInstance()->getValueManager()->addValue(SimulationConstants::VALUE_DISABLE_PHYSICS, mDisablePhysics);
}
示例3: CommandLineArgument
bool NeuroAndSimEvaluationStandardGuiApplication::setupGui() {
//Register command line argument descriptions to the PlugInManager to support
//switching the GUI on and off
CommandLineArgument *guiArgument =
new CommandLineArgument(
"enableGui", "gui", "",
"Starts the application with graphical user interface.",
0, 0,
true);
CommandLineArgument *noGuiArgument =
new CommandLineArgument(
"disableGui", "nogui", "",
"Starts the application without graphical user interface.",
0, 0,
true);
if(noGuiArgument->getParameterValue()->get() != "") {
mEnableGui = false;
}
if(guiArgument->getParameterValue()->get() != "") {
mEnableGui = true;
}
if(mEnableGui) {
mGuiMainWindow = new GuiMainWindow(mEnableControl, mEnableDebugging);
connect(this, SIGNAL(showGui()), mGuiMainWindow, SLOT(showWindow()));
}
return true;
}
示例4: CommandLineArgument
bool NerdClusterNeuroEvoApplication::setupGui() {
bool enableGui = true;
CommandLineArgument *guiArgument =
new CommandLineArgument(
"enableGui", "gui", "",
"Starts the application with graphical user interface.",
0, 0,
true);
CommandLineArgument *noGuiArgument =
new CommandLineArgument(
"disableGui", "nogui", "",
"Starts the application without graphical user interface.",
0, 0,
true);
if(noGuiArgument->getParameterValue()->get() != "") {
enableGui = false;
}
if(guiArgument->getParameterValue()->get() != "") {
enableGui = true;
}
if(enableGui) {
mMainGui = new SimpleEvolutionMainWindow(true);
OnlineFitnessPlotter *plotterButton = new OnlineFitnessPlotter();
mMainGui->getMenu("Evolution")->addAction(plotterButton->getAction());
new EvolutionPropertyPanelCollection(mMainGui->getMenu("Evolution"),
"Evolution Parameters", true);
connect(this, SIGNAL(showGui()), mMainGui, SLOT(show()));
}
return true;
}
示例5: checkForCommandLinePassedConfigurationFileOrDefaultConfigurationFile
const string SuperComponent::checkForCommandLinePassedConfigurationFileOrDefaultConfigurationFile(const int &argc, char **argv) {
string configurationFile = "configuration";
CommandLineParser cmdParser;
cmdParser.addCommandLineArgument("configuration");
cmdParser.parse(argc, argv);
CommandLineArgument cmdArgumentCONFIGURATION = cmdParser.getCommandLineArgument("configuration");
// Check the centrally maintained managed level.
if (cmdArgumentCONFIGURATION.isSet()) {
configurationFile = cmdArgumentCONFIGURATION.getValue<string>();
core::strings::StringToolbox::trim(configurationFile);
}
return configurationFile;
}
示例6: main
int main(int argc, char** argv) {
/* Step 0 */
if (!cmd_arguments.ParseCommandLineArgument(argc, argv))
return -1;
/* Step 1 */
std::cout << "Load pcd file ...\n";
pcl::io::loadPCDFile(cmd_arguments.raw_pcd_, *cloud);
std::cout << "Before resample, #points = " << cloud->points.size() << std::endl;
std::cout << "Resample ...\n";
pcl::PointCloud<pcl::PointXYZ>::Ptr sample(new pcl::PointCloud<pcl::PointXYZ>);
// create the filtering object
pcl::VoxelGrid<pcl::PointXYZ> grid;
grid.setInputCloud(cloud);
//grid.setLeafSize(size_x, size_y, size_z);
grid.setLeafSize(cmd_arguments.resample_resolution_[0],cmd_arguments.resample_resolution_[1],
cmd_arguments.resample_resolution_[2]);
grid.filter(*sample);
/* Step 2 */
std::cout << "After resample, #points = " << sample->points.size() << std::endl;
std::cout << "Saving ...\n";
pcl::io::savePCDFile(cmd_arguments.raw_pcd_, *sample);
return 0;
}
示例7: CommandLineArgument
bool NerdNeuroEvoApplication::setupGui() {
CommandLineArgument *guiArgument =
new CommandLineArgument(
"enableGui", "gui", "",
"Starts the application with graphical user interface.",
0, 0,
true);
CommandLineArgument *noGuiArgument =
new CommandLineArgument(
"disableGui", "nogui", "",
"Starts the application without graphical user interface.",
0, 0,
true);
if(noGuiArgument->getParameterValue()->get() != "") {
mEnableGui = false;
}
if(guiArgument->getParameterValue()->get() != "") {
mEnableGui = true;
}
if(mEnableGui) {
mGuiMainWindow = new GuiMainWindow(true, true);
connect(this, SIGNAL(showGui()), mGuiMainWindow, SLOT(showWindow()));
OnlineFitnessPlotter *plotterButton = new OnlineFitnessPlotter();
mGuiMainWindow->getMenu("Evolution")->addAction(plotterButton->getAction());
EvolutionProgressBar *progressBar = new EvolutionProgressBar();
mGuiMainWindow->addWidget(progressBar);
MultiplePopulationOverviewWindowWidget *overview = new MultiplePopulationOverviewWindowWidget();
overview->getAction()->setShortcut(tr("Ctrl+Shift+p"));
mGuiMainWindow->getMenu("Evolution")->addAction(overview->getAction());
EvolutionPropertyPanelCollection(mGuiMainWindow->getMenu("Evolution"),
"Evolution Parameters");
BoolValueSwitcherAction *runEvolutionButton = new BoolValueSwitcherAction("&Run Evolution",
EvolutionConstants::VALUE_EVO_RUN_EVOLUTION);
runEvolutionButton->setShortcut(tr("Ctrl+e"));
mGuiMainWindow->getMenu("Evolution")->addAction(runEvolutionButton);
NetworkEditorCollection(mGuiMainWindow->getMenu("Tools"), "Network Editor");
}
return true;
}
示例8: BaseApplication
NerdBaseApplication::NerdBaseApplication(int argc, char *argv[], bool enableGui)
: BaseApplication(), mSeedCommunication(0),
mEnableGui(enableGui), mServerPort(45454)
{
for(int i = 0; i < argc; ++i) {
QString flag(argv[i]);
flag = flag.trimmed();
if((flag.compare("-port") == 0
|| flag.compare("-p") == 0)
&& (i < (argc - 1)))
{
QString portValue(argv[i + 1]);
++i;
bool ok = false;
int port = portValue.toInt(&ok);
if(ok) {
mServerPort = port;
}
else {
qDebug("Could not parse the port!");
}
}
}
CommandLineArgument *guiArgument =
new CommandLineArgument(
"enableGui", "gui", "",
"Starts the application with graphical user interface.",
0, 0,
true);
CommandLineArgument *noGuiArgument =
new CommandLineArgument(
"disableGui", "nogui", "",
"Starts the application without graphical user interface.",
0, 0,
true);
if(noGuiArgument->getParameterValue()->get() != "") {
mEnableGui = false;
}
if(guiArgument->getParameterValue()->get() != "") {
mEnableGui = true;
}
}
示例9: CommandLineArgument
bool NerdMultiCoreEvaluationApplication::setupApplication()
{
bool ok = true;
CommandLineArgument *evalNameArg = new CommandLineArgument("name", "name", "<evalName>",
"The name of this evaluation process.", 1, 0, true, true);
if(evalNameArg->getEntries().size() > 0) {
QStringList params = evalNameArg->getEntryParameters(0);
mEvaluationName = params.at(0);
}
mRunner = new MultiCoreEvaluationRunner();
Core::log("EvaluationName: " + mEvaluationName, true);
return ok;
}
示例10: BaseApplication
OSP_BaseApplication::OSP_BaseApplication()
: BaseApplication(), mSeedCommunication(0),
mServerPort(45454)
{
CommandLineArgument *portArgument =
new CommandLineArgument("port", "p", "<port>",
"Sets the port of the OSP server. ", 1, 0, true);
QStringList params = portArgument->getParameters();
if(params.size() > 0) {
bool ok = false;
int port = params.at(0).toInt(&ok);
if(ok) {
mServerPort = port;
}
else {
Core::log("OSP_BaseApplication: Could not parse the port!");
}
}
}
示例11: BaseApplication
/**
* Constructs a new NeuralNetworkEditorApplication.
*/
NetworkDynamicsPlotterApplication::NetworkDynamicsPlotterApplication()
: BaseApplication(), mExecutionLoop(0), mEnableSimulator(false)
{
mName = "NeuralNetworkApplication";
//Add statis mode value to allow the plotters to prevent network modifications in the editor
//while the plots are calculated.
BoolValue *stasisModeValue = new BoolValue(true);
Core::getInstance()->getValueManager()->addValue(
EvolutionConstants::VALUE_EVO_STASIS_MODE, stasisModeValue);
//Check if the physical simulator is enabled.
CommandLineArgument *simArg = new CommandLineArgument("useSimulator", "sim", "",
"Enables the physical simulator.", 0, 0, true, true);
if(simArg->getNumberOfEntries() > 0) {
mEnableSimulator = true;
}
Physics::install();
}
示例12: CommandLineArgument
bool CollisionManager::bind() {
CommandLineArgument *printCollisionRulePrototypesArg = new CommandLineArgument(
"collisionRulePrototypes", "colp", "",
"Displays a list with all available collision rule prototypes",
0, 0, false, false);
CommandLineArgument *printCollisionRulesArg = new CommandLineArgument(
"collisionRules", "col", "",
"Displays a list with all available collision rules that have been registered up to the binding phase.",
0, 0, false, false);
if(printCollisionRulePrototypesArg->getNumberOfEntries() > 0) {
printCollisionRulePrototypes();
}
if(printCollisionRulesArg->getNumberOfEntries() > 0) {
printCollisionRules();
}
return true;
}
示例13: CommandLineArgument
/**
* Constructs a new UniversalNeuroScriptLoader.
*/
UniversalNeuroScriptLoader::UniversalNeuroScriptLoader()
{
CommandLineArgument *scriptLoaderArgument = new CommandLineArgument(
"installScript", "is", "<ScriptName> [<ScriptFileName> <TriggerEvent> <ResetEvent> <AgentInterface>]",
QString("Installs a new script with name <ScriptName>, that loads file <ScriptFileName> ")
+ "during the bind phase. The script is reset by <ResetEvent> and executed each "
+ "time <TriggerEvent> is triggered.\nThe <AgentInterface> "
+ "specifies the agents whose neural network can be changed.", 1, 4, true);
QList<QString> scriptNames;
int numberOfScriptsToInstall = scriptLoaderArgument->getNumberOfEntries();
for(int i = 0; i < numberOfScriptsToInstall; ++i) {
QList<QString> entryParams = scriptLoaderArgument->getEntryParameters(i);
QString name = entryParams.at(0);
QString fileName = "";
if(entryParams.size() > 1) {
fileName = entryParams.at(1);
}
QString triggerEvent = "";
if(entryParams.size() > 2) {
triggerEvent = entryParams.at(2);
}
QString resetEvent = "";
if(entryParams.size() > 3) {
resetEvent = entryParams.at(3);
}
QString agentName = "";
if(entryParams.size() > 4) {
agentName = entryParams.at(4);
}
if(name != "" && !scriptNames.contains(name)) {
new UniversalNeuroScriptingContext(name, fileName, triggerEvent, resetEvent, agentName);
scriptNames.append(name);
Core::log("UniversalScriptLoader: Installed UniversalScriptingContext ["
+ name + "]");
}
}
}
示例14: CommandLineArgument
/**
* Initializes the FitnessManager.
*/
bool FitnessManager::init() {
bool initOk = true;
//print names of FitnessFunctionPrototypes if required
CommandLineArgument *printFitnessFunctionsArgument = new CommandLineArgument("fitnessPrototypes",
"fitnessPrototypes", "",
"Prints the names of all available FitnessFunction prototypes.",
0, 0, false, false);
printFitnessFunctionsArgument->setProperty("debug");
if(printFitnessFunctionsArgument->getNumberOfEntries() > 0) {
cerr << "FitnessFunction Prototypes: " << endl
<< "-----------------------------" << endl;
QList<FitnessFunction*> prototypes = mFitnessFunctionPrototypes.values();
for(QListIterator<FitnessFunction*> i(prototypes); i.hasNext();) {
FitnessFunction *ff = i.next();
cerr << " > " << ff->getName().toStdString().c_str() << endl;
}
}
return initOk;
}
示例15: run_image_mode
int
run_image_mode(const Configuration &cfg,
const CommandLineArgument<std::string> &image_argument,
const CommandLineArgument<std::string> &landmarks_argument)
{
FaceTracker * tracker = LoadFaceTracker(cfg.model_pathname.c_str());
FaceTrackerParams *tracker_params = LoadFaceTrackerParams(cfg.params_pathname.c_str());
cv::Mat image;
cv::Mat_<uint8_t> gray_image = load_grayscale_image(image_argument->c_str(), &image);
int result = tracker->NewFrame(gray_image, tracker_params);
std::vector<cv::Point_<double> > shape;
std::vector<cv::Point3_<double> > shape3;
Pose pose;
if (result >= cfg.tracking_threshold) {
shape = tracker->getShape();
shape3 = tracker->get3DShape();
pose = tracker->getPose();
}
if (!have_argument_p(landmarks_argument)) {
display_data(cfg, image, shape, pose);
} else if (shape.size() > 0) {
if (cfg.save_3d_points)
save_points3(landmarks_argument->c_str(), shape3);
else
save_points(landmarks_argument->c_str(), shape);
}
delete tracker;
delete tracker_params;
return 0;
}