nidas  v1.2-1520
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
nidas::core::BadSampleFilterArg Class Reference

BadSampleFilterArg is a NidasAppArg for configuring a BadSampleFilter with filter rules pased to the –filter option. More...

#include <BadSampleFilter.h>

Inheritance diagram for nidas::core::BadSampleFilterArg:
Inheritance graph
[legend]

Public Member Functions

 BadSampleFilterArg ()
 
BadSampleFiltergetFilter ()
 
virtual bool parse (const ArgVector &argv, int *argi=0)
 If argv[argi] matches this argument, then set the flag that was found and also the value if this argument takes a value, and return true. More...
 
void setRequired (bool isRequired=true)
 Set whether this argument is required. More...
 
bool isRequired ()
 Return whether this argument is required. More...
 
void acceptShortFlag (bool enable)
 Set whether short flags are enabled or not. More...
 
void addFlag (const std::string &flag)
 Add a flag which this argument should accept. More...
 
void setFlags (const std::string &flags)
 Completely replace the flags which this argument should accept. More...
 
 operator nidas_app_arglist_t ()
 Provide conversion to an arglist so a single NidasAppArg can be passed where an arglist is expected. More...
 
std::string usage (const std::string &indent=" ")
 Render the usage string for this particular argument, taking into account which flags are enabled. More...
 
bool specified ()
 Return true if this argument has been filled in from a command-line argument list, such as after a call to NidasApp::parseArgs(). More...
 
const std::string & getValue ()
 If this argument has been parsed from a command line list (specified() returns true), then return the value passed after the flag. More...
 
const std::string & getFlag ()
 Return the command-line flag which this argument consumed. More...
 
bool asBool ()
 An argument is true if it is a stand-alone flag and was specified in the arguments, or else if the flag value evaluates to true. More...
 
int asInt ()
 Parse the argument value as an integer, where the value could be the default if no value has been explicitly parsed with parse(). More...
 
float asFloat ()
 Same as asInt(), except parse the argument value as a float. More...
 
bool accept (const std::string &flag)
 Return true if the given command-line flag matches one of this argument's flags. More...
 
void setUsageString (const std::string &text)
 
std::string getUsageFlags ()
 Return the string of flags accepted by this NidasAppArg according to the acceptShortFlag() setting. More...
 
void setDefault (const std::string &dvalue)
 
std::string getDefault ()
 

Protected Member Functions

bool single ()
 Return true for arguments which are only a single argument. More...
 

Protected Attributes

std::string _flags
 
std::string _syntax
 
std::string _usage
 
std::string _default
 
std::string _arg
 
std::string _value
 
bool _enableShortFlag
 
bool _required
 

Private Attributes

BadSampleFilter _bsf
 

Detailed Description

BadSampleFilterArg is a NidasAppArg for configuring a BadSampleFilter with filter rules pased to the –filter option.

Constructor & Destructor Documentation

BadSampleFilterArg::BadSampleFilterArg ( )

Member Function Documentation

bool NidasAppArg::accept ( const std::string &  flag)
inherited
void nidas::core::NidasAppArg::acceptShortFlag ( bool  enable)
inlineinherited

Set whether short flags are enabled or not.

Pass enable as false to disable short flags and require only long flags instead. By default short flags are enabled.

References nidas::core::NidasAppArg::_enableShortFlag.

Referenced by NidsMerge::parseRunstring(), and PacketReader::parseRunstring().

void NidasAppArg::addFlag ( const std::string &  flag)
inherited

Add a flag which this argument should accept.

Use this to allow an application to accept deprecated flags like -B and -E.

References nidas::core::NidasAppArg::_flags.

bool NidasAppArg::asBool ( )
inherited
float NidasAppArg::asFloat ( )
inherited
int NidasAppArg::asInt ( )
inherited

Parse the argument value as an integer, where the value could be the default if no value has been explicitly parsed with parse().

Throw NidasAppException if the whole value cannot be parsed as an integer. See also asFloat().

References nidas::core::NidasAppArg::_flags, and nidas::core::NidasAppArg::getValue().

Referenced by NidsMerge::parseRunstring(), StatsProcess::parseRunstring(), TeeI2C::parseRunstring(), DataPrep::parseRunstring(), DataStats::parseRunstring(), and DataPrep::run().

std::string nidas::core::NidasAppArg::getDefault ( )
inlineinherited
BadSampleFilter& nidas::core::BadSampleFilterArg::getFilter ( )
inline
const std::string & NidasAppArg::getFlag ( )
inherited

Return the command-line flag which this argument consumed.

For example, if an argument with multiple flags is matched, then getFlag() returns the flag that matched the argument.

References nidas::core::NidasAppArg::_arg.

Referenced by DataPrep::parseRunstring().

std::string NidasAppArg::getUsageFlags ( )
inherited
const std::string & NidasAppArg::getValue ( )
inherited
bool NidasAppArg::isRequired ( )
inherited

Return whether this argument is required.

See setRequired().

References nidas::core::NidasAppArg::_required.

Referenced by nidas::core::NidasAppArg::setRequired().

nidas::core::NidasAppArg::operator nidas_app_arglist_t ( )
inlineinherited

Provide conversion to an arglist so a single NidasAppArg can be passed where an arglist is expected.

bool BadSampleFilterArg::parse ( const ArgVector argv,
int *  argi = 0 
)
virtual

If argv[argi] matches this argument, then set the flag that was found and also the value if this argument takes a value, and return true.

Otherwise return false. The vector is not modified, but if argi is nonzero, then it is used as the starting index into argv, and it is advanced according to the number of elements of argv consumed by this argument. This method is virtual so subclasses can implement customized parsing, such as optionally consuming more than one argument following a flag.

Reimplemented from nidas::core::NidasAppArg.

References nidas::core::NidasAppArg::_arg, _bsf, nidas::core::NidasAppArg::_value, nidas::core::NidasAppArg::accept(), nidas::core::expectArg(), nidas::core::BadSampleFilter::setFilterBadSamples(), and nidas::core::BadSampleFilter::setRules().

void nidas::core::NidasAppArg::setDefault ( const std::string &  dvalue)
inlineinherited
void NidasAppArg::setFlags ( const std::string &  flags)
inherited

Completely replace the flags which this argument should accept.

This should be avoided if possible, otherwise the flags will not be consistent across applications. However, in some cases this is necessary to remove a conflicting short flag.

References nidas::core::NidasAppArg::_flags.

Referenced by StatsProcess::parseRunstring(), and DataPrep::parseRunstring().

void NidasAppArg::setRequired ( bool  isRequired = true)
inherited

Set whether this argument is required.

A required argument must be supplied on the command line even if it has a default value. If an argument is not required because it has a default value, then an application should not set that argument to be required.

Defaults to true, but the client may disable this option by setting the argument to false.

References nidas::core::NidasAppArg::_required, and nidas::core::NidasAppArg::isRequired().

void nidas::core::NidasAppArg::setUsageString ( const std::string &  text)
inlineinherited
bool NidasAppArg::single ( )
protectedinherited

Return true for arguments which are only a single argument.

They are a single command-line flag with no following value, and typically implying a boolean value. This is equivalent to not specifying a syntax when the argument is created.

References nidas::core::NidasAppArg::_syntax.

Referenced by nidas::core::NidasAppArg::accept(), nidas::core::NidasAppArg::getUsageFlags(), and nidas::core::NidasAppArg::parse().

bool NidasAppArg::specified ( )
inherited

Return true if this argument has been filled in from a command-line argument list, such as after a call to NidasApp::parseArgs().

If true, then this argument stores the flag that was recognized, and also the value of any additional parameters to this argument.

References nidas::core::NidasAppArg::_arg.

Referenced by DataStats::addCounter(), nidas::core::NidasAppArg::getValue(), NidsMerge::parseRunstring(), TeeI2C::parseRunstring(), DataStats::report(), and nidas::core::NidasApp::setupDaemonLogging().

std::string NidasAppArg::usage ( const std::string &  indent = "  ")
inherited

Render the usage string for this particular argument, taking into account which flags are enabled.

The returned string is formatted like below, and always ends in a newline:

<indent><flag>[,<flag>...] [<syntax>] [default: <default>] <indent><indent>Description line one <indent><indent>Description line two ...

References nidas::core::NidasAppArg::_default, nidas::core::NidasAppArg::_syntax, nidas::core::NidasAppArg::_usage, and nidas::core::NidasAppArg::getUsageFlags().

Referenced by nidas::core::NidasApp::usage().

Member Data Documentation

std::string nidas::core::NidasAppArg::_arg
protectedinherited
BadSampleFilter nidas::core::BadSampleFilterArg::_bsf
private

Referenced by getFilter(), and parse().

std::string nidas::core::NidasAppArg::_default
protectedinherited
bool nidas::core::NidasAppArg::_enableShortFlag
protectedinherited
std::string nidas::core::NidasAppArg::_flags
protectedinherited
bool nidas::core::NidasAppArg::_required
protectedinherited
std::string nidas::core::NidasAppArg::_syntax
protectedinherited
std::string nidas::core::NidasAppArg::_usage
protectedinherited
std::string nidas::core::NidasAppArg::_value
protectedinherited

The documentation for this class was generated from the following files: