Main Page · Modules · All Classes · Class Hierarchy |
Classes | |
class | MCBinaryData |
Binary data class. More... | |
struct | MCDataItemBase |
Data container item base structure to store basic type info. More... | |
class | MCDataItem< T > |
A helper class to fill the type info to the base structure. More... | |
class | MCDataContainer |
Data container. More... | |
class | MCDataStorage |
Data storage with file support. More... | |
struct | iterator_extractor< T > |
Iterator magic for for loops to get the index while iterating through. More... | |
struct | iterator_extractor< T const > |
Iterator magic for for loops to get the index while iterating through. More... | |
class | Indexer< T > |
Iterator magic for for loops to get the index while iterating through. More... | |
class | MCRandomSeed |
Random seed generation based on boost::mt19937. More... | |
class | MCDiffPatch |
Diff-patch class. More... | |
class | MCLog |
Basic log functionalities. More... | |
class | MCLogMessageHandler |
Log message handler. More... | |
class | MCLogEcho |
Simple class to echo the log messages to the console. More... | |
class | MCQtLogEcho |
Simple class to echo the log messages to the Qt debug console. More... | |
class | MCThreadLocalData< T > |
A wrapper class to cover boost::thread_specific_ptr/folly::ThreadLocal API on certain targets. More... | |
class | MCTimer |
Simple timer class with microsecond precision. More... | |
class | MASystemTimeHandler |
System timer handler. More... | |
class | MCZipper |
Compression class. More... | |
Macros | |
#define | foreach_i(_i, _iter, _container) |
For each cycle with auto keyword and index values. | |
#define | MC_DIR_SEPARATOR "/" |
Directory separator macro. | |
#define | MC_UNUSED(a) (void)a; |
Helper macro to avoid compiler warning about unused function parameters. | |
#define | MC_DISABLE_COPY(class_name) |
Helper macro to disable the copy constructor and assignment operator of a class (object copying) | |
#define | MC_DISABLE_DEFAULT_CTOR(class_name) |
Helper macro to disable the default constructor of a class. | |
#define | MC_LOG(...) MCLog::LogMessage(__PRETTY_FUNCTION__, __VA_ARGS__) |
Debug macro. | |
#define | MC_WARNING(...) MCLog::WarningMessage(__PRETTY_FUNCTION__, __VA_ARGS__) |
Warning macro. | |
#define | MC_ERROR(...) MCLog::ErrorMessage(__PRETTY_FUNCTION__, __VA_ARGS__) |
Error macro. | |
#define | MC_BPRINT(color, ...) MCLog::FormattedMessage(color, true, __VA_ARGS__) |
Print macro with bold letters. | |
#define | MC_PRINT(color, ...) MCLog::FormattedMessage(color, false, __VA_ARGS__) |
Print macro with normal letters. | |
#define | MC_NPRINT(...) MCLog::FormattedMessage(MCLog::NoColor, false, __VA_ARGS__) |
Print macro with normal letters without colors. | |
Enumerations |
Functions | |
template<typename T , typename U > | |
const T | MCMin (const U &container) |
Get the minimal value of a container. More... | |
template<typename T , typename U > | |
const T | MCMax (const U &container) |
Get the maximal value of a container. More... | |
QStringList | MCStdStringsToQStringList (const MC::StringList &string_list) |
Convert a std::string vector to QStringList. More... | |
MC::StringList | MCQStringListToStdStrings (const QStringList &string_list) |
Convert a QStringList to std::string vector. More... | |
template<typename T > | |
std::vector< std::vector< T > > | MCQVectorTableToStdVectorTable (const QVector< QVector< T > > &table) |
Convert QVector based table to std::vector based table. More... | |
template<typename T , typename U > | |
int | MCGetQMapKeyIndex (const QMap< T, U > &container, const T &key) |
Get the index of a key in a QMap. More... | |
template<typename T , typename U > | |
U | MCGetQMapItemByIndex (const QMap< T, U > &container, const int index) |
Get a certain item from a QMap. More... | |
template<typename T , typename U > | |
QMap< T, U >::const_iterator | MCGetQMapConstIteratorByIndex (const QMap< T, U > &container, const int index) |
Get the iterator for a certain item from a QMap. More... | |
template<typename T , typename U > | |
QMap< T, U >::iterator | MCGetQMapIteratorByIndex (QMap< T, U > &container, const int index) |
Get the iterator for a certain item from a QMap. More... | |
template<typename T , typename U > | |
std::pair< int, T > | MCBinarySearch (const U &container, const T &value, bool nearest=false) |
Binary search for a value in a container. More... | |
template<typename T , typename U > | |
std::pair< int, T > | MCBinarySearch (const U &container, const T &value, int min_index, int max_index, bool nearest=false) |
Binary search for a value in a certain range of a container. More... | |
template<typename T > | |
std::pair< int, T > | MCBinarySearch (const std::vector< T > &container, const T &value, bool nearest=false) |
Binary search for a value in a vector. More... | |
template<typename T > | |
std::pair< int, T > | MCBinarySearch (const std::vector< T > &container, const T &value, int min_index, int max_index, bool nearest=false) |
Binary search for a value in a certain range of a vector. More... | |
template<typename T , typename U > | |
std::vector< T > | MCGetContainerKeys (const U &container) |
Get container keys as a vector. More... | |
template<typename T , typename U > | |
std::vector< T > | MCGetContainerValues (const U &container) |
Get container values as a vector. More... | |
template<typename T , typename U > | |
bool | MCContainerContains (const U &container, const T &value) |
Check if a container contains a value. More... | |
template<typename T , typename U > | |
void | MCMultiplyContainer (U &container, T multiplier) |
Multiple a container by a value. More... | |
template<typename T , typename U > | |
void | MCSumContainers (U &target_container, const U &second_container, T multiplier) |
Summarize containers. More... | |
template<typename T , typename U > | |
T | MCGetMostFrequentItemFromContainer (const U &container) |
Get the most frequent item of a container. More... | |
template<typename V > | |
bool | MCIsConsistentTable (V &table) |
Check the consistency of a table. More... | |
template<typename T , typename U > | |
void | MCShiftContainerbyValue (U &container, T shift_value) |
Shift container values. More... | |
template<typename T , typename V > | |
void | MCAddValueToTable (V &table, T value) |
Add value to table items. More... | |
template<typename T , typename V > | |
void | MCMultiplyTableRow (V &table, unsigned int row_index, T multiplier) |
Multiple table row by a value. More... | |
template<typename T , typename V > | |
void | MCMultiplyTableColumn (V &table, unsigned int column_index, T multiplier) |
Multiple table column by a value. More... | |
template<typename T , typename V > | |
void | MCMultiplyTable (V &table, T multiplier) |
Multiply table by value. More... | |
template<typename T , typename V > | |
void | MCSumTables (V &target_table, const V &second_table, T multiplier) |
Summarize tables. More... | |
template<typename T , typename V > | |
void | MCSwapTableColumns (V &table, unsigned int column1, unsigned int column2) |
Swap two columns inside a table. More... | |
template<typename T , typename U , typename V > | |
U | MCDiagonalItemsFromTable (const V &table, bool top_left_to_right_bottom=true) |
Get the diagonal items of a squared table. More... | |
template<typename U > | |
void | MCMergeContainers (U &target, const U &other) |
Merge two containers. More... | |
template<typename T , typename U > | |
std::vector< int > | MCItemIndicesInContainer (const U &container, const T item) |
Get item indices in a container. More... | |
template<typename T , typename U > | |
std::vector< T > | MCItemsByIndicesFromContainer (const U &container, std::vector< int > indices) |
Get items by indices from a container. More... | |
template<typename U > | |
U | MCUniqueItemsFromContainer (const U &container) |
Get unique items from a container. More... | |
template<typename U > | |
U | MCCommonValuesFromContainers (const U &first_container, const U &second_container) |
Count common values in two containers. More... | |
template<typename T , typename U > | |
int | MCItemCountInContainer (const U &container, const T item) |
Calculate the number of a given item in a container. More... | |
template<typename T , typename U , typename V > | |
int | MCItemCountInTable (const V &table, const T item) |
Calculate the number of a given item in a table. More... | |
template<typename U > | |
U | MCNthItemsFromContainer (const U &container, unsigned int n_th, unsigned int period) |
Get items from n-th indexes of a container. More... | |
template<typename T , typename U > | |
void | MCReplaceItemInContainer (U &container, const T item, const T new_value) |
Replace an item in a container. More... | |
template<typename T , typename U > | |
std::pair< int, T > | MCSearchMinimalValueWithIndex (const U &container) |
Search the minimal value in a container. More... | |
template<typename T , typename U > | |
std::pair< int, T > | MCSearchMaximalValueWithIndex (const U &container) |
Search the maximal value in a container. More... | |
template<typename T , typename U > | |
T | MCSearchMinimalValue (const U &container) |
Search the minimal value in a container. More... | |
template<typename T , typename U > | |
T | MCSearchMaximalValue (const U &container) |
Search the maximal value in a container. More... | |
template<typename U , typename V > | |
U | MCGetTableColumn (const V &table, unsigned int column_index) |
Get a column from a table as a container. More... | |
template<typename U , typename V > | |
V | MCGetTableColumns (const V &table, unsigned int start_column, unsigned int column_count) |
Get columns from a table. More... | |
template<typename V > | |
void | MCEraseTableColumns (V &table, unsigned int start_column, unsigned int column_count) |
Erase columns from a table. More... | |
template<typename V > | |
std::vector< std::vector< float > > | MCCalculateMeanStDevForTableColumns (const V &table) |
Calculate standard deviation and arithmetic mean for table columns. More... | |
template<typename U , typename T > | |
void | MCStandardizeVector (U &vector, const std::vector< std::vector< float > > &mean_stdev_table) |
Standardize a vector. More... | |
template<typename T , typename U , typename V > | |
void | MCStandardizeTablePerColumns (V &table, const std::vector< std::vector< float > > &mean_stdev_table) |
Standardize a table per column. More... | |
template<typename V > | |
std::vector< std::vector< float > > | MCCalculateMinMaxForTableColumns (const V &table) |
Calculate minimums and maximums for table columns. More... | |
template<typename U , typename T > | |
void | MCRescaleVectorByMinMax (U &vector, const std::vector< std::vector< float > > &min_max_table) |
Rescale a vector by minimum-maximum. More... | |
template<typename T , typename U , typename V > | |
void | MCRescaleTablePerColumnsByMinMax (V &table, const std::vector< std::vector< float > > &min_max_table) |
Rescale a table per column by minimum-maximum. More... | |
template<typename U , typename T > | |
void | MCRescaleVectorByLength (U &vector) |
Rescale a vector by "row length". More... | |
template<typename T , typename U , typename V > | |
void | MCRescaleTablePerRowByRowLength (V &table) |
Rescale a table per row by "row length". More... | |
template<typename V > | |
void | MCExportTableToTsvFile (const std::string &file_name, const MC::StringList &header, const V &table, bool export_row_index=false) |
Export a table to tabulator separated values (tsv) file. More... | |
template<typename U , typename V > | |
void | MCExportFeatureTableToTsvFile (const std::string &file_name, const V &table, const U &labels, const MC::StringList &feature_names=MC::StringList(), bool export_row_index=false) |
Export a feature table with labels to a tsv (tabulator separated values) file. More... | |
template<typename U , typename V > | |
void | MCExportFeatureTableToArffFile (const std::string &file_name, const V &table, const U &labels, const MC::StringList &feature_names=MC::StringList()) |
Export a feature table and labels to an Arff (Weka) file. More... | |
template<typename U > | |
void | MCPrintContainerAsFloats (U &container, const std::string &message="", unsigned int digits=2) |
Print a container to the output as float numbers. More... | |
template<typename U > | |
void | MCPrintContainerAsInts (U &container, const std::string &message="") |
Print a container to the output as integer numbers. More... | |
template<typename V > | |
void | MCPrintTableAsFloats (V &table, const std::string &message="", unsigned int digits=2) |
Print a table to the output as float numbers. More... | |
template<typename V > | |
void | MCPrintTableAsInts (V &table, const std::string &message="") |
Print a table to the output as integer numbers. More... | |
template<typename T > | |
MCBinaryData * | MCEncodeToBinaryData (const T &data, bool portable=true) |
Encode a data into binary form. More... | |
template<typename T > | |
boost::shared_ptr< T > | MCDecodeFromBinaryData (const MCBinaryData &data, bool portable=true) |
Decode a data from binary form. More... | |
template<typename T > | |
std::string | MCEncodeToString (const T &data, bool portable=true) |
Encode a data into a string. More... | |
template<typename T > | |
boost::shared_ptr< T > | MCDecodeFromString (const std::string &data_str, bool portable=true) |
Decode a data from a string. More... | |
template<typename T > | |
Indexer< T > | index (T &t) |
Iterator magic for for loops to get the index while iterating through. More... | |
template<typename T > | |
T | MCRandComplex (const T &min, const T &max) |
Get a random number generated with an advanced algorithm. More... | |
template<typename T > | |
T | MCRand (const T &min, const T &max) |
Get a random number generated with standard calls. More... | |
int | MCRandSign () |
Generate a random sign. More... | |
void | MCSleep (unsigned int msecs) |
Wait for some milliseconds. More... | |
float | MCFloatInfinity () |
Get float infinity. More... | |
double | MCDoubleInfinity () |
Get double infinity. More... | |
bool | MCIsFloatInfinity (const float value) |
Check a value for float infinity. More... | |
bool | MCIsDoubleInfinity (const double value) |
Check a value for double infinity. More... | |
float | MCRound (float number) |
Round a float number. More... | |
float | MCScaleValue (float value, float min, float max, float new_max) |
Scale a value to a new range. More... | |
template<typename T > | |
std::string | MCToStr (const T value, bool hex_manipulator=false) |
Convert an other type to string with std::stringstream. More... | |
template<typename T > | |
T | MCStrConvert (const std::string &str) |
Convert a string to an other type with std::stringstream. More... | |
template<typename T > | |
T | MCAbs (const T &value) |
Calculate absolute value. More... | |
int | MCCompare (const std::string &item, const std::string &a, const std::string &b) |
Decide whether a string is relative closer to other strings. More... | |
template<typename T > | |
int | MCCompare (const T &item, const T &a, const T &b) |
Decide whether a value is relative closer to other values. More... | |
int | MCCompare (const std::string &a, const std::string &b) |
Case-insensitive comparison of two strings. More... | |
template<typename T > | |
int | MCCompare (const T &a, const T &b) |
Compare two values. More... | |
template<typename T > | |
const T & | MCMin (const T &a, const T &b) |
Get the minimum of two values. More... | |
template<typename T > | |
const T & | MCMax (const T &a, const T &b) |
Get the maximum of two values. More... | |
template<typename T > | |
const T & | MCBound (const T &min, const T &value, const T &max) |
Check a value bound according to a range. More... | |
template<typename T > | |
bool | MCRangeCheck (const T &value, const T &min, const T &max) |
Range check of a value. More... | |
template<typename T > | |
std::string | MCGetClassName (T *instance=nullptr, const std::string &name_suffix="") |
Get a class name. More... | |
bool | MCFileExists (const std::string &file_name) |
Check whether a file exists. More... | |
int | MCGetFileSize (const std::string &file_name) |
Get file size. More... | |
bool | MCCreatePath (const QString &path_str) |
Create a new path if it does not exist. More... | |
bool | MCRemoveDirectory (const QString &dir_str) |
Remove a directory with its content. More... | |
QString | MCFixPath (const QString &path) |
Fix the (back)slashes in a path according to the platform. More... | |
void | MCAddSearchPath (const QString &path) |
Add a location to the search path for data files. More... | |
QString | MCGetDataFile (const QString &file_name) |
Search a data file. More... | |
QString | MCGetDataSubdirectory (const QString &subdirectory) |
Get a data subdirectory. More... | |
enum MC::TimerType |
Timer modes
Enumerator | |
---|---|
NoExpiration |
No expiration |
SimpleExpiration |
Simple expiration |
SingleShot |
Single shot |
PeriodicShots |
Periodic shot |
Definition at line 45 of file MCTimer.hpp.
Indexer<T> index | ( | T & | t | ) |
Iterator magic for for loops to get the index while iterating through.
Taken from: http://stackoverflow.com/a/10962575/602173
Usage:
for (auto iter: index(container)) cout << "Index: " << iter.i << " - Value: " << *iter;
Definition at line 146 of file MCDefs.hpp.
T MCAbs | ( | const T & | value | ) |
Calculate absolute value.
value | Value |
Definition at line 399 of file MCDefs.hpp.
void MCAddSearchPath | ( | const QString & | path | ) |
Add a location to the search path for data files.
path | Path |
Definition at line 414 of file MCDefs.cpp.
void MCAddValueToTable | ( | V & | table, |
T | value | ||
) |
Add value to table items.
table | Table |
value | Value |
Definition at line 677 of file MCContainers.hpp.
std::pair<int, T> MCBinarySearch | ( | const U & | container, |
const T & | value, | ||
bool | nearest = false |
||
) |
Binary search for a value in a container.
container | Container |
value | Value to be searched |
nearest | Fallback to nearest value (true - nearest value is satisfactory; false - search for exact value.) |
Definition at line 272 of file MCContainers.hpp.
std::pair<int, T> MCBinarySearch | ( | const U & | container, |
const T & | value, | ||
int | min_index, | ||
int | max_index, | ||
bool | nearest = false |
||
) |
Binary search for a value in a certain range of a container.
container | Container |
value | Value to be searched |
min_index | Minimal search index |
max_index | Maximal search index |
nearest | Fallback to nearest value (true - nearest value is satisfactory; false - search for exact value.) |
Definition at line 293 of file MCContainers.hpp.
std::pair<int, T> MCBinarySearch | ( | const std::vector< T > & | container, |
const T & | value, | ||
bool | nearest = false |
||
) |
Binary search for a value in a vector.
container | Vector |
value | Value to be searched |
nearest | Fallback to nearest value (true - nearest value is satisfactory; false - search for exact value.) |
Definition at line 380 of file MCContainers.hpp.
std::pair<int, T> MCBinarySearch | ( | const std::vector< T > & | container, |
const T & | value, | ||
int | min_index, | ||
int | max_index, | ||
bool | nearest = false |
||
) |
Binary search for a value in a certain range of a vector.
container | Vector |
value | Value to be searched |
min_index | Minimal search index |
max_index | Maximal search index |
nearest | Fallback to nearest value (true - nearest value is satisfactory; false - search for exact value.) |
Definition at line 401 of file MCContainers.hpp.
const T& MCBound | ( | const T & | min, |
const T & | value, | ||
const T & | max | ||
) |
Check a value bound according to a range.
min | Minimum of the range |
value | Value |
max | Maximum of the range |
Definition at line 527 of file MCDefs.hpp.
std::vector<std::vector<float> > MCCalculateMeanStDevForTableColumns | ( | const V & | table | ) |
Calculate standard deviation and arithmetic mean for table columns.
table | Table |
Definition at line 1334 of file MCContainers.hpp.
std::vector<std::vector<float> > MCCalculateMinMaxForTableColumns | ( | const V & | table | ) |
Calculate minimums and maximums for table columns.
table | Table |
Definition at line 1440 of file MCContainers.hpp.
U MCCommonValuesFromContainers | ( | const U & | first_container, |
const U & | second_container | ||
) |
Count common values in two containers.
first_container | First container |
second_container | Second container |
Definition at line 997 of file MCContainers.hpp.
int MCCompare | ( | const std::string & | item, |
const std::string & | a, | ||
const std::string & | b | ||
) |
Decide whether a string is relative closer to other strings.
item | Item to be checked |
a | First candidate |
b | Second candidate |
The check is case-insensitive.
Definition at line 167 of file MCDefs.cpp.
int MCCompare | ( | const T & | item, |
const T & | a, | ||
const T & | b | ||
) |
Decide whether a value is relative closer to other values.
item | Item to be checked |
a | First candidate |
b | Second candidate |
Definition at line 433 of file MCDefs.hpp.
int MCCompare | ( | const std::string & | a, |
const std::string & | b | ||
) |
Case-insensitive comparison of two strings.
a | First string |
b | Second string |
Definition at line 198 of file MCDefs.cpp.
int MCCompare | ( | const T & | a, |
const T & | b | ||
) |
Compare two values.
a | First value |
b | Second value |
Definition at line 470 of file MCDefs.hpp.
bool MCContainerContains | ( | const U & | container, |
const T & | value | ||
) |
Check if a container contains a value.
container | Container |
value | Searched value |
Definition at line 527 of file MCContainers.hpp.
bool MCCreatePath | ( | const QString & | path_str | ) |
Create a new path if it does not exist.
path_str | Path string |
Definition at line 344 of file MCDefs.cpp.
boost::shared_ptr<T> MCDecodeFromBinaryData | ( | const MCBinaryData & | data, |
bool | portable = true |
||
) |
Decode a data from binary form.
data | Binary data to be decoded |
portable | Whether the decoded binary data is portable |
The function decodes the data internally from a data container.
Definition at line 350 of file MCDataContainer.hpp.
boost::shared_ptr<T> MCDecodeFromString | ( | const std::string & | data_str, |
bool | portable = true |
||
) |
Decode a data from a string.
data_str | String to be decoded |
portable | Whether the decoded binary data is portable |
The function decodes the data internally from a data container.
Definition at line 401 of file MCDataContainer.hpp.
U MCDiagonalItemsFromTable | ( | const V & | table, |
bool | top_left_to_right_bottom = true |
||
) |
Get the diagonal items of a squared table.
table | Table |
top_left_to_right_bottom | True or false to indicate the diagonal type |
Definition at line 866 of file MCContainers.hpp.
double MCDoubleInfinity | ( | ) |
MCBinaryData* MCEncodeToBinaryData | ( | const T & | data, |
bool | portable = true |
||
) |
Encode a data into binary form.
data | Data to be encoded |
portable | Whether the encoded binary data is portable |
The function parses the data internally into a data container and encodes in binary form.
Definition at line 329 of file MCDataContainer.hpp.
std::string MCEncodeToString | ( | const T & | data, |
bool | portable = true |
||
) |
Encode a data into a string.
data | Data to be encoded |
portable | Whether the encoded binary data is portable |
The function parses the data internally into a data container and encodes in binary form. Eventually, the binary data is converted to base64.
Definition at line 381 of file MCDataContainer.hpp.
void MCEraseTableColumns | ( | V & | table, |
unsigned int | start_column, | ||
unsigned int | column_count | ||
) |
Erase columns from a table.
table | Table |
start_column | Start column |
column_count | Column count to be erased |
Definition at line 1305 of file MCContainers.hpp.
void MCExportFeatureTableToArffFile | ( | const std::string & | file_name, |
const V & | table, | ||
const U & | labels, | ||
const MC::StringList & | feature_names = MC::StringList() |
||
) |
Export a feature table and labels to an Arff (Weka) file.
file_name | File name |
table | Feature table |
labels | Labels |
feature_names | Feature names |
Definition at line 1698 of file MCContainers.hpp.
void MCExportFeatureTableToTsvFile | ( | const std::string & | file_name, |
const V & | table, | ||
const U & | labels, | ||
const MC::StringList & | feature_names = MC::StringList() , |
||
bool | export_row_index = false |
||
) |
Export a feature table with labels to a tsv (tabulator separated values) file.
file_name | File name |
table | Feature table |
labels | Labels |
feature_names | Feature names |
export_row_index | Whether row indexes to be exported |
Definition at line 1646 of file MCContainers.hpp.
void MCExportTableToTsvFile | ( | const std::string & | file_name, |
const MC::StringList & | header, | ||
const V & | table, | ||
bool | export_row_index = false |
||
) |
Export a table to tabulator separated values (tsv) file.
file_name | File name |
header | Header strings |
table | Table |
export_row_index | Whether row indexes to be exported |
Definition at line 1584 of file MCContainers.hpp.
bool MCFileExists | ( | const std::string & | file_name | ) |
Check whether a file exists.
file_name | File name |
Definition at line 226 of file MCDefs.cpp.
QString MCFixPath | ( | const QString & | path | ) |
Fix the (back)slashes in a path according to the platform.
path | Path |
Definition at line 399 of file MCDefs.cpp.
float MCFloatInfinity | ( | ) |
std::string MCGetClassName | ( | T * | instance = nullptr , |
const std::string & | name_suffix = "" |
||
) |
Get a class name.
instance | Object instance |
name_suffix | Name suffix |
Definition at line 627 of file MCDefs.hpp.
std::vector<T> MCGetContainerKeys | ( | const U & | container | ) |
Get container keys as a vector.
container | Container |
Definition at line 484 of file MCContainers.hpp.
std::vector<T> MCGetContainerValues | ( | const U & | container | ) |
Get container values as a vector.
container | Container |
Definition at line 505 of file MCContainers.hpp.
QString MCGetDataFile | ( | const QString & | file_name | ) |
Search a data file.
file_name | File name |
This method searches for a file in the current directory and in the locations added by MCAddSearchPath().
Definition at line 425 of file MCDefs.cpp.
QString MCGetDataSubdirectory | ( | const QString & | subdirectory | ) |
Get a data subdirectory.
subdirectory | Subdirectory |
This method searches for a subdirectory in the current directory and in the locations added by MCAddSearchPath().
Definition at line 453 of file MCDefs.cpp.
int MCGetFileSize | ( | const std::string & | file_name | ) |
Get file size.
file_name | File name |
Definition at line 239 of file MCDefs.cpp.
T MCGetMostFrequentItemFromContainer | ( | const U & | container | ) |
Get the most frequent item of a container.
container | Container |
Definition at line 594 of file MCContainers.hpp.
QMap<T, U>::const_iterator MCGetQMapConstIteratorByIndex | ( | const QMap< T, U > & | container, |
const int | index | ||
) |
Get the iterator for a certain item from a QMap.
container | The container where the search is done |
index | The desired index of the iterator |
Definition at line 201 of file MCContainers.hpp.
U MCGetQMapItemByIndex | ( | const QMap< T, U > & | container, |
const int | index | ||
) |
Get a certain item from a QMap.
container | The container where the search is done |
index | The desired index |
Definition at line 179 of file MCContainers.hpp.
QMap<T, U>::iterator MCGetQMapIteratorByIndex | ( | QMap< T, U > & | container, |
const int | index | ||
) |
Get the iterator for a certain item from a QMap.
container | The container where the search is done |
index | The desired index of the iterator |
Definition at line 230 of file MCContainers.hpp.
int MCGetQMapKeyIndex | ( | const QMap< T, U > & | container, |
const T & | key | ||
) |
Get the index of a key in a QMap.
container | The container where the search is done |
key | Searched key |
Definition at line 153 of file MCContainers.hpp.
U MCGetTableColumn | ( | const V & | table, |
unsigned int | column_index | ||
) |
Get a column from a table as a container.
table | Table |
column_index | Column index |
Definition at line 1242 of file MCContainers.hpp.
V MCGetTableColumns | ( | const V & | table, |
unsigned int | start_column, | ||
unsigned int | column_count | ||
) |
Get columns from a table.
table | Table |
start_column | Start column |
column_count | Column count to be copied |
Definition at line 1273 of file MCContainers.hpp.
bool MCIsConsistentTable | ( | V & | table | ) |
Check the consistency of a table.
table | Table |
Definition at line 630 of file MCContainers.hpp.
bool MCIsDoubleInfinity | ( | const double | value | ) |
Check a value for double infinity.
value | Value to be checked |
Definition at line 132 of file MCDefs.cpp.
bool MCIsFloatInfinity | ( | const float | value | ) |
Check a value for float infinity.
value | Value to be checked |
Definition at line 122 of file MCDefs.cpp.
int MCItemCountInContainer | ( | const U & | container, |
const T | item | ||
) |
Calculate the number of a given item in a container.
container | Container |
item | Item to be counted |
Definition at line 1028 of file MCContainers.hpp.
int MCItemCountInTable | ( | const V & | table, |
const T | item | ||
) |
Calculate the number of a given item in a table.
table | Table |
item | Item to be counted |
Definition at line 1055 of file MCContainers.hpp.
std::vector<int> MCItemIndicesInContainer | ( | const U & | container, |
const T | item | ||
) |
Get item indices in a container.
container | Container |
item | Item to be found |
Definition at line 912 of file MCContainers.hpp.
std::vector<T> MCItemsByIndicesFromContainer | ( | const U & | container, |
std::vector< int > | indices | ||
) |
Get items by indices from a container.
container | Container |
indices | Indices |
Definition at line 940 of file MCContainers.hpp.
const T MCMax | ( | const U & | container | ) |
Get the maximal value of a container.
container | Container |
Definition at line 82 of file MCContainers.hpp.
const T& MCMax | ( | const T & | a, |
const T & | b | ||
) |
Get the maximum of two values.
a | First value |
b | Second value |
Definition at line 507 of file MCDefs.hpp.
void MCMergeContainers | ( | U & | target, |
const U & | other | ||
) |
Merge two containers.
target | Target container |
other | Other container |
Definition at line 896 of file MCContainers.hpp.
const T MCMin | ( | const U & | container | ) |
Get the minimal value of a container.
container | Container |
Definition at line 56 of file MCContainers.hpp.
const T& MCMin | ( | const T & | a, |
const T & | b | ||
) |
Get the minimum of two values.
a | First value |
b | Second value |
Definition at line 489 of file MCDefs.hpp.
void MCMultiplyContainer | ( | U & | container, |
T | multiplier | ||
) |
Multiple a container by a value.
container | Container |
multiplier | Multiplier |
Definition at line 543 of file MCContainers.hpp.
void MCMultiplyTable | ( | V & | table, |
T | multiplier | ||
) |
Multiply table by value.
table | Table |
multiplier | Multiplier |
Definition at line 758 of file MCContainers.hpp.
void MCMultiplyTableColumn | ( | V & | table, |
unsigned int | column_index, | ||
T | multiplier | ||
) |
Multiple table column by a value.
table | Table |
column_index | Column index |
multiplier | Multiplier |
Definition at line 730 of file MCContainers.hpp.
void MCMultiplyTableRow | ( | V & | table, |
unsigned int | row_index, | ||
T | multiplier | ||
) |
Multiple table row by a value.
table | Table |
row_index | Row index |
multiplier | Multiplier |
Definition at line 701 of file MCContainers.hpp.
U MCNthItemsFromContainer | ( | const U & | container, |
unsigned int | n_th, | ||
unsigned int | period | ||
) |
Get items from n-th indexes of a container.
container | Container |
n_th | Nth items of a period to be extracted |
period | Period |
The container indexes are incremented by one (index 0 -> 1, 1 -> 2 etc).
Definition at line 1084 of file MCContainers.hpp.
void MCPrintContainerAsFloats | ( | U & | container, |
const std::string & | message = "" , |
||
unsigned int | digits = 2 |
||
) |
Print a container to the output as float numbers.
container | Container |
message | Message to be printed before the table |
digits | Printed digits |
Definition at line 1770 of file MCContainers.hpp.
void MCPrintContainerAsInts | ( | U & | container, |
const std::string & | message = "" |
||
) |
Print a container to the output as integer numbers.
container | Container |
message | Message to be printed before the table |
Definition at line 1799 of file MCContainers.hpp.
void MCPrintTableAsFloats | ( | V & | table, |
const std::string & | message = "" , |
||
unsigned int | digits = 2 |
||
) |
Print a table to the output as float numbers.
table | Table |
message | Message to be printed before the table |
digits | Printed digits |
Definition at line 1828 of file MCContainers.hpp.
void MCPrintTableAsInts | ( | V & | table, |
const std::string & | message = "" |
||
) |
Print a table to the output as integer numbers.
table | Table |
message | Message to be printed before the table |
Definition at line 1866 of file MCContainers.hpp.
MC::StringList MCQStringListToStdStrings | ( | const QStringList & | string_list | ) |
Convert a QStringList to std::string vector.
string_list | A QString vector |
Definition at line 38 of file MCContainers.cpp.
std::vector<std::vector<T> > MCQVectorTableToStdVectorTable | ( | const QVector< QVector< T > > & | table | ) |
Convert QVector based table to std::vector based table.
table | QVector based table |
Definition at line 131 of file MCContainers.hpp.
T MCRand | ( | const T & | min, |
const T & | max | ||
) |
Get a random number generated with standard calls.
min | Minimum value of the range |
max | Maximum value of the range |
Definition at line 248 of file MCDefs.hpp.
T MCRandComplex | ( | const T & | min, |
const T & | max | ||
) |
Get a random number generated with an advanced algorithm.
min | Minimum value of the range |
max | Maximum value of the range |
Definition at line 230 of file MCDefs.hpp.
int MCRandSign | ( | ) |
bool MCRangeCheck | ( | const T & | value, |
const T & | min, | ||
const T & | max | ||
) |
Range check of a value.
value | Value |
min | Minimum of the range |
max | Maximum of the range |
Definition at line 544 of file MCDefs.hpp.
bool MCRemoveDirectory | ( | const QString & | dir_str | ) |
Remove a directory with its content.
dir_str | Directory string |
Definition at line 370 of file MCDefs.cpp.
void MCReplaceItemInContainer | ( | U & | container, |
const T | item, | ||
const T | new_value | ||
) |
Replace an item in a container.
container | Container |
item | Item to be replaced |
new_value | New value for the replaced item |
Definition at line 1107 of file MCContainers.hpp.
void MCRescaleTablePerColumnsByMinMax | ( | V & | table, |
const std::vector< std::vector< float > > & | min_max_table | ||
) |
Rescale a table per column by minimum-maximum.
table | Table to be normalized |
min_max_table | Minimums and maximums table for columns |
Definition at line 1510 of file MCContainers.hpp.
void MCRescaleTablePerRowByRowLength | ( | V & | table | ) |
Rescale a table per row by "row length".
table | Table to be normalized |
Definition at line 1557 of file MCContainers.hpp.
void MCRescaleVectorByLength | ( | U & | vector | ) |
Rescale a vector by "row length".
vector | Vector to be normalized |
Definition at line 1535 of file MCContainers.hpp.
void MCRescaleVectorByMinMax | ( | U & | vector, |
const std::vector< std::vector< float > > & | min_max_table | ||
) |
Rescale a vector by minimum-maximum.
vector | Vector to be normalized |
min_max_table | Minimums and maximums table for each element |
Definition at line 1485 of file MCContainers.hpp.
float MCRound | ( | float | number | ) |
Round a float number.
number | Number to be rounded |
If the fraction is .5 or lower then it rounds down otherwise up.
Definition at line 142 of file MCDefs.cpp.
float MCScaleValue | ( | float | value, |
float | min, | ||
float | max, | ||
float | new_max | ||
) |
Scale a value to a new range.
value | Value to be scaled |
min | Minimum |
max | Maximum |
new_max | New maximal value of the range |
Definition at line 154 of file MCDefs.cpp.
T MCSearchMaximalValue | ( | const U & | container | ) |
Search the maximal value in a container.
container | Container |
Definition at line 1216 of file MCContainers.hpp.
std::pair<int, T> MCSearchMaximalValueWithIndex | ( | const U & | container | ) |
Search the maximal value in a container.
container | Container |
Definition at line 1161 of file MCContainers.hpp.
T MCSearchMinimalValue | ( | const U & | container | ) |
Search the minimal value in a container.
container | Container |
Definition at line 1191 of file MCContainers.hpp.
std::pair<int, T> MCSearchMinimalValueWithIndex | ( | const U & | container | ) |
Search the minimal value in a container.
container | Container |
Definition at line 1131 of file MCContainers.hpp.
void MCShiftContainerbyValue | ( | U & | container, |
T | shift_value | ||
) |
Shift container values.
container | Container |
shift_value | Shift value |
Definition at line 657 of file MCContainers.hpp.
void MCSleep | ( | unsigned int | msecs | ) |
void MCStandardizeTablePerColumns | ( | V & | table, |
const std::vector< std::vector< float > > & | mean_stdev_table | ||
) |
Standardize a table per column.
table | Table to be normalized |
mean_stdev_table | Mean and standard deviation table for columns |
Definition at line 1412 of file MCContainers.hpp.
void MCStandardizeVector | ( | U & | vector, |
const std::vector< std::vector< float > > & | mean_stdev_table | ||
) |
Standardize a vector.
vector | Vector to be normalized |
mean_stdev_table | Mean and standard deviation table for each elements |
Definition at line 1387 of file MCContainers.hpp.
QStringList MCStdStringsToQStringList | ( | const MC::StringList & | string_list | ) |
Convert a std::string vector to QStringList.
string_list | Std string vector |
Definition at line 26 of file MCContainers.cpp.
T MCStrConvert | ( | const std::string & | str | ) |
Convert a string to an other type with std::stringstream.
str | String to be converted |
Definition at line 380 of file MCDefs.hpp.
void MCSumContainers | ( | U & | target_container, |
const U & | second_container, | ||
T | multiplier | ||
) |
Summarize containers.
target_container | Target container |
second_container | Second source container |
multiplier | Multiplier to apply to the second container elements before summing |
Summarizes two containers into a target container. If the target container is empty the second container is just cloned.
Definition at line 564 of file MCContainers.hpp.
void MCSumTables | ( | V & | target_table, |
const V & | second_table, | ||
T | multiplier | ||
) |
Summarize tables.
target_table | Target table |
second_table | Second source table |
multiplier | Multiplier to apply to the second table elements before summing |
Summarizes two tables into the target table. If the target table is empty the second table is just cloned.
Definition at line 785 of file MCContainers.hpp.
void MCSwapTableColumns | ( | V & | table, |
unsigned int | column1, | ||
unsigned int | column2 | ||
) |
Swap two columns inside a table.
table | Table |
column1 | First column to be swapped |
column2 | Second column to be swapped |
Definition at line 822 of file MCContainers.hpp.
std::string MCToStr | ( | const T | value, |
bool | hex_manipulator = false |
||
) |
Convert an other type to string with std::stringstream.
value | Value to be converted |
hex_manipulator | Whenever the hex manipulator should be used for the conversion |
Definition at line 360 of file MCDefs.hpp.
U MCUniqueItemsFromContainer | ( | const U & | container | ) |
Get unique items from a container.
container | Container |
Definition at line 970 of file MCContainers.hpp.