repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
ROBOTIS-Kayman/decision_making
decision_making_examples/src/fsm/WanderingEvents.cpp
<filename>decision_making_examples/src/fsm/WanderingEvents.cpp /* * Filename: WanderingEvents.cpp * Author: <NAME> * Date: Jan 8, 2014 * * The MIT License (MIT) * * Copyright (c) 2014 Cogniteam Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and a...
ROBOTIS-Kayman/decision_making
decision_making/src/TAOExample.cpp
//============================================================================ // Name : DMExample.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include...
ROBOTIS-Kayman/decision_making
decision_making/src/BTExample.cpp
<gh_stars>10-100 #include <iostream> #include <boost/thread.hpp> #include <deque> #include <vector> #include <boost/thread/mutex.hpp> #include <boost/thread/condition.hpp> #include <boost/shared_ptr.hpp> using namespace std; #include "SynchCout.h" #include "EventSystem.h" using namespace decision_making; EventQueu...
ROBOTIS-Kayman/decision_making
decision_making_parser/src/FSMConstructor_for_Dot.cpp
/* * FSMConstructor.cpp * * Created on: Nov 29, 2013 * Author: dan */ #include "FSMConstructor.h" #include "ParserExceptions.h" #include <fstream> #define XML( X ) out<<o.tab<<#X<<endl #define CML( X ) out<<o.tab<<X<<endl #define S( X ) <<#X namespace fsm_constructor{ using namespace std; std::ostream&...
ROBOTIS-Kayman/decision_making
decision_making/src/multifiles/HybridExample.cpp
#include <iostream> #include <boost/thread.hpp> #include <deque> #include <vector> #include <boost/thread/mutex.hpp> #include <boost/thread/condition.hpp> #include <boost/shared_ptr.hpp> using namespace std; #include <SynchCout.h> #include <EventSystem.h> using namespace decision_making; EventQueue mainEventQu...
ROBOTIS-Kayman/decision_making
decision_making_parser/src/Constructors.cpp
/* * Constructors.cpp * * Created on: Nov 28, 2013 * Author: dan */ #include "FSMConstructor.h" #include "BTConstructor.h" namespace fsm_constructor{ std::string FSMConstructor::copy(std::string name)const{ std::stringstream s; s<<fsms.at(name); return s.str(); } void FSMConstructor::saveXml(std::ostr...
ROBOTIS-Kayman/decision_making
decision_making/src/RosExample.cpp
<reponame>ROBOTIS-Kayman/decision_making //#include <iostream> // // //#include <boost/thread.hpp> //#include <deque> //#include <vector> //#include <boost/thread/mutex.hpp> //#include <boost/thread/condition.hpp> //#include <boost/shared_ptr.hpp> using namespace std; #include "SynchCout.h" #include "BT.h" #includ...
ROBOTIS-Kayman/decision_making
decision_making_parser/src/Parsers_TAO.cpp
/* * Filename: Parser_TAO.cpp * Author: <NAME> * Date: Dec 18, 2013 * * The MIT License (MIT) * * Copyright (c) 2013 Cogniteam Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the S...
ROBOTIS-Kayman/decision_making
decision_making_examples/src/Turnstile.cpp
#include <ros/ros.h> #include <decision_making/SynchCout.h> #include <decision_making/BT.h> #include <decision_making/FSM.h> #include <decision_making/ROSTask.h> #include <decision_making/DecisionMaking.h> using namespace std; using namespace decision_making; EventQueue* mainEventQueue; struct MainEventQueue{ MainE...
ROBOTIS-Kayman/decision_making
decision_making_examples/src/bt/Example1.cpp
/* * Filename: Example1.cpp * Author: <NAME> * Date: Jan 8, 2014 * * The MIT License (MIT) * * Copyright (c) 2014 Cogniteam Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Soft...
ROBOTIS-Kayman/decision_making
decision_making_examples/src/Wandering.cpp
/* * Filename: Wandering.cpp * Author: <NAME> * Date: Dec 16, 2013 * * The MIT License (MIT) * * Copyright (c) 2013 Cogniteam Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the So...
ROBOTIS-Kayman/decision_making
decision_making_parser/src/Parsers_BT.cpp
<filename>decision_making_parser/src/Parsers_BT.cpp // http://www.compileonline.com/compile_cpp0x_online.php #include <iostream> #include <fstream> #include <deque> #include "Tokenizer.h" #include "BTConstructor.h" #include "ParserExceptions.h" using bt_constructor::BTConstructor; template<class A, class B> std::str...
ROBOTIS-Kayman/decision_making
decision_making_examples/src/fsm/TurnstileEvents.cpp
/* * Filename: TurnstileEvents.cpp * Author: <NAME> * Date: Jan 7, 2014 * * The MIT License (MIT) * * Copyright (c) 2014 Cogniteam Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in t...
ROBOTIS-Kayman/decision_making
decision_making/src/HybridExample.cpp
#include <iostream> #include <boost/thread.hpp> #include <deque> #include <vector> #include <boost/thread/mutex.hpp> #include <boost/thread/condition.hpp> #include <boost/shared_ptr.hpp> using namespace std; #include <SynchCout.h> #include <EventSystem.h> using namespace decision_making; EventQueue mainEventQu...
ROBOTIS-Kayman/decision_making
decision_making/src/ROSTask.cpp
#include <ros/ros.h> #include <actionlib/client/simple_action_client.h> #include <actionlib/client/terminal_state.h> #include <robot_task/RobotTask.h> #include <robot_task/RobotTaskAction.h> #include <boost/filesystem.hpp> #include "ROSTask.h" using namespace std; using namespace robot_task; #include <fstream> na...
ROBOTIS-Kayman/decision_making
decision_making_parser/src/BTConstructor_for_Dot.cpp
<gh_stars>10-100 /* * BTConstructor.cpp * * Created on: Nov 29, 2013 * Author: dan */ #include "BTConstructor.h" #include <fstream> #include "ParserExceptions.h" namespace bt_constructor{ using namespace std; #define FOREACH_VEC(TYPE, VEC) for(std::vector<TYPE>::const_iterator i=o.VEC.begin();i!=o.VEC.en...
ROBOTIS-Kayman/decision_making
decision_making_parser/src/FSMConstructor.cpp
<reponame>ROBOTIS-Kayman/decision_making<gh_stars>10-100 /* * FSMConstructor.cpp * * Created on: Nov 29, 2013 * Author: dan */ #include "FSMConstructor.h" #include "ParserExceptions.h" #include <fstream> #define XML( X ) out<<o.tab<<#X<<endl #define CML( X ) out<<o.tab<<X<<endl #define S( X ) <<#X void ...
ROBOTIS-Kayman/decision_making
decision_making_examples/src/fsm/Turnstile.cpp
<gh_stars>10-100 #include <iostream> #include <ros/ros.h> #include <decision_making/SynchCout.h> #include <decision_making/BT.h> #include <decision_making/FSM.h> #include <decision_making/ROSTask.h> #include <decision_making/DecisionMaking.h> using namespace std; using namespace decision_making; FSM(Turnstile) { ...
ROBOTIS-Kayman/decision_making
robot_task/src/DummyTask.cpp
#ifndef __DUMMYTASK__HPP #define __DUMMYTASK__HPP #include <actionlib/server/simple_action_server.h> #include <robot_task/RobotTask.h> #include <robot_task/RobotTaskAction.h> using namespace std; using namespace robot_task; ostream& operator<<(ostream& o, std::vector<string>& s){ size_t s_size=s.size(); if(s_size>0...
ROBOTIS-Kayman/decision_making
decision_making_examples/src/hsm/ScxmlHierarchyExample.cpp
#include <ros/ros.h> #include <decision_making/SynchCout.h> #include <decision_making/BT.h> #include <decision_making/FSM.h> #include <decision_making/ROSTask.h> #include <decision_making/DecisionMaking.h> using namespace std; using namespace decision_making; EventQueue* mainEventQueue; struct MainEventQueue{ MainE...
ROBOTIS-Kayman/decision_making
decision_making_examples/src/Roomba.cpp
#include <ros/ros.h> #include <decision_making/SynchCout.h> #include <decision_making/BT.h> #include <decision_making/FSM.h> #include <decision_making/ROSTask.h> #include <decision_making/DecisionMaking.h> using namespace std; using namespace decision_making; EventQueue* mainEventQueue; struct MainEventQueue{ MainE...
ROBOTIS-Kayman/decision_making
decision_making_examples/src/fsm/Roomba.cpp
#include <iostream> #include <decision_making/SynchCout.h> #include <decision_making/BT.h> #include <decision_making/FSM.h> #include <decision_making/ROSTask.h> #include <decision_making/DecisionMaking.h> #include <ros/ros.h> #include <std_msgs/Bool.h> #include <sensor_msgs/Range.h> using namespace std; using namesp...
ROBOTIS-Kayman/decision_making
decision_making_parser/src/BTConstructor.cpp
<reponame>ROBOTIS-Kayman/decision_making /* * BTConstructor.cpp * * Created on: Nov 29, 2013 * Author: dan */ #include "BTConstructor.h" #include <fstream> #include "ParserExceptions.h" namespace bt_constructor{ using namespace std; #define FOREACH_VEC(TYPE, VEC) for(std::vector<TYPE>::const_iterator i=o...
srinivas-6/CppND-System-Monitor
src/system.cpp
<reponame>srinivas-6/CppND-System-Monitor #include <unistd.h> #include <cstddef> #include <set> #include <string> #include <vector> #include "process.h" #include "processor.h" #include "system.h" #include "linux_parser.h" using std::set; using std::size_t; using std::string; using std::vector; // TODO: Return the sy...
srinivas-6/CppND-System-Monitor
src/linux_parser.cpp
<gh_stars>0 #include <dirent.h> #include <unistd.h> #include <string> #include <vector> #include <iostream> #include <algorithm> #include "linux_parser.h" using std::stof; using std::string; using std::to_string; using std::vector; using std::stoi; // DONE: An example of how to read data from the filesystem string ...
srinivas-6/CppND-System-Monitor
src/processor.cpp
<reponame>srinivas-6/CppND-System-Monitor #include "processor.h" #include "linux_parser.h" #include <vector> #include <algorithm> #include <string> // This function Returns the aggregate CPU utilization float Processor::Utilization() { std::vector<std::string> cpu_string_data = LinuxParser::CpuUtilization(); ...
srinivas-6/CppND-System-Monitor
src/format.cpp
#include <string> #include "format.h" using std::string; // TODO: Complete this helper function // INPUT: Long int measuring seconds // OUTPUT: HH:MM:SS // REMOVE: [[maybe_unused]] once you define the function string Format::get_format(int t) { std::string time = std::to_string(t); if(time.length() < 2) { ...
Elendeer/homework
dataStructure/2nd(LinkedList)/byArray/src/main.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-09-15 13:14:03 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-09-15 13:22:14 * @Description : *********************************************/ #include <iostream> #include "./../inc/LinearList.hpp" int...
Elendeer/homework
operating_system/dynamic_partition_memory_management/main.cc
<reponame>Elendeer/homework /********************************************* * @Author : Daniel_Elendeer * @Date : 2021-04-26 19:29:57 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-05-27 20:46:57 * @Description : *********************************************/ #include <iostream> #include <...
Elendeer/homework
softwareDeveloping/reader/src/main.cc
/********************************************* * @Author : Daniel_Elendeer * @Date : 2021-09-18 10:21:35 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-09-18 16:49:21 * @Description : *********************************************/ #include "../inc/ReaderSystem.h" #include <iostream> //...
Elendeer/homework
dataStructure/CAnalyse/src/FileReader.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-12-30 15:50:09 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-01-03 20:13:54 * @Description : *********************************************/ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)...
Elendeer/homework
dataStructure/3rd(Stack&Queue)/Queue/src/Queue.cpp
<reponame>Elendeer/homework #include "../inc/Queue.hpp" #include <iostream> Queue::Queue() : m_head(0), m_tail(0) { if (!(m_queue = new int [101])) { std::cout << "Memory error" << std::endl; } std::cout << "Created" << std::endl; } Queue::~Queue() { delete [] m_queue; std::cout << "Destoryed" << std::endl; } ...
Elendeer/homework
AI/genetic_algorithm/src/chromosome.cc
<reponame>Elendeer/homework /********************************************* * @Author : Daniel_Elendeer * @Date : 2021-04-02 09:23:49 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-04-11 16:57:42 * @Description : *********************************************/ #include <iostream> #include <f...
Elendeer/homework
dataStructure/6th(Sorting)/select_sort.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2021-01-02 18:27:25 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-01-02 18:44:10 * @Description : *********************************************/ #include <iostream> #include <algorithm> using namespace s...
Elendeer/homework
dataStructure/4th(BinaryTree)/src/main.cpp
<reponame>Elendeer/homework<gh_stars>1-10 /********************************************* * @Author : Daniel_Elendeer * @Date : 2020-11-26 14:43:45 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-12-12 18:40:22 * @Description : *********************************************/ #include <iostre...
Elendeer/homework
dataStructure/2nd(LinkedList)/byArray/src/LinearList.cpp
<gh_stars>1-10 /********************************************* * @Author : Daniel_Elendeer * @Date : 2020-09-15 13:14:03 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-09-15 13:21:41 * @Description : *********************************************/ #include <iostream> #include "./../inc/Linea...
Elendeer/homework
softwareDeveloping/reader/src/UIDisplayer.cc
/********************************************* * @Author : Daniel_Elendeer * @Date : 2021-09-18 12:03:52 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-09-18 17:19:15 * @Description : *********************************************/ #include "../inc/UIDisplayer.h" #include <iostream> usin...
Elendeer/homework
dataStructure/6th(Sorting)/merge_sort.cpp
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int N = 1e5 + 10; int q[N]; int temp[N]; void merge_sort(int l, int r, int q[]) { if (l >= r) return ; int mid = (l + r) >> 1; merge_sort(l, mid, q); merge_sort(mid + 1, r, q); int i = l, j = mid + 1; int k = 0; while (i <...
Elendeer/homework
dataStructure/6th(Sorting)/insert_sort.cpp
<gh_stars>1-10 /********************************************* * @Author : Daniel_Elendeer * @Date : 2021-01-02 18:56:23 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-01-02 19:45:31 * @Description : *********************************************/ #include <iostream> #include <algorithm> u...
Elendeer/homework
dataStructure/5th(Graphic)/simplified_version/bfs.cpp
<reponame>Elendeer/homework /********************************************* * @Author : Daniel_Elendeer * @Date : 2020-12-22 20:14:10 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-12-22 22:39:42 * @Description : *********************************************/ #include <iostream> #include <...
Elendeer/homework
dataStructure/3rd(Stack&Queue)/appsOfStack/numberChange/main.cpp
<gh_stars>1-10 #include <iostream> #include "../../../template/Stack.hpp" int main() { using namespace std; int num; cout << "Enter a integer, put it in octal number system." << endl; cin >> num; Stack<int> s; while (num) { s.push(num % 8); num /= 8; } cout << "output: "; while (!s.empty()) { cout <<...
Elendeer/homework
dataStructure/6th(Sorting)/quick_sort.cpp
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int N = 1e5 + 10; int q[N]; void quick_sort(int q[], int l, int r) { if (l >= r) return ; int i = l - 1, j = r + 1, x = q[(l + r) >> 1]; while (i < j) { do ++ i; while (q[i] < x); do -- j; while (q[i] > x); if (i < j) {...
Elendeer/homework
dataStructure/1st/inc/Complex.hpp
<reponame>Elendeer/homework /********************************************* * @Author : Daniel_Elendeer * @Date : 2020-09-10 14:45:06 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-09-20 22:59:51 * @Description : *********************************************/ #ifndef _COMPLEX_HPP_ #define _...
Elendeer/homework
dataStructure/3rd(Stack&Queue)/appsOfStack/maze/main.cpp
#include <iostream> #include <vector> #include "../../../template/Stack.hpp" using namespace std; int mx[4] = {0, 0, -1, 1}, my[4] = {1, -1, 0, 0}; int total = 0; void dfs(vector<vector<int>> & maze, const pair<int, int> & exit, Stack<pair<int, int>> & s, int x, int y) { if (x == exit.first && y == exit.second...
Elendeer/homework
dataStructure/3rd(Stack&Queue)/Queue/inc/Queue.hpp
#ifndef __QUEUE_HPP__ #define __QUEUE_HPP__ class Queue { private: int * m_queue; int m_head, m_tail, m_size; public: Queue(); ~Queue(); bool push(int data); bool pop(); bool empty(); int size(); int front(); int back(); void print(); }; #endif
Elendeer/homework
dataStructure/3rd(Stack&Queue)/appsOfStack/parenthesesMatching/main.cpp
#include <iostream> #include "./../../../template/Stack.hpp" int main() { using namespace std; Stack<char> s; char c; c = getchar(); bool flag = true; while (c != '\n' && flag) { if (c == '(' || c == '[' || c == '{') { s.push(c); } else { switch (c) { case ')': while (!s.empty() && s.to...
Elendeer/homework
dataStructure/6th(Sorting)/bubble_sort.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2021-01-02 18:02:29 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-01-02 18:15:32 * @Description : *********************************************/ #include <iostream> using namespace std; const int N = 1e...
Elendeer/homework
softwareDeveloping/bookContext/test/test.cc
/********************************************* * @Author : Daniel_Elendeer * @Date : 2021-10-03 11:14:21 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-10-03 11:40:36 * @Description : *********************************************/ #include <cstdio> static int main_return = 0; static int t...
Elendeer/homework
dataStructure/2nd(LinkedList)/src/LinkedList.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-10-01 14:29:25 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-10-02 21:02:18 * @Description : *********************************************/ #include "./../inc/LinkedList.hpp" #include <iostream> /*...
Elendeer/homework
dataStructure/CAnalyse/src/main.cpp
#include "../inc/Analyzer.hpp" #include <iostream> int main (int argc, char * argv[]) { using namespace std; Analyzer analyzer; try { analyzer.readComArgs(argc, argv); analyzer.analyze(); } catch (string info) { cout << info << endl; } return 0; }
Elendeer/homework
dataStructure/1st/src/Complex.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-09-10 14:45:06 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-09-20 22:57:35 * @Description : *********************************************/ #include <iostream> #include "./../inc/Complex.hpp" Comple...
Elendeer/homework
dataStructure/5th(Graphic)/simplified_version/dijkstra.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-12-22 20:14:10 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-12-22 21:09:05 * @Description : *********************************************/ #include <iostream> #include <algorithm> #include <cstring>...
Elendeer/homework
dataStructure/3rd(Stack&Queue)/appsOfStack/calculator/src/Calculator.cpp
#include <iostream> #include "./../inc/Calculator.hpp" Calculator::Calculator() { } Calculator::~Calculator() { } // Read a number(double is fine). // It will not return false in fact. bool Calculator::readNum() { double num = (double)(m_current_char - '0'); m_current_char = getchar(); while ((m_current_char ...
Elendeer/homework
dataStructure/CAnalyse/src/Parser.cpp
<reponame>Elendeer/homework #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(NT) #define OS 0 #elif __linux__ #define OS 1 #endif #include <iostream> #include "../inc/Parser.hpp" void Parser::advance() { m_current_token = m_lexer.getNextToken(); } Parser::Parser(Lexer lexer) : m_lexer(le...
Elendeer/homework
dataStructure/3rd(Stack&Queue)/Stack/inc/Stack.hpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-10-10 09:37:07 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-10-13 13:21:23 * @Description : *********************************************/ #ifndef _STACK_HPP_ #define _STACK_HPP_ #include <iostrea...
Elendeer/homework
AI/genetic_algorithm/src/chromosome_set.cc
<filename>AI/genetic_algorithm/src/chromosome_set.cc /********************************************* * @Author : Daniel_Elendeer * @Date : 2021-04-04 08:48:23 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-04-11 16:58:42 * @Description : *********************************************/ #inclu...
Elendeer/homework
dataStructure/CAnalyse/src/win/isAbsPath.cpp
<reponame>Elendeer/homework /********************************************* * @Author : Daniel_Elendeer * @Date : 2020-12-30 20:51:19 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-12-30 20:55:57 * @Description : *********************************************/ #if defined(WIN32) || defined(...
Elendeer/homework
dataStructure/CAnalyse/test/main.cpp
<gh_stars>1-10 #include <iostream> #include <string> #include <vector> using namespace std; /********************************************* * enum types, reflections & constants *********************************************/ // Enum type to record the type of a token. enum class TokenType { NONE, // Reserved...
Elendeer/homework
dataStructure/6th(Sorting)/heap.cpp
#include <iostream> #include <cstdio> using namespace std; const int N = 1e5 + 10; int h[N], idx; void down(int x) { int t = x; if (x * 2 <= idx && h[x * 2] < h[t]) { t = x * 2; } if (x * 2 + 1 <= idx && h[x * 2 + 1] < h[t] ) { t = x * 2 + 1; } if (t != x) { swap(h[t], h[x]); down(t); } } void up(in...
Elendeer/homework
dataStructure/CAnalyse/src/Analyzer.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2021-01-01 15:17:45 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-01-01 21:20:56 * @Description : *********************************************/ #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__...
Elendeer/homework
dataStructure/5th(Graphic)/src/main.cpp
<gh_stars>1-10 #include <iostream> #include "../inc/Graphic.hpp" int main() { using namespace std; Graphic g(5); g.addEdge(1, 2); g.addEdge(1, 3); g.addEdge(2, 8); g.addEdge(1, 4); g.addEdge(5, 4); g.printAdjacencyTable(); return 0; }
Elendeer/homework
operating_system/demand_paging/demand_paging.cc
<gh_stars>1-10 #include <iostream> #include <vector> using namespace std; class Page { private: bool _is_in_memory; // if _is_in_memory is false, _block_no will be -1 int _block_no; bool _is_modified; // if _is_in_memory is true, _position_in_disk will be -1 int _position_in_disk; int _t; public: Page( b...
Elendeer/homework
dataStructure/2nd(LinkedList)/src/main.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-10-01 14:29:25 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-10-02 21:17:53 * @Description : *********************************************/ #include "./../inc/LinkedList.hpp" #include <iostream> in...
Elendeer/homework
operating_system/process_scheduling_algorithm/main.cpp
#include <iostream> #include <string> #include <list> using namespace std; // ===== ===== class Process { private: string _name; int _arrival_time, _served_time, _priority; // _time_tarting = -1 by default, means haven't start yet. int _time_remaining, _time_starting; public: Process(string name, int arriva...
Elendeer/homework
dataStructure/CAnalyse/test/TEST_3.cpp
/* * @Author: Elendeer * @Date: 2020-05-28 21:08:04 * @LastEditors: Elendeer * @LastEditTime: 2020-06-05 16:17:36 * @Description: file content */ #include <cmath> #include <iostream> class salesman { private: int m_num, m_quantity; double m_price; constexpr static double m_discount = 0.98; pu...
Elendeer/homework
AI/genetic_algorithm/main.cc
<filename>AI/genetic_algorithm/main.cc<gh_stars>1-10 #include <iostream> #include "./inc/chromosome_set.h" using namespace std; int main () { ChromosomeSet chromosome_set; chromosome_set.create(20); chromosome_set.write("g0.txt"); chromosome_set.generate(1); chromosome_set.write("g1.txt"); ...
Elendeer/homework
dataStructure/5th(Graphic)/inc/Graphic.hpp
#ifndef __GRAPHIC_HPP__ #define __GRAPHIC_HPP__ #include <vector> #include <list> class AdjNode { private: // Number of ending node of edge. int m_num; // Weight of edge. int m_weight; public: AdjNode(int num, int weight); ~AdjNode(); int getNum() const; int getWeight() const; }; class Graphic { private: /...
Elendeer/homework
dataStructure/CAnalyse/src/Controller.cpp
<reponame>Elendeer/homework<gh_stars>1-10 /********************************************* * @Author : Daniel_Elendeer * @Date : 2021-01-01 15:04:21 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-01-01 15:36:42 * @Description : *********************************************/ #include "../inc/...
Elendeer/homework
dataStructure/CAnalyse/inc/Parser.hpp
#ifndef __PARSER_HPP__ #define __PARSER_HPP__ #include "Lexer.hpp" #include <vector> class Parser { private : Lexer m_lexer; Token m_current_token; // m_last_token = m_current_token; // m_current_token = m_lexer.getNextToken(); void advance(); public : Parser(Lexer lexer); ~Parser(); std::vector<Token> par...
Elendeer/homework
dataStructure/CAnalyse/inc/Token.hpp
#ifndef __TOKEN_HPP__ #define __TOKEN_HPP__ enum class TokenType { NONE, ANY, NEWLINE, COMMENT, COMMENT_START, COMMENT_END, LPAREN, RPAREN, LBRACE, RBRACE, END }; class Token { private : TokenType m_type; public : Token(TokenType type = TokenType::NONE); ~Token(); // Return the type of the tok...
Elendeer/homework
dataStructure/2nd(LinkedList)/inc/LinkedList.hpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-10-01 14:29:25 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-10-02 21:17:07 * @Description : *********************************************/ #ifndef _LINKED_LIST_HPP_ #define _LINKED_LIST_HPP_ #incl...
Elendeer/homework
dataStructure/4th(BinaryTree)/src/Huffman.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-12-12 17:23:28 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-12-12 18:24:19 * @Description : *********************************************/ #include "../inc/Huffman.hpp" #include <queue> #include <ve...
Elendeer/homework
dataStructure/CAnalyse/inc/AddressParser.hpp
<gh_stars>1-10 /********************************************* * @Author : Daniel_Elendeer * @Date : 2020-12-30 15:50:09 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-01-01 16:49:21 * @Description : *********************************************/ #ifndef __ADDRESS_PARSER_HPP__ #define __AD...
Elendeer/homework
dataStructure/CAnalyse/src/Interpreter.cpp
<filename>dataStructure/CAnalyse/src/Interpreter.cpp #include "../inc/Interpreter.hpp" void Interpreter::advance() { ++ m_idx; } TokenType Interpreter::peekType() const { return m_tokenlist[m_idx + 1].getType(); } void Interpreter::multipleComment() { TokenType type = m_tokenlist[m_idx].getType(); while (type !=...
Elendeer/homework
dataStructure/template/test.cpp
#include <iostream> #include "./Stack.hpp" int main() { using namespace std; Stack<double> A = {1, 2.33, 99.54}; A.print(); A.pop(); A.print(); A.push(3.789); A.print(); if (!A.pop()) { cout << "Pop failed" << endl; } A.print(); cout << "size : " << A.size() << endl; if (!A.pop()) { cout << "Pop f...
Elendeer/homework
operating_system/banker_algorithm/bankerAlgorithm.cc
<gh_stars>1-10 #include <iostream> using namespace std; // ===== data structures needed ===== // set values according to topic requirement int max[][3] = { {7, 5, 3}, {3, 2, 2}, {9, 0, 2}, {2, 2, 2}, {4, 3, 3} }; int allocation[][3] = { {0, 1, 0}, {2, 0, 0}, {3, 0, 2}, {2, 1, 1}, {0, 0, 2} }; int need[][3]...
Elendeer/homework
dataStructure/CAnalyse/src/Lexer.cpp
<gh_stars>1-10 #include "../inc/Lexer.hpp" /***** Private functions *****/ void Lexer::advance() { ++ m_pos; if (m_pos > (int)m_text.size() - 1) { m_current_char = NOCHAR; } else { m_current_char = m_text[m_pos]; } } void Lexer::skipWhiteSpace() { advance(); } void Lexer::skipTab() { advance(); } char L...
Elendeer/homework
dataStructure/template/SingleLinkedList.hpp
<filename>dataStructure/template/SingleLinkedList.hpp /********************************************* * @Author : Daniel_Elendeer * @Date : 2020-10-01 14:29:25 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-10-02 21:03:53 * @Description : *********************************************/ #ifn...
Elendeer/homework
dataStructure/CAnalyse/inc/Lexer.hpp
#ifndef __LEXER_HPP__ #define __LEXER_HPP__ #include "./Token.hpp" #include <iostream> // Appointment: There is a NOCHAR in the end of string. const char NOCHAR = (char)0; class Lexer { private : std::string m_text; int m_pos; char m_current_char; // For skip any strange word that may exist in comment. bool m...
Elendeer/homework
dataStructure/3rd(Stack&Queue)/Stack/src/main.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-10-10 09:37:07 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-10-13 13:16:19 * @Description : *********************************************/ #include <iostream> #include "./../inc/Stack.hpp" int mai...
Elendeer/homework
dataStructure/CAnalyse/src/Token.cpp
<reponame>Elendeer/homework #include "../inc/Token.hpp" #include <iostream> Token::Token(TokenType type) : m_type(type) { } Token::~Token() { } TokenType Token::getType() const { return m_type; } void Token::printType() const { using std::cout; using std::endl; if (m_type == TokenType::NONE) { cout << "NONE"...
Elendeer/homework
dataStructure/CAnalyse/inc/Interpreter.hpp
<filename>dataStructure/CAnalyse/inc/Interpreter.hpp<gh_stars>1-10 #ifndef __INTERPRETER_HPP__ #define __INTERPRETER_HPP__ #include "./Parser.hpp" class Interpreter { private: Parser m_parser; int m_lines, m_empty_lines, m_comment_lines, m_functions; std::vector<Token> m_tokenlist; int m_idx; void advance(); ...
Elendeer/homework
dataStructure/3rd(Stack&Queue)/appsOfStack/lineEdit/test.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-10-13 13:00:24 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-10-31 21:00:00 * @Description : *********************************************/ #include <iostream> #include "./../../../template/Stack.hp...
Elendeer/homework
dataStructure/1st/src/main.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-09-10 14:45:06 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-09-20 23:02:19 * @Description : *********************************************/ #include <iostream> #include "./../inc/Complex.hpp" int ma...
Elendeer/homework
dataStructure/4th(BinaryTree)/src/BinaryTree.cpp
<gh_stars>1-10 #include "../inc/BinaryTree.hpp" #include <iostream> #include <queue> /**********************************************/ /****** Functions of BinaryTreeNode class *****/ /**********************************************/ Node::BinaryTreeNode() : m_data(0), m_left(nullptr), m_right(nullptr) { // std::cou...
Elendeer/homework
softwareDeveloping/reader/src/ReaderSystem.cc
/********************************************* * @Author : Daniel_Elendeer * @Date : 2021-09-18 15:31:05 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-09-18 17:21:31 * @Description : *********************************************/ #include "../inc/ReaderSystem.h" #include <fstream> usin...
Elendeer/homework
dataStructure/CAnalyse/inc/Analyzer.hpp
<filename>dataStructure/CAnalyse/inc/Analyzer.hpp /********************************************* * @Author : Daniel_Elendeer * @Date : 2021-01-01 14:55:26 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-01-01 18:00:37 * @Description : *********************************************/ #ifndef ...
Elendeer/homework
dataStructure/CAnalyse/test/TEST_2.cpp
<reponame>Elendeer/homework /********************************************* * @Author : Daniel_Elendeer * @Date : 2020-05-07 16:38:46 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-07-21 23:55:09 * @Description : *********************************************/ #include <iostream> #include <c...
Elendeer/homework
dataStructure/CAnalyse/src/GNU/getExecDirectory.cpp
<filename>dataStructure/CAnalyse/src/GNU/getExecDirectory.cpp /********************************************* * @Author : Daniel_Elendeer * @Date : 2020-12-30 15:56:11 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-12-30 16:45:36 * @Description : ********************************************...
Elendeer/homework
dataStructure/6th(Sorting)/radix_sort.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2021-01-02 21:05:18 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-01-02 23:49:42 * @Description : *********************************************/ #include <iostream> #include <algorithm> #include <cstring>...
Elendeer/homework
dataStructure/CAnalyse/src/GNU/isAbsPath.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-12-30 20:51:19 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-12-30 20:57:41 * @Description : *********************************************/ #ifdef __linux__ #include "../../inc/AddressParser.hpp" ...
Elendeer/homework
dataStructure/3rd(Stack&Queue)/appsOfStack/calculator/inc/Calculator.hpp
<reponame>Elendeer/homework #include "./../../../../template/Stack.hpp" class Calculator { private: Stack<double> m_nums; Stack<char> m_ops; char m_current_char; // Read a number(double is fine). // It will not return false in fact. bool readNum(); // Read a operator from the input. // It will not return f...
Elendeer/homework
dataStructure/2nd(LinkedList)/byArray/inc/LinearList.hpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-09-15 13:14:03 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-09-15 13:22:08 * @Description : *********************************************/ #ifndef __LINEAR_LIST__ #define __LINEAR_LIST__ class Lin...
Elendeer/homework
dataStructure/CAnalyse/test/TEST.cpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2019-08-20 19:59:11 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-12-26 22:09:41 * @Description : *********************************************/ #include <iostream> using namespace std; int main() { ...
Elendeer/homework
dataStructure/CAnalyse/src/win/isDir.cpp
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(NT) #include "../../inc/AddressParser.hpp" // For struct _stat and _stat(...). #include <sys/stat.h> bool AddressParser::isDir(string path) { struct _stat file_stat; if ((_stat(path.c_str(), &file_stat) == 0) && (file_stat.st_mode & _S_IFDI...
Elendeer/homework
dataStructure/3rd(Stack&Queue)/Queue/src/main.cpp
<reponame>Elendeer/homework #include <iostream> #include "../inc/Queue.hpp" int main() { using namespace std; Queue q; q.push(1); q.push(2); q.push(4); q.push(1); q.print(); cout << "Size : " << q.size() << endl; cout << "Pop" << endl; q.pop(); q.print(); cout << "Size : " << q.size() << endl; cout <...
Elendeer/homework
dataStructure/4th(BinaryTree)/inc/Huffman.hpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2020-12-12 17:23:28 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2020-12-12 18:28:37 * @Description : *********************************************/ #ifndef __HUFFMAN_HPP__ #define __HUFFMAN_HPP__ #include <...
Elendeer/homework
dataStructure/CAnalyse/src/GNU/getSubPaths.cpp
#ifdef __linux__ #include "../../inc/AddressParser.hpp" // For opendir(...). #include <sys/types.h> // For DIR #include <dirent.h> #include <cstring> using std::vector; using std::string; vector<string> AddressParser::getSubPaths(string dir_path) { vector<string> paths; DIR * p_dir = opendir(dir_path.c_str()); ...
Elendeer/homework
dataStructure/CAnalyse/inc/Controller.hpp
/********************************************* * @Author : Daniel_Elendeer * @Date : 2021-01-01 14:56:46 * @LastEditors : Daniel_Elendeer * @LastEditTime : 2021-01-01 15:35:36 * @Description : *********************************************/ #ifndef __CONTROLLER_HPP__ #define __CONTROLLER_HPP__ clas...
Elendeer/homework
dataStructure/CAnalyse/src/win/getSubPaths.cpp
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(NT) #include "../../inc/AddressParser.hpp" #include <direct.h> #include <io.h> using std::vector; using std::string; vector<string> AddressParser::getSubPaths(string dir_path) { _chdir(dir_path.c_str()); vector<string> paths; _find...