📄 fx_vect2.h
字号:
const int lineNo_i,
const string compilationDate_i,
const string compilationTime_i
)
//==================
{
if (!(indexBelongsToVectorRange (externalIndex_i)))
{
BUG_Vector_MESSAGE (<< getErrorMsgAboutVectorIndexOutOfRange (externalIndex_i, __PRETTY_FUNCTION__, fileName_i, lineNo_i, compilationDate_i, compilationTime_i));
return dummy_element_;
}
return basicUsualVector_ [externalIndex_i - minIndex_];
} // T& ClassFlexibleVector<T>::at
//==================
template <class T>
T ClassFlexibleVector<T>
::at (int externalIndex_i,
const string fileName_i,
const int lineNo_i,
const string compilationDate_i,
const string compilationTime_i
) const
//==================
{
if (!(indexBelongsToVectorRange (externalIndex_i)))
{
BUG_Vector_MESSAGE (<< getErrorMsgAboutVectorIndexOutOfRange (externalIndex_i, __PRETTY_FUNCTION__, fileName_i, lineNo_i, compilationDate_i, compilationTime_i));
return dummy_element_;
}
return basicUsualVector_ [externalIndex_i - minIndex_];
} // T ClassFlexibleVector<T>::at
//==================
template <class T>
string ClassFlexibleVector<T>
::gstrVElementShow (
int externalIndex_i,
string printFormat_i,
int width_i
) const
//==================
{
string ret_stringValue;
strstream tmp_strstream;
tmp_strstream << "VectorElement ["
<< externalIndex_i << "] = ";
do
{
//-----------------------------------
if (printFormat_i == "dec")
{
tmp_strstream << dec;
break;
}
//-----------------------------------
if (printFormat_i == "hex")
{
tmp_strstream << hex;
break;
}
//-----------------------------------
break;
} while (0);
if (width_i > 0)
{
tmp_strstream << setw (width_i);
}
tmp_strstream << (*this) [externalIndex_i];
do
{
//-----------------------------------
if (printFormat_i == "dec")
{
tmp_strstream << " (dec)";
break;
}
//-----------------------------------
if (printFormat_i == "hex")
{
tmp_strstream << " (hex)";
tmp_strstream << dec;
break;
}
//-----------------------------------
break;
} while (0);
tmp_strstream << ends;
ret_stringValue = tmp_strstream.str(); tmp_strstream.rdbuf()->freeze (0);
return ret_stringValue;
} // string ClassFlexibleVector<T>::gstrVElementShow
//==================
template <class T>
string ClassFlexibleVector<T>::gstrVectorList () const
//==================
{
string ret_stringValue;
strstream tmp_strstream;
if (!empty ())
{
for (int index = Get_minIndex (); index <= Get_maxIndex (); index++)
{
if (index > Get_minIndex ())
{
tmp_strstream << ", ";
}
tmp_strstream << (*this) [index];
}
}
else
{
tmp_strstream << " <Empty> ";
}
tmp_strstream << ends;
ret_stringValue = tmp_strstream.str(); tmp_strstream.rdbuf()->freeze (0);
return ret_stringValue;
} // string ClassFlexibleVector<T>::gstrVectorList
//==================
template <class T>
string ClassFlexibleVector<T>
::gstrVectorShow (
char* file_name_i,
int line_no_i,
string msg_i,
string printFormat_i,
int width_i
) const
//==================
{
string ret_stringValue;
strstream tmp_strstream;
tmp_strstream << endl
<< "############################################################"
<< endl
<< "#################### ShowVector : Begin ####################"
<< endl
<< "#################### [show#"
<< (++show_counter)
<< "] ("
<< file_name_i
<< ", #"
<< line_no_i
<< ")"
<< endl
<< "############################################################"
<< endl
<< endl;
if (!msg_i.empty ())
{
tmp_strstream << "\t"
<< msg_i
<< " :"
<< endl;
}
if (basicUsualVector_.empty ())
{
ASSERT (Get_minIndex () > Get_maxIndex ());
tmp_strstream << "\tVector is Empty; MinIndex = "
<< Get_minIndex ()
<< endl;
}
else
{
ASSERT (Get_minIndex () <= Get_maxIndex ());
tmp_strstream << "\tVector range is ["
<< Get_minIndex ()
<< " : "
<< Get_maxIndex () << "]"
<< "; Total elements = "
<< Get_maxIndex () - Get_minIndex () + 1
<< endl;
}
tmp_strstream << gstrObjectLocationShow () << endl;
for (int index = Get_minIndex (); index <= Get_maxIndex (); index++)
{
tmp_strstream << gstrVElementShow (index, printFormat_i, width_i)
<< endl;
}
tmp_strstream << endl
<< "##################### ShowVector : End #####################"
<< endl
<< endl;
tmp_strstream << ends;
ret_stringValue = tmp_strstream.str(); tmp_strstream.rdbuf()->freeze (0);
return ret_stringValue;
} // string ClassFlexibleVector<T>::gstrVectorShow
//==================
template <class T>
void ClassFlexibleVector<T>
:: showVector(
char* file_name_i,
int line_no_i,
string msg_i,
string printFormat_i,
int width_i
) const
//==================
{
cout << gstrVectorShow (
file_name_i,
line_no_i,
msg_i,
printFormat_i,
width_i
)
<< endl;
} // void ClassFlexibleVector<T> :: showVector(string msg_i, string printFormat_i, int width_i)
//==================
template <class T>
ClassFlexibleVector<T> ClassFlexibleVector<T>
::slice (
const int& minIndexSlice_i,
const int& maxIndexSlice_i
)
//==================
{
if (!(minIndexSlice_i <= maxIndexSlice_i))
{
cerr << eqline1_CNS << endl;
cerr << "Illegal Vector' Slice range : "
<< endl
<< "\trange of slice is ["
<< minIndexSlice_i
<< "-"
<< maxIndexSlice_i
<< "]"
<< endl;
cerr << eqline1_CNS << endl;
cerr << gstrObjectLocationShow () << endl;
return;
ASSERT (0); // Currently unused
} // if ((minIndexSlice_i < Get_minIndex ()) || (maxIndexSlice_i > Get_maxIndex ()))
if ((minIndexSlice_i < Get_minIndex ()) || (maxIndexSlice_i > Get_maxIndex ()))
{
cerr << eqline1_CNS << endl;
cerr << "Vector' Slice out of range : "
<< endl
<< "\trange of slice is ["
<< minIndexSlice_i
<< "-"
<< maxIndexSlice_i
<< "],"
<< endl
<< "\trange of vector is ["
<< Get_minIndex ()
<< "-"
<< Get_maxIndex ()
<< "]"
<< endl;
cerr << eqline1_CNS << endl;
cerr << gstrObjectLocationShow () << endl;
return;
ASSERT (0); // Currently unused
} // if ((minIndexSlice_i < Get_minIndex ()) || (maxIndexSlice_i > Get_maxIndex ()))
ClassFlexibleVector<T> ret_ClassFlexibleVectorObject (minIndexSlice_i, LOCATION);
for (int index = minIndexSlice_i; index <= maxIndexSlice_i; index++)
{
ret_ClassFlexibleVectorObject.push_back ((*this) [index]);
}
return ret_ClassFlexibleVectorObject;
} // ClassFlexibleVector<T> ClassFlexibleVector<T>::slice
//==================
template <class T>
void ClassFlexibleVector<T>
:: setAboveOrdinalNumber(int theAboveOrdinalNumber_i)
//==================
{
theAboveOrdinalNumber_ = theAboveOrdinalNumber_i;
} // void ClassFlexibleVector<T> :: setAboveOrdinalNumber(int theAboveOrdinalNumber_i)
//==================
template <class T>
int ClassFlexibleVector<T>
:: getAboveOrdinalNumber() const
//==================
{
return theAboveOrdinalNumber_;
} // int ClassFlexibleVector<T> :: getAboveOrdinalNumber()
//########################################################
//################# ClassVeryFlexibleVector ##############
//######################## Methods #######################
//########################################################
//==================
// Constructor-0
template <class T, int this_LINE, char* this_FILE, char* this_DATE, char* this_TIME>
inline ClassVeryFlexibleVector<T, this_LINE, this_FILE, this_DATE, this_TIME>::ClassVeryFlexibleVector() : ClassFlexibleVector<T> ()
//==================
{
(*this).setSpecificPrimaryIdentification (
DeclarationInitKind,
ObjectIdentification (
this_FILE,
this_LINE,
this_DATE,
this_TIME
));
} // ClassVeryFlexibleVector :: ClassVeryFlexibleVector()
//==================
// Constructor-1
template <class T, int this_LINE, char* this_FILE, char* this_DATE, char* this_TIME>
inline ClassVeryFlexibleVector<T, this_LINE, this_FILE, this_DATE, this_TIME>::ClassVeryFlexibleVector(
int minIndex_i,
const string fileName_i,
const int lineNo_i,
const string compilationDate_i,
const string compilationTime_i
) :
ClassFlexibleVector<T> (
minIndex_i,
fileName_i,
lineNo_i,
compilationDate_i,
compilationTime_i
)
//==================
{
(*this).setSpecificPrimaryIdentification (
DeclarationInitKind,
ObjectIdentification (
this_FILE,
this_LINE,
this_DATE,
this_TIME
));
} // ClassVeryFlexibleVector :: ClassVeryFlexibleVector()
//==================
// Constructor-2
template <class T, int this_LINE, char* this_FILE, char* this_DATE, char* this_TIME>
inline ClassVeryFlexibleVector<T, this_LINE, this_FILE, this_DATE, this_TIME>::ClassVeryFlexibleVector(
int minIndex_i,
int maxIndex_i,
const T& value_i,
const string fileName_i,
const int lineNo_i,
const string compilationDate_i,
const string compilationTime_i
) :
ClassFlexibleVector<T> (
minIndex_i,
maxIndex_i,
value_i,
fileName_i,
lineNo_i,
compilationDate_i,
compilationTime_i
)
//==================
{
(*this).setSpecificPrimaryIdentification (
DeclarationInitKind,
ObjectIdentification (
this_FILE,
this_LINE,
this_DATE,
this_TIME
));
} // ClassVeryFlexibleVector :: ClassVeryFlexibleVector()
//==================
// Copy Constructor
template <class T, int this_LINE, char* this_FILE, char* this_DATE, char* this_TIME>
ClassVeryFlexibleVector<T, this_LINE, this_FILE, this_DATE, this_TIME> :: ClassVeryFlexibleVector(const ClassVeryFlexibleVector& theCopyInstance_i)
//==================
{
(*this).hardAssign (theCopyInstance_i);
} // ClassVeryFlexibleVector :: ClassVeryFlexibleVector()
//==================
// Destructor
template <class T, int this_LINE, char* this_FILE, char* this_DATE, char* this_TIME>
ClassVeryFlexibleVector<T, this_LINE, this_FILE, this_DATE, this_TIME> :: ~ClassVeryFlexibleVector()
//==================
{
} // ClassVeryFlexibleVector :: ~ClassVeryFlexibleVector()
//################################################################
#endif
//################################################################
//# END OF FILE #
//################################################################
// ------------------- C++ code : END ----------------------
// === File #5 of 15 : fx_vect2.h ==========================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -