cgatools::command::Command Class Reference

The base class for writing new commands. More...

#include <Command.hpp>

Inheritance diagram for cgatools::command::Command:
cgatools::command::CallDiff cgatools::command::Crr2Fasta cgatools::command::DecodeCrr cgatools::command::Evidence2Cache cgatools::command::Evidence2Sam cgatools::command::Fasta2Crr cgatools::command::Join cgatools::command::JunctionCmp cgatools::command::JunctionDiff cgatools::command::JunctionType cgatools::command::ListCrr cgatools::command::ListVariants cgatools::command::Map2Sam cgatools::command::MergedMap2Sam cgatools::command::SnpDiff cgatools::command::TestVariants cgatools::command::VarFileCombine

List of all members.

Public Member Functions

int operator() (int argc, char **argv)
 Runs the command and returns the error code; basically, your main() is supposed to directly delegate to this.
void help (std::ostream &out, bool html)
 Print help to out.
const std::string & getName () const
 Return the name of this command.
const std::string & getShortDescription () const
 Returns the short description of this command.
std::string getCommandLine () const

Static Public Member Functions

static std::string formatDescription (const std::string &description, size_t indent, size_t maxLineLength, bool html)
 Formats description in the same way as is done for options descriptions (newline separates paragraphs, tab declares indentation on following lines of paragraph).
static size_t getHelpLineLength ()

Protected Member Functions

 Command (const std::string &name, const std::string &shortDescription, const std::string &formatVersionSupported, const std::string &longDescription)
virtual ~Command ()
 Destructor can be customized, but it's preferred to complete all necessary cleanup in run() method.
std::istream & openStdin (const std::string &path)
 Returns stdin if path is "STDIN", otherwise returns the result of cgatools::util::InputStream::openCompressedInputStreamByExtension().
std::ostream & openStdout (const std::string &path)
 Returns stdout if path is "STDOUT", otherwise returns the result of cgatools::util::OutputStream::openCompressedOutputStreamByExtension().
void requireParam (const po::variables_map &vm, const std::string &param)
 Throws an exception if the given param was not specified on the command line.
virtual int run (po::variables_map &vm)=0
 The actual code of the command goes here.

Protected Attributes

po::options_description options_
po::options_description hiddenOptions_
po::positional_options_description positionalOptions_
std::string pipelineVersion_

Detailed Description

The base class for writing new commands.


Member Function Documentation

static std::string cgatools::command::Command::formatDescription ( const std::string &  description,
size_t  indent,
size_t  maxLineLength,
bool  html 
) [static]

Formats description in the same way as is done for options descriptions (newline separates paragraphs, tab declares indentation on following lines of paragraph).

Parameters:
indent The number of spaces to indent each line by. This is ignored when using boost 1.41 or before.
lineLength The maximum number of characters in a line.
html True to output html, false to output text. The html is assumed to be within a

...

tag.

std::istream& cgatools::command::Command::openStdin ( const std::string &  path  )  [protected]

Returns stdin if path is "STDIN", otherwise returns the result of cgatools::util::InputStream::openCompressedInputStreamByExtension().

std::ostream& cgatools::command::Command::openStdout ( const std::string &  path  )  [protected]

Returns stdout if path is "STDOUT", otherwise returns the result of cgatools::util::OutputStream::openCompressedOutputStreamByExtension().

void cgatools::command::Command::requireParam ( const po::variables_map &  vm,
const std::string &  param 
) [protected]

Throws an exception if the given param was not specified on the command line.

virtual int cgatools::command::Command::run ( po::variables_map &  vm  )  [protected, pure virtual]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated by  doxygen 1.6.2