Skip to content

Applications/shapeworks/Command.h

Namespaces

Name
shapeworks
User usage reporting (telemetry)

Classes

Name
class shapeworks::Command
class shapeworks::ImageCommand
class shapeworks::MeshCommand
class shapeworks::OptimizeCommandGroup
class shapeworks::GroomCommandGroup
class shapeworks::AnalyzeCommandGroup
class shapeworks::ProjectCommandGroup
class shapeworks::ParticleSystemCommand
class shapeworks::DeepSSMCommandGroup
class shapeworks::ShapeworksCommand

Functions

Name
std::ostream & operator<<(std::ostream & os, const shapeworks::Command & cmd)

Defines

Name
COMMAND_DECLARE(CommandName, CommandType)

Functions Documentation

function operator<<

cpp std::ostream & operator<<( std::ostream & os, const shapeworks::Command & cmd )

Macros Documentation

define COMMAND_DECLARE

```cpp

define COMMAND_DECLARE(

CommandName,
CommandType

) class CommandName : public CommandType \ { \ public: \ static CommandName &getCommand() { static CommandName instance; return instance; } \ \ private: \ CommandName() { buildParser(); } \ void buildParser() override; \ bool execute(const optparse::Values &options, SharedCommandData &sharedData) override; \ } ```

Source code

```cpp

pragma once

/ * Command provided by unified shapeworks executable. /

include "OptionParser.h"

include "SharedCommandData.h"

include

include

#define COMMAND_DECLARE(CommandName, CommandType) \ class CommandName : public CommandType \ { \ public: \ static CommandName &getCommand() { static CommandName instance; return instance; } \ \ private: \ CommandName() { buildParser(); } \ void buildParser() override; \ bool execute(const optparse::Values &options, SharedCommandData &sharedData) override; \ }

namespace shapeworks {

class Command { public: virtual const std::string type() { return "General"; }

const std::string name() const { return parser.prog(); } const std::string usage() const { return parser.get_usage(); } const std::string desc() const { return parser.description(); }

virtual std::vector parse_args(const std::vector &arguments);

int run(SharedCommandData &sharedData);

private: virtual bool execute(const optparse::Values &options, SharedCommandData &sharedData) = 0;

protected: virtual void buildParser(); // derived classes should specialize and call this as well

optparse::OptionParser parser; };

class ImageCommand : public Command { public: const std::string type() override { return "Image"; }

private: };

class MeshCommand : public Command { public: const std::string type() override { return "Mesh"; }

private: };

class OptimizeCommandGroup : public Command { public: const std::string type() override { return "Optimize"; }

private: };

class GroomCommandGroup : public Command { public: const std::string type() override { return "Groom"; }

private: };

class AnalyzeCommandGroup : public Command { public: const std::string type() override { return "Analyze"; }

private: };

class ProjectCommandGroup : public Command { public: const std::string type() override { return "Project"; }

private: };

class ParticleSystemCommand : public Command { public: const std::string type() override { return "ParticleSystem"; }

private: };

class DeepSSMCommandGroup : public Command { public: const std::string type() override { return "DeepSSM"; }

// DeepSSM is a terminal command - don't pass remaining args to other commands std::vector parse_args(const std::vector &arguments) override { Command::parse_args(arguments); return {}; // return empty - DeepSSM consumes all args }

private: };

class ShapeworksCommand : public Command { public: const std::string type() override { return "Shapeworks"; }

private: };

}; // shapeworks

std::ostream& operator<<(std::ostream& os, const shapeworks::Command &cmd); ```


Updated on 2026-03-31 at 16:02:10 +0000