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.


Detailed Description

Definition at line 1061 of file val.h.


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)

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 1160 of file val.cpp.

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


Member Function Documentation

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

Reimplemented from val_List< val_StrictString, string >.

Definition at line 1170 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< val_StrictString, string >::m_vec_p, and NULL.

01170                                              {
01171     if (m_vec_p == NULL) {
01172         throw ivd_Error(ie_INVALID_ARG, "Target vector not specified.");
01173     }
01174 
01175     // Verify integer value of the string
01176     UInt64_t slot;
01177     val_Integer vSlot("", val_Limit(1, cfg_MAX_SLOT_NUM));
01178     vSlot.Bind(slot);
01179 
01180     try {
01181         vSlot.Conv(a_strVal);
01182     }
01183     catch (ivd_Error& e){
01184         ostringstream eNew;
01185         eNew << "Error occured in list:" << m_name <<
01186                 " " <<  e.GetContext();
01187         throw ivd_Error(e.GetError(), eNew.str() );
01188     }
01189 
01190     // Add textual value to the vector.
01191     val_Element<string> valElem(cmn_Num2Str(slot));
01192     m_vec_p->push_back(valElem);
01193 }

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< val_StrictString, string >.

Definition at line 1196 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< val_StrictString, string >::m_vec_p, and NULL.

01196                                                                              {
01197     if (m_vec_p == NULL) {
01198         throw ivd_Error(ie_INVALID_ARG, "Target vector not specified.");
01199     };
01200 
01201     // Verify limits of string values
01202     val_Element<string>     rangeElem;
01203     val_Range<val_StrictString, string>  converter("", m_limits);
01204 
01205     converter.Bind(rangeElem);
01206 
01207     try {
01208         converter.Conv(a_strLow, a_strHigh);
01209     }
01210     catch (ivd_Error& e){
01211         ostringstream eNew;
01212         eNew << "Error occured in list:" << m_name <<
01213                 " " <<  e.GetContext();
01214         throw ivd_Error(e.GetError(), eNew.str() );
01215     }
01216 
01217     // Verify integer representations of low/high value
01218     UInt64_t lowInt;
01219     val_Integer vLowInt("", val_Limit(1, cfg_MAX_SLOT_NUM));
01220     vLowInt.Bind(lowInt);
01221 
01222     try {
01223         vLowInt.Conv(a_strLow);
01224     }
01225     catch (ivd_Error& e){
01226         ostringstream eNew;
01227         eNew << "Error occured in list:" << m_name <<
01228                 " " <<  e.GetContext();
01229         throw ivd_Error(e.GetError(), eNew.str() );
01230     }
01231 
01232     UInt64_t highInt;
01233     val_Integer vHighInt("", val_Limit(1, cfg_MAX_SLOT_NUM));
01234     vHighInt.Bind(highInt);
01235 
01236     try {
01237         vHighInt.Conv(a_strHigh);
01238     }
01239     catch (ivd_Error& e){
01240         ostringstream eNew;
01241         eNew << "Error occured in list:" << m_name <<
01242                 " " <<  e.GetContext();
01243         throw ivd_Error(e.GetError(), eNew.str() );
01244     }
01245 
01246     // Add textual representations of values to vector.
01247     for (UInt64_t i = lowInt; i <= highInt; i++){
01248         val_Element<string>   expElem(cmn_Num2Str(i));
01249         m_vec_p->push_back(expElem);
01250     };
01251 }

Here is the call graph for this function:


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

Generated on Mon Feb 27 19:52:04 2012 for OPENARCHIVE by  doxygen 1.5.6