MOAB: Mesh Oriented datABase  (version 5.2.1)
CLArgs::DoubleRange Class Reference

#include <CLArgs.hpp>

Public Member Functions

 DoubleRange (const double *min, const double *max, bool inclusive)
bool is_valid (double value) const
std::string desc_append () const

Private Attributes

bool haveMin
bool haveMax
bool mInclusive
double mMin
double mMax

Detailed Description

Definition at line 289 of file CLArgs.hpp.


Constructor & Destructor Documentation

CLArgs::DoubleRange::DoubleRange ( const double *  min,
const double *  max,
bool  inclusive 
)

Definition at line 493 of file CLArgs.cpp.

References haveMax, haveMin, mMax, and mMin.

    : haveMin( min != NULL ), haveMax( max != NULL ), mInclusive( inclusive )
{
    if( haveMin ) mMin = *min;
    if( haveMax ) mMax = *max;
}

Member Function Documentation

std::string CLArgs::DoubleRange::desc_append ( ) const

Definition at line 508 of file CLArgs.cpp.

Referenced by CLArgs::DoubleRangeArg::desc_append(), and CLArgs::DoubleListRangeArg::desc_append().

{
    std::ostringstream ss;
    if( mInclusive && haveMin )
        ss << '[';
    else
        ss << '(';
    if( haveMin )
        ss << mMin;
    else
        ss << "-inf";
    ss << ",";
    if( haveMax )
        ss << mMax;
    else
        ss << "inf";
    if( mInclusive && haveMax )
        ss << ']';
    else
        ss << ')';
    return ss.str();
}
bool CLArgs::DoubleRange::is_valid ( double  value) const

Definition at line 500 of file CLArgs.cpp.

{
    if( mInclusive )
        return ( !haveMin || val >= mMin ) && ( !haveMax || val <= mMax );
    else
        return ( !haveMin || val > mMin ) && ( !haveMax || val < mMax );
}

Member Data Documentation

Definition at line 292 of file CLArgs.hpp.

Referenced by DoubleRange().

Definition at line 292 of file CLArgs.hpp.

Referenced by DoubleRange().

Definition at line 292 of file CLArgs.hpp.

double CLArgs::DoubleRange::mMax [private]

Definition at line 293 of file CLArgs.hpp.

Referenced by DoubleRange().

double CLArgs::DoubleRange::mMin [private]

Definition at line 293 of file CLArgs.hpp.

Referenced by DoubleRange().

List of all members.


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