Timetabler
|
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include "data.h"
#include "global.h"
#include "mtl/Vec.h"
Go to the source code of this file.
Classes | |
class | Utils::Log |
Perform logging. More... | |
Macros | |
#define | LOG(x) Utils::Log(Utils::x) |
#define | LOG_DEBUG(x) Utils::Log(Utils::x, true) |
#define | LOG_FIXED(x) Utils::Log(Utils::x, false, 80) |
#define | LOG_FIXED_DEBUG(x) Utils::Log(Utils::x, true, 80) |
#define | DISPLAY() LOG(EMPTY) |
#define | DISPLAY_DEBUG() LOG_DEBUG(EMPTY) |
#define | DISPLAY_FIXED() LOG_FIXED(EMPTY) |
#define | DISPLAY_FIXED_DEBUG() LOG_FIXED_DEBUG(EMPTY) |
#define | DEBUG() LOG_DEBUG(INFO) |
Enumerations | |
enum | Utils::Severity { EMPTY = 0, ERROR = 1, WARNING = 2, INFO = 3 } |
Specify severity levels for logging. | |
enum | Utils::DisplayColour { NORMAL = 0, RED = 31, YELLOW = 33 } |
Define values for colours in ASCII, to be used when logging. | |
Functions | |
template<typename T > | |
vec< T > | Utils::convertVectorToVec (std::vector< T > inputs) |
Converts a std::vector to a NSPACE::vec. More... | |
template<typename T > | |
std::vector< T > | Utils::convertVecToVector (vec< T > inputs) |
Converts a NSPACE::vec to a std::vector. More... | |
template<typename T > | |
std::vector< T > | Utils::convertVecDataToVector (T *data, unsigned size) |
Converts given data and size, a NSPACE::vec to a std::vector. More... | |
template<typename T > | |
std::vector< T > | Utils::flattenVector (std::vector< std::vector< T >> inputs) |
Converts a two dimensional vector to a one dimensional vector. More... | |
template<typename T > | |
std::vector< T > | Utils::flattenVector (std::vector< std::vector< std::vector< T >>> inputs) |
Converts a three dimensional vector to a one dimensional vector. More... | |
std::string | Utils::getFieldTypeName (FieldType fieldType) |
Gets the field type name as a string. More... | |
std::string | Utils::getPredefinedConstraintName (const PredefinedClauses clauseType) |
Gets the predefined constraint name as a string. More... | |
std::string | Utils::getFieldName (FieldType fieldType, int index, Data &data) |
Gets the field name in the Data of a given FieldType at a given index. More... | |
std::vector<T> Utils::convertVecDataToVector | ( | T * | data, |
unsigned | size | ||
) |
Converts given data and size, a NSPACE::vec to a std::vector.
data | The data pointer | |
[in] | size | The size |
T | The type of the vec |
Definition at line 65 of file utils.h.
References Utils::convertVecDataToVector().
Referenced by Utils::convertVecDataToVector().
vec<T> Utils::convertVectorToVec | ( | std::vector< T > | inputs | ) |
Converts a std::vector to a NSPACE::vec.
[in] | inputs | The input vector |
T | The type of the vector |
Definition at line 28 of file utils.h.
References Utils::convertVectorToVec().
Referenced by Utils::convertVectorToVec().
std::vector<T> Utils::convertVecToVector | ( | vec< T > | inputs | ) |
Converts a NSPACE::vec to a std::vector.
[in] | inputs | The input vec |
T | The type of the vec |
Definition at line 46 of file utils.h.
References Utils::convertVecToVector().
Referenced by Utils::convertVecToVector().
std::vector<T> Utils::flattenVector | ( | std::vector< std::vector< T >> | inputs | ) |
Converts a two dimensional vector to a one dimensional vector.
This is done by concatenating all the rows.
[in] | inputs | The input vector |
T | The type of the vector |
Definition at line 85 of file utils.h.
References Utils::flattenVector().
Referenced by Utils::flattenVector().
std::vector<T> Utils::flattenVector | ( | std::vector< std::vector< std::vector< T >>> | inputs | ) |
Converts a three dimensional vector to a one dimensional vector.
This is done by concatenating all the rows.
[in] | inputs | The input vector |
T | The type of the vector |
Definition at line 106 of file utils.h.
References Utils::flattenVector(), Utils::getFieldName(), Utils::getFieldTypeName(), and Utils::getPredefinedConstraintName().
Gets the field name in the Data of a given FieldType at a given index.
[in] | fieldType | The FieldType member |
[in] | index | The index |
data | The Data object |
Definition at line 79 of file utils.cpp.
References Utils::getFieldName().
Referenced by Utils::flattenVector(), and Utils::getFieldName().
std::string Utils::getFieldTypeName | ( | FieldType | fieldType | ) |
Gets the field type name as a string.
For example, the name of FieldType::instructor is "Instructor".
[in] | fieldType | The FieldType member |
Definition at line 19 of file utils.cpp.
References Utils::getFieldTypeName().
Referenced by Utils::flattenVector(), and Utils::getFieldTypeName().
std::string Utils::getPredefinedConstraintName | ( | const PredefinedClauses | clauseType | ) |
Gets the predefined constraint name as a string.
For example, the name of PredefinedClauses::instructorSingleCourseAtATime is "instructorSingleCourseAtATime".
[in] | clauseType | The PredefinedClauses member |
Definition at line 40 of file utils.cpp.
References Utils::getPredefinedConstraintName().
Referenced by Utils::flattenVector(), and Utils::getPredefinedConstraintName().