Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
IndividualMiniprojectC++/.vscode/
IndividualMiniprojectC++/external_libraries/boost_1_85_0
IndividualMiniprojectC++/external_libraries/Crow-1.2.0-Darwin
IndividualMiniprojectC++/external_libraries/boost_1_86_0
IndividualMiniprojectC++/external_libraries/Crow-1.2.0
IndividualMiniprojectC++/build/*
build/*
!IndividualMiniprojectC++/build/README.txt
!IndividualMiniprojectC++/external_libraries/README.txt
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "C/C++: clang build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "C/C++: clang build active file"
}
],
"version": "2.0.0"
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cmake.sourceDirectory": "/Users/virgilemison/Documents/Columbia/Fall24/adv_swe/4156-Miniproject-2024-Students-Cplusplus/IndividualMiniprojectC++",
"files.associations": {
"string": "cpp"
}
}
50 changes: 50 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang build active file",
"command": "/usr/bin/clang",
"args": [
"-fcolor-diagnostics",
"-fansi-escape-codes",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "Task generated by Debugger."
},
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-fcolor-diagnostics",
"-fansi-escape-codes",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
Binary file modified IndividualMiniprojectC++/.DS_Store
Binary file not shown.
11 changes: 5 additions & 6 deletions IndividualMiniprojectC++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)

project(IndividualMiniproject)

set(INCLUDE_PATHS external_libraries/boost_1_85_0 external_libraries/Crow-1.2.0-Darwin/include)
set(INCLUDE_PATHS external_libraries/boost_1_86_0 external_libraries/Crow-1.2.0/include)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand All @@ -19,9 +19,8 @@ add_executable(IndividualMiniproject

include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/ff233bdd4cac0a0bf6e5cd45bda3406814cb2796.zip
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)

FetchContent_MakeAvailable(googletest)
Expand All @@ -30,7 +29,7 @@ FetchContent_MakeAvailable(googletest)
target_include_directories(IndividualMiniproject PUBLIC
${INCLUDE_PATHS}
include
/opt/homebrew/Cellar/asio/1.30.2/include
/usr/local/Cellar/asio/1.30.2/include
)

target_link_libraries(IndividualMiniproject PRIVATE
Expand All @@ -52,7 +51,7 @@ add_executable(IndividualMiniprojectTests
target_include_directories(IndividualMiniprojectTests PRIVATE
${INCLUDE_PATHS}
include
/opt/homebrew/Cellar/asio/1.30.2/include
/usr/local/Cellar/asio/1.30.2/include
)

target_link_libraries(IndividualMiniprojectTests PRIVATE
Expand Down
Binary file not shown.
17 changes: 10 additions & 7 deletions IndividualMiniprojectC++/include/Course.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
// Copyright 2024 vcm2114
#include <string>
#ifndef COURSE_H
#define COURSE_H

#ifndef _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_COURSE_H_
#define _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_COURSE_H_

class Course {
private:
private:
int enrollmentCapacity;
int enrolledStudentCount;
std::string courseLocation;
std::string instructorName;
std::string courseTimeSlot;

public:
Course(int count, const std::string &instructorName, const std::string &courseLocation, const std::string &timeSlot);

public:
Course(int count, const std::string &instructorName,
const std::string &courseLocation, const std::string &timeSlot);
Course();

std::string getCourseLocation() const;
Expand All @@ -32,4 +35,4 @@ class Course {
void deserialize(std::istream& in);
};

#endif
#endif // _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_COURSE_H_"
13 changes: 6 additions & 7 deletions IndividualMiniprojectC++/include/Department.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Copyright 2024 vcm2114
#include <string>
#include <map>
#include "Course.h"
#ifndef DEPARTMENT_H
#define DEPARTMENT_H
#ifndef _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_DEPARTMENT_H_
#define _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_DEPARTMENT_H_

#include <map>
#include <string>
#include <memory>

class Department {
public:
public:
Department(std::string deptCode, std::map<std::string, std::shared_ptr<Course>> courses,
std::string departmentChair, int numberOfMajors);

Expand All @@ -27,7 +26,7 @@ class Department {
std::string getDepartmentChair() const;
std::map<std::string, std::shared_ptr<Course>> getCourseSelection() const;

private:
private:
int numberOfMajors;
std::string deptCode;
std::string departmentChair;
Expand All @@ -36,4 +35,4 @@ class Department {



#endif
#endif // _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_DEPARTMENT_H_"
9 changes: 5 additions & 4 deletions IndividualMiniprojectC++/include/Globals.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright 2024 vcm2114
#include "MyFileDatabase.h"

#ifndef GLOBALS_H
#define GLOBALS_H
#ifndef _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_GLOBALS_H_
#define _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_GLOBALS_H_

extern MyFileDatabase* globalDatabase;
extern MyFileDatabase* globalDatabase;


#endif
#endif // _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_GLOBALS_H_"
11 changes: 6 additions & 5 deletions IndividualMiniprojectC++/include/MyApp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifndef MYAPP_H
#define MYAPP_H
// Copyright 2024 vcm2114
#ifndef _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_MYAPP_H_
#define _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_MYAPP_H_

#include <string>
#include <map>
Expand All @@ -8,18 +9,18 @@
#include "MyFileDatabase.h"

class MyApp {
public:
public:
static void run(const std::string& mode);
static void onTermination();
static void overrideDatabase(MyFileDatabase* testData);
static MyFileDatabase* getDatabase();

private:
private:
static void setupDatabase();
static void resetDataFile();

static MyFileDatabase* myFileDatabase;
static bool saveData;
};

#endif
#endif // _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_MYAPP_H_"
13 changes: 7 additions & 6 deletions IndividualMiniprojectC++/include/MyFileDatabase.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
// Copyright 2024 vcm2114
#include "Department.h"
#include <map>
#include <string>

#ifndef MYFILEDATABASE_H
#define MYFILEDATABASE_H
#ifndef _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_MYFILEDATABASE_H_
#define _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_MYFILEDATABASE_H_

class MyFileDatabase {
public:
public:
MyFileDatabase(int flag, const std::string& filePath);

void setMapping(const std::map<std::string, Department>& mapping);
void saveContentsToFile() const;
void deSerializeObjectFromFile();

std::map<std::string, Department> getDepartmentMapping() const;
std::string display() const;

private:
private:
std::map<std::string, Department> departmentMapping;
std::string filePath;
};

#endif
#endif // _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_MYFILEDATABASE_H_"
47 changes: 24 additions & 23 deletions IndividualMiniprojectC++/include/RouteController.h
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
#ifndef ROUTECONTROLLER_H
#define ROUTECONTROLLER_H
// Copyright 2024 vcm2114
#ifndef _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_ROUTECONTROLLER_H_
#define _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_ROUTECONTROLLER_H_

#include "crow.h"
#include "../external_libraries/Crow-1.2.0/include/crow.h"
#include "Globals.h"
#include "MyFileDatabase.h"

class RouteController {
private:
private:
MyFileDatabase* myFileDatabase;

public:
void initRoutes(crow::App<>& app);
public:
void initRoutes(const crow::App<>& app);
void setDatabase(MyFileDatabase* db);

void index(crow::response& res);
void retrieveDepartment(const crow::request& req, crow::response& res);
void retrieveCourse(const crow::request& req, crow::response& res);
void isCourseFull(const crow::request& req, crow::response& res);
void getMajorCountFromDept(const crow::request& req, crow::response& res);
void identifyDeptChair(const crow::request& req, crow::response& res);
void findCourseLocation(const crow::request& req, crow::response& res);
void findCourseInstructor(const crow::request& req, crow::response& res);
void findCourseTime(const crow::request& req, crow::response& res);
void addMajorToDept(const crow::request& req, crow::response& res);
void removeMajorFromDept(const crow::request& req, crow::response& res);
void setEnrollmentCount(const crow::request& req, crow::response& res);
void setCourseLocation(const crow::request& req, crow::response& res);
void setCourseInstructor(const crow::request& req, crow::response& res);
void setCourseTime(const crow::request& req, crow::response& res);
void dropStudentFromCourse(const crow::request&, crow::response& res);
void index(const crow::response& res);
void retrieveDepartment(const crow::request& req, const crow::response& res);
void retrieveCourse(const crow::request& req, const crow::response& res);
void isCourseFull(const crow::request& req, const crow::response& res);
void getMajorCountFromDept(const crow::request& req, const crow::response& res);
void identifyDeptChair(const crow::request& req, const crow::response& res);
void findCourseLocation(const crow::request& req, const crow::response& res);
void findCourseInstructor(const crow::request& req, const crow::response& res);
void findCourseTime(const crow::request& req, const crow::response& res);
void addMajorToDept(const crow::request& req, const crow::response& res);
void removeMajorFromDept(const crow::request& req, const crow::response& res);
void setEnrollmentCount(const crow::request& req, const crow::response& res);
void setCourseLocation(const crow::request& req, const crow::response& res);
void setCourseInstructor(const crow::request& req, const crow::response& res);
void setCourseTime(const crow::request& req, const crow::response& res);
void dropStudentFromCourse(const crow::request&, const crow::response& res);
};

#endif
#endif // _USERS_VIRGILEMISON_DOCUMENTS_COLUMBIA_FALL24_ADV_SWE_4156_MINIPROJECT_2024_STUDENTS_CPLUSPLUS_INDIVIDUALMINIPROJECTCPP_INCLUDE_ROUTECONTROLLER_H_"
Loading
Loading