Public Types | Public Member Functions | Protected Attributes

val_List< CNV, DT > Class Template Reference
[Parser for config files; validation]

This template is used to make rules for conversion to vectors of values from some list-type input (eg cfg_Val_t of type CFGVAL_LIST). More...

#include <val.h>

Inheritance diagram for val_List< CNV, DT >:
Inheritance graph
[legend]
Collaboration diagram for val_List< CNV, DT >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef vector< val_Element< DT > > listVecType

Public Member Functions

 val_List (const string &a_name, const val_Limit a_limits, const UInt32_t a_minNumOfVal=1, const UInt64_t a_maxNumOfVal=cfg_INFINITE)
virtual ~val_List ()
virtual void Bind (listVecType &a_dest)
virtual void Add (const string &a_strVal)
virtual void AddRange (const string &a_strLow, const string &a_strHigh)
virtual void Assign (const string &a_strVal)

Protected Attributes

listVecTypem_vec_p
 log_CLASSID_m

Detailed Description

template<class CNV, class DT>
class val_List< CNV, DT >

This template is used to make rules for conversion to vectors of values from some list-type input (eg cfg_Val_t of type CFGVAL_LIST).

Some typedefs are already defined for some more common conversions.

Please note that all combinations are not possible. You can get compilation error or an exception at run-time. Make sure that you try to bind converter and target value that fit.

typedef val_List<val_String, string>    val_StringList;
Parameters:
CNV Conversion class type
DT Destination type
See also:
val_Value

Definition at line 969 of file val.h.


Member Typedef Documentation

template<class CNV, class DT>
typedef vector< val_Element<DT> > val_List< CNV, DT >::listVecType

Definition at line 987 of file val.h.


Constructor & Destructor Documentation

template<class CNV, class DT>
val_List< CNV, DT >::val_List ( const string &  a_name,
const val_Limit  a_limits,
const UInt32_t  a_minNumOfVal = 1,
const UInt64_t  a_maxNumOfVal = cfg_INFINITE 
) [inline]

Definition at line 972 of file val.h.

        : val_Value(a_name, a_limits, a_minNumOfVal, a_maxNumOfVal),
          m_vec_p(NULL) {
            // Empty
        }

template<class CNV, class DT>
virtual val_List< CNV, DT >::~val_List (  )  [inline, virtual]

Definition at line 983 of file val.h.

                            {
            //Empty
        }


Member Function Documentation

template<class CNV, class DT>
virtual void val_List< CNV, DT >::Add ( const string &  a_strVal  )  [inline, virtual]

Reimplemented from val_Value.

Reimplemented in val_SlotList.

Definition at line 994 of file val.h.

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

            DT      basicTmp;
            CNV     converter("", m_limits);

            converter.Bind(basicTmp);

            try {
                converter.Conv(a_strVal);
            }
            catch (ivd_Error& e){
                ostringstream eNew;
                eNew << "Error occured in list:" << m_name <<
                        " at index:" << static_cast<unsigned int>(m_vec_p->size()) <<
                        " " <<  e.GetContext();
                throw ivd_Error(e.GetError(), eNew.str() );
            }

            val_Element<DT>     valElem(basicTmp);
            m_vec_p->push_back(valElem);
        }

template<class CNV, class DT>
virtual void val_List< CNV, DT >::AddRange ( const string &  a_strLow,
const string &  a_strHigh 
) [inline, virtual]

Reimplemented from val_Value.

Reimplemented in val_SlotList, and val_FileNamePatternList.

Definition at line 1020 of file val.h.

                                                              {

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

            val_Element<DT>     rangeElem;
            val_Range<CNV, DT>  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 <<
                        " at index:" << static_cast<unsigned int>(m_vec_p->size()) <<
                        " " <<  e.GetContext();
                throw ivd_Error(e.GetError(), eNew.str() );
            }

            m_vec_p->push_back(rangeElem);
        }

template<class CNV, class DT>
virtual void val_List< CNV, DT >::Assign ( const string &  a_strVal  )  [inline, virtual]

Definition at line 1046 of file val.h.

                                                    {
            throw ivd_Error(ie_PARSER_ERROR,
                "Lists don't have Assign() function.");
        }

template<class CNV, class DT>
virtual void val_List< CNV, DT >::Bind ( listVecType a_dest  )  [inline, virtual]

Definition at line 989 of file val.h.

                                               {
            m_vec_p = &(a_dest);
            m_vec_p->clear();
        }


Member Data Documentation

template<class CNV, class DT>
val_List< CNV, DT >::log_CLASSID_m [protected]

Reimplemented from val_Value.

Definition at line 1055 of file val.h.

template<class CNV, class DT>
listVecType* val_List< CNV, DT >::m_vec_p [protected]

Definition at line 1053 of file val.h.

Referenced by val_SlotList::Add(), and val_SlotList::AddRange().


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