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

#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.


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 955 of file val.h.


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

Member Typedef Documentation

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

Definition at line 973 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 958 of file val.h.

00964         : val_Value(a_name, a_limits, a_minNumOfVal, a_maxNumOfVal),
00965           m_vec_p(NULL) {
00966             // Empty
00967         }

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

Definition at line 969 of file val.h.

00969                             {
00970             //Empty
00971         }


Member Function Documentation

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

Definition at line 975 of file val.h.

00975                                                {
00976             m_vec_p = &(a_dest);
00977             m_vec_p->clear();
00978         }

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 980 of file val.h.

00980                                                   {
00981             if (m_vec_p == NULL) {
00982                 throw ivd_Error(ie_INVALID_ARG,
00983                     "Target vector not specified.");
00984             }
00985 
00986             DT      basicTmp;
00987             CNV     converter("", m_limits);
00988 
00989             converter.Bind(basicTmp);
00990 
00991             try {
00992                 converter.Conv(a_strVal);
00993             }
00994             catch (ivd_Error& e){
00995                 ostringstream eNew;
00996                 eNew << "Error occured in list:" << m_name <<
00997                         " at index:" << static_cast<unsigned int>(m_vec_p->size()) <<
00998                         " " <<  e.GetContext();
00999                 throw ivd_Error(e.GetError(), eNew.str() );
01000             }
01001 
01002             val_Element<DT>     valElem(basicTmp);
01003             m_vec_p->push_back(valElem);
01004         }

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 1006 of file val.h.

01007                                                               {
01008 
01009             if (m_vec_p == NULL) {
01010                 throw ivd_Error(ie_INVALID_ARG,
01011             "Target vector not specified.");
01012             };
01013 
01014             val_Element<DT>     rangeElem;
01015             val_Range<CNV, DT>  converter("", m_limits);
01016 
01017             converter.Bind(rangeElem);
01018             try {
01019                 converter.Conv(a_strLow, a_strHigh);
01020             }
01021             catch (ivd_Error& e){
01022                 ostringstream eNew;
01023                 eNew << "Error occured in list:" << m_name <<
01024                         " at index:" << static_cast<unsigned int>(m_vec_p->size()) <<
01025                         " " <<  e.GetContext();
01026                 throw ivd_Error(e.GetError(), eNew.str() );
01027             }
01028 
01029             m_vec_p->push_back(rangeElem);
01030         }

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

Implements val_BasicValue.

Definition at line 1032 of file val.h.

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


Member Data Documentation

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

Definition at line 1039 of file val.h.

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

Reimplemented from val_Value.

Definition at line 1041 of file val.h.


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

Generated on Mon Feb 27 19:51:45 2012 for OPENARCHIVE by  doxygen 1.5.6