pelican/utility/src/ConfigNode.cpp
/**
 * @details
 * Returns a vector containing the comma-separated list of unsigned integers
 * inside the given tag name.
 *
 * Channels can be specified in the XML configuration as
 *
 * @verbatim <channels>1,5,182</channels> @endverbatim
 *
 * or, for many contiguous channels,
 *
 * @verbatim <channels start="0" end="511"/> @endverbatim
 */
@details
Returns a vector containing the comma-separated list of unsigned integers
inside the given tag name.

Channels can be specified in the XML configuration as

@verbatim 1,5,182 @endverbatim

or, for many contiguous channels.

@verbatim  @endverbatim
@details Returns a vector containing the comma - separated list of unsigned integers inside the given tag name . Channels can be specified in the XML configuration as @verbatim 1 5 182 @endverbatim or for many contiguous channels . @verbatim @endverbatim
std::vector<unsigned> ConfigNode::getUnsignedList(const QString& tagName) const
{
    std::vector<unsigned> list;
    QString startString = getOption(tagName, "start");
    QString endString = getOption(tagName, "end");
    if (startString.isEmpty() || endString.isEmpty()) {
        QString channelStr = getOptionText(tagName, "0");
        QStringList chanList = channelStr.split(",", QString::SkipEmptyParts);
        unsigned size = chanList.size();
        list.resize(size);
        for (unsigned i = 0; i < size; ++i) {
            list[i] = chanList.at(i).toUInt();
        }
    }
    else {
        const int beg = startString.toInt();
        const int end = endString.toInt();
        const unsigned size = 1 + abs(end - beg);
        const int dir = (end - beg >= 0) ? 1 : -1;
        list.resize(size);
        for (unsigned i = 0; i < size; ++i) {
            list[i] = beg + (i * dir);
        }
    }
    if (list.size() == 0)
        throw QString("%1: No integer list specified.").arg(_config.tagName());
    return list;
}
std :: vector < unsigned > ConfigNode :: getUnsignedList ( const QString & tagName ) const { std :: vector < unsigned > list ; QString startString = getOption ( tagName , " " ) ; QString endString = getOption ( tagName , " " ) ; if ( startString . isEmpty ( ) || endString . isEmpty ( ) ) { QString channelStr = getOptionText ( tagName , " " ) ; QStringList chanList = channelStr . split ( " " , QString :: SkipEmptyParts ) ; unsigned size = chanList . size ( ) ; list . resize ( size ) ; for ( unsigned i = 0 ; i < size ; ++ i ) { list [ i ] = chanList . at ( i ) . toUInt ( ) ; } } else { const int beg = startString . toInt ( ) ; const int end = endString . toInt ( ) ; const unsigned size = 1 + abs ( end - beg ) ; const int dir = ( end - beg >= 0 ) ? 1 : -1 ; list . resize ( size ) ; for ( unsigned i = 0 ; i < size ; ++ i ) { list [ i ] = beg + ( i * dir ) ; } } if ( list . size ( ) == 0 ) throw QString ( " " ) . arg ( _config . tagName ( ) ) ; return list ; }
@details
 Returns a vector containing the comma-separated list of unsigned integers
 inside the given tag name.
@details Returns a vector containing the comma - separated list of unsigned integers inside the given tag name .
// Declare vector. // Check if "start" and "end" attributes are present. // If start or end are not present, check for text content. // Otherwise use start and end. // Fill the channel indices. // Check and throw if list is empty.