Timetabler
Functions
utils.h File Reference
#include <string>
#include <vector>
#include "data.h"
#include "global.h"
#include "mtl/Vec.h"
Include dependency graph for utils.h:

Go to the source code of this file.

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, int 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 (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...
 

Function Documentation

template<typename T >
std::vector<T> Utils::convertVecDataToVector ( T *  data,
int  size 
)

Converts given data and size, a NSPACE::vec to a std::vector.

Parameters
dataThe data pointer
[in]sizeThe size
Template Parameters
TThe type of the vec
Returns
The resultant vector
template<typename T >
vec<T> Utils::convertVectorToVec ( std::vector< T >  inputs)

Converts a std::vector to a NSPACE::vec.

Parameters
[in]inputsThe input vector
Template Parameters
TThe type of the vector
Returns
The resultant vec
template<typename T >
std::vector<T> Utils::convertVecToVector ( vec< T >  inputs)

Converts a NSPACE::vec to a std::vector.

Parameters
[in]inputsThe input vec
Template Parameters
TThe type of the vec
Returns
The resultant vector
template<typename T >
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.

Parameters
[in]inputsThe input vector
Template Parameters
TThe type of the vector
Returns
The resultant vector
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.

This is done by concatenating all the rows.

Parameters
[in]inputsThe input vector
Template Parameters
TThe type of the vector
Returns
The resultant vector
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.

Parameters
[in]fieldTypeThe FieldType member
[in]indexThe index
dataThe Data object
Returns
The field name as a string
std::string Utils::getFieldTypeName ( FieldType  fieldType)

Gets the field type name as a string.

For example, the name of FieldType::instructor is "Instructor".

Parameters
[in]fieldTypeThe FieldType member
Returns
The field type name.
std::string Utils::getPredefinedConstraintName ( PredefinedClauses  clauseType)

Gets the predefined constraint name as a string.

For example, the name of PredefinedClauses::instructorSingleCourseAtATime is "instructorSingleCourseAtATime".

Parameters
[in]clauseTypeThe PredefinedClauses member
Returns
The predefined constraint name.