Public Member Functions

val_SlotList Class Reference
[Parser for config files; validation]

#include <val.h>

Inheritance diagram for val_SlotList:
Inheritance graph
[legend]
Collaboration diagram for val_SlotList:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 val_SlotList (const string &a_name, const val_Limit a_limits, const UInt32_t a_minNumOfVal=1, const UInt64_t a_maxNumOfVal=cfg_INFINITE)
virtual void Add (const string &a_strVal)
virtual void AddRange (const string &a_strLow, const string &a_strHigh)

Detailed Description

Definition at line 1075 of file val.h.


Constructor & Destructor Documentation

val_SlotList::val_SlotList ( const string &  a_name,
const val_Limit  a_limits,
const UInt32_t  a_minNumOfVal = 1,
const UInt64_t  a_maxNumOfVal = cfg_INFINITE 
)

Definition at line 1174 of file val.cpp.

    : val_StrictStringList(a_name, a_limits, a_minNumOfVal, a_maxNumOfVal) {
    // Empty
}


Member Function Documentation

void val_SlotList::Add ( const string &  a_strVal  )  [virtual]

Reimplemented from val_List< CNV, DT >.

Definition at line 1184 of file val.cpp.

References val_Integer::Bind(), cfg_MAX_SLOT_NUM, cmn_Num2Str(), val_Value::Conv(), ivd_BaseException::GetContext(), ivd_BaseException::GetError(), ie_INVALID_ARG, ivd_Error, val_Value::m_name, val_List< CNV, DT >::m_vec_p, and NULL.

                                             {
    if (m_vec_p == NULL) {
        throw ivd_Error(ie_INVALID_ARG, "Target vector not specified.");
    }

    // Verify integer value of the string
    UInt64_t slot;
    val_Integer vSlot("", val_Limit(1, cfg_MAX_SLOT_NUM));
    vSlot.Bind(slot);

    try {
        vSlot.Conv(a_strVal);
    }
    catch (ivd_Error& e){
        ostringstream eNew;
        eNew << "Error occured in list:" << m_name <<
                " " <<  e.GetContext();
        throw ivd_Error(e.GetError(), eNew.str() );
    }

    // Add textual value to the vector.
    val_Element<string> valElem(cmn_Num2Str(slot));
    m_vec_p->push_back(valElem);
}

Here is the call graph for this function:

void val_SlotList::AddRange ( const string &  a_strLow,
const string &  a_strHigh 
) [virtual]

Reimplemented from val_List< CNV, DT >.

Definition at line 1210 of file val.cpp.

References val_Integer::Bind(), val_Range< CNV, DT >::Bind(), cfg_MAX_SLOT_NUM, cmn_Num2Str(), val_Value::Conv(), ivd_BaseException::GetContext(), ivd_BaseException::GetError(), ie_INVALID_ARG, ivd_Error, val_Value::m_limits, val_Value::m_name, val_List< CNV, DT >::m_vec_p, and NULL.

                                                                             {
    if (m_vec_p == NULL) {
        throw ivd_Error(ie_INVALID_ARG, "Target vector not specified.");
    };

    // Verify limits of string values
    val_Element<string>     rangeElem;
    val_Range<val_StrictString, string>  converter("", m_limits);

    converter.Bind(rangeElem);

    try {
        converter.Conv(a_strLow, a_strHigh);
    }
    catch (ivd_Error& e){
        ostringstream eNew;
        eNew << "Error occured in list:" << m_name <<
                " " <<  e.GetContext();
        throw ivd_Error(e.GetError(), eNew.str() );
    }

    // Verify integer representations of low/high value
    UInt64_t lowInt;
    val_Integer vLowInt("", val_Limit(1, cfg_MAX_SLOT_NUM));
    vLowInt.Bind(lowInt);

    try {
        vLowInt.Conv(a_strLow);
    }
    catch (ivd_Error& e){
        ostringstream eNew;
        eNew << "Error occured in list:" << m_name <<
                " " <<  e.GetContext();
        throw ivd_Error(e.GetError(), eNew.str() );
    }

    UInt64_t highInt;
    val_Integer vHighInt("", val_Limit(1, cfg_MAX_SLOT_NUM));
    vHighInt.Bind(highInt);

    try {
        vHighInt.Conv(a_strHigh);
    }
    catch (ivd_Error& e){
        ostringstream eNew;
        eNew << "Error occured in list:" << m_name <<
                " " <<  e.GetContext();
        throw ivd_Error(e.GetError(), eNew.str() );
    }

    // Add textual representations of values to vector.
    for (UInt64_t i = lowInt; i <= highInt; i++){
        val_Element<string>   expElem(cmn_Num2Str(i));
        m_vec_p->push_back(expElem);
    };
}

Here is the call graph for this function:


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