course.h 3.44 KB
Newer Older
1 2
#ifndef SRC_COURSE_H_
#define SRC_COURSE_H_
3 4

#include <vector>
Alexis Lebis's avatar
Alexis Lebis committed
5
#include <utility>
6

7
#include "competency.h"
8 9 10 11 12 13 14 15 16 17 18 19 20

/**
 * Represents a course in an academic structure.
 * 
 * Based on a non exhaustive WiP standard from APACHES project. It includes several element of a french course teached in universities.
 * This representation is subject to change.
 * 
 * @author alexis.lebis
 * @version 1 
 */
class Course
{
    private:
Alexis Lebis's avatar
Alexis Lebis committed
21
        // === COMPETENCIES RELATED
22
        
Alexis Lebis's avatar
Alexis Lebis committed
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
        std::vector<Competency> _prerequisites;

        /** weightTeached represents how a compentency i is teached. This means that a competency i is transfered to a student with a weight w (a double). A course has a vector of competency, each one with a specific weight.
         */
        std::vector<std::pair<Competency,double>> _weightedTeached;
        // std::vector<Competency> teached;
        // std::vector<double> diffusionWeight;
        
        // === OTHER
        /// European Credit Transfer and Accumulation System
        int _ects;
        /** Timeframe availablity of a course.
         *  @note For now, it discretiez time into semester
         *  @version 1.0
         */ 
        std::vector<int> _temporalAvailability;
        std::string _name;
        int _id;
41

42 43 44 45 46 47
        // === FUNC
        /// _duplicataProtection returns true if the value (2nd param) searched into (1st param) is found
        bool _duplicataProtection(std::vector<int> *, int);
        bool _duplicataProtection(std::vector<Competency> *, Competency);
        bool _duplicataProtection(std::vector<std::pair<Competency,double>> *, Competency);

48 49
        // Static
        static int COURSE_COUNTER;
Alexis Lebis's avatar
Alexis Lebis committed
50 51 52 53 54
        static int assignID();

        // Constructor
        //Course();
        Course(int id, int ects, std::string name);
55
    public:
Alexis Lebis's avatar
Alexis Lebis committed
56 57 58 59 60 61 62
        static Course build(int ects = 0, std::string name = "");

        // === GETTER
        const int id() const{return this->_id;};
        const std::string name() const{return this->_name;};
        const int ects() const{return this->_ects;}
        const std::vector<Competency> prerequisites() const {return this->_prerequisites;}
63
        const std::vector<int> timeFrame() const {return this->_temporalAvailability;}
Alexis Lebis's avatar
Alexis Lebis committed
64 65 66 67 68

        // === MUTATOR
            // SETTER
            void setECTS(int ects);
            void setName(std::string);
69 70 71
            void setAvailabilities(std::vector<int>&);
            void setPrerequisites(std::vector<Competency>&);
            void setTeachedComps(std::vector<std::pair<Competency,double>>&);
Alexis Lebis's avatar
Alexis Lebis committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89

            // ADDER
            void addTeachedComp(std::pair<Competency,double>);
            void addPrerequisite(Competency);
            void addTemporalFrame(int);

            // DELETER
            /// rmPrerequisite return a pointer to the removed competency from the _prerequisite, or NULL if not found.
            Competency * rmPrerequisite(Competency);
            /// rmTeachedComp removes the given Competency. It returns a pointer to the std::pair<Competency,double> removed in _weightedTeached, or NULL.
            std::pair<Competency,double> * rmTeachedComp(Competency);
            /// rmTemporalFrame removes the temporal frame stored at the index. It returns the value or NULL;
            int* rmTemporalFrameIndex(int index);
            int* rmTemporalFrameValue(int value);
        
        // === FUNC
            void fixECTS();

90 91
};

Alexis Lebis's avatar
Alexis Lebis committed
92 93
// === OPERATOR
std::ostream & operator<<(std::ostream& Stream, const Course & c);
94 95 96



97
#endif // SRC_COURSE_H_