Skip to content
Open

Dev #25

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ os: linux
compiler: gcc

before_install:
- sudo apt-get update -q
- sudo apt-get install cppcheck -y
- sudo apt-get install python2.7 -y
- sudo apt-get install valgrind -y
- sudo apt-get install gcov -y
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
- sudo apt-get update -q
- sudo apt-get install python3 -y
- sudo apt-get install g++-9 -y
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90
- sudo apt-get install libboost-all-dev -y
- CMAKE_VERSION=3.15.4
- CMAKE_VERSION_DIR=v3.15
- CMAKE_OS=Linux-x86_64
Expand All @@ -25,11 +22,14 @@ before_install:
- mkdir -p $CMAKE_DIR
- tar --strip-components=1 -xzf $CMAKE_TAR -C $CMAKE_DIR
- export PATH=$CMAKE_DIR/bin:$PATH
- sudo pip install flask
- sudo python ./serverAPI.py &


script:
- ./linters/run.sh --local
- mkdir build
- cd build
- cmake ../
- make
- ./test
- ./test
- bash <(curl -s https://codecov.io/bash)
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.15)
project(GProject)

configure_file(CMakeLists.txt.in
googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )
execute_process(COMMAND ${CMAKE_COMMAND} --build .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download )

add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
${CMAKE_BINARY_DIR}/googletest-build)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")

include_directories(include)

add_library(algorithm STATIC src/algorithm.cpp)

add_library(queu STATIC src/queue.cpp)

add_library(server STATIC src/server.cpp)

add_library(worker STATIC src/worker.cpp)


add_executable(test test/test.cpp src/worker.cpp src/algorithm.cpp src/server.cpp )

target_link_libraries(test gtest)
15 changes: 15 additions & 0 deletions CMakeLists.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.15)

project(googletest-download NONE)

include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.1
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# GProject
# GProject

[![Build Status](https://travis-ci.org/Sermelyan/GProject.svg?branch=template)](https://travis-ci.org/Sermelyan/GProject)

54 changes: 54 additions & 0 deletions include/algorithm.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2019 <Alex>
*/


#include <boost/graph/adjacency_list.hpp>


#ifndef INCLUDE_ALGORITHM_HPP_
#define INCLUDE_ALGORITHM_HPP_


class Algorithm {

public:
typedef std::size_t dotId;
typedef std::pair<dotId, dotId> edge;
typedef std::size_t weight;

private:
typedef boost::adjacency_list <boost::listS, boost::vecS, boost::directedS,
boost::no_property,boost::property<boost::edge_weight_t, size_t> > graph_t;
typedef boost::graph_traits<graph_t>::vertex_descriptor vertex_descriptor;

public:
Algorithm()= delete;
explicit Algorithm(const std::vector<edge> &edgeArr, const std::vector<weight> &weightArr);
~Algorithm();
Algorithm(const Algorithm&) = delete;
Algorithm(const Algorithm&&) = delete;
Algorithm& operator=(const Algorithm&) = delete;
Algorithm& operator=(const Algorithm&&) = delete;

std::vector<dotId> CalcRoute(const dotId &A, const dotId &B);

std::pair<std::vector<Algorithm::dotId>, size_t>
getRoute(dotId from, const size_t &pointsCount,
const size_t &time, const size_t &maxPlacesCount);



// delete this from algo and use from WorkerAPI
long int getWeightIndex(const size_t &pointsCount, const size_t &from, const size_t &to);

private:
void MakeGraph();
std::unique_ptr<edge> edgeArr;
std::unique_ptr<weight> weightArr;
size_t edgeSize;

graph_t myGraph;
const size_t MAX_PLACES = 200; // контроль (максимальное кол-во мест в пути)
};
#endif // INCLUDE_ALGORITHM_HPP_
27 changes: 27 additions & 0 deletions include/boost/accumulators/accumulators.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
///////////////////////////////////////////////////////////////////////////////
/// \file accumulators.hpp
/// Includes all of the Accumulators Framework
//
// Copyright 2005 Eric Niebler. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_ACCUMULATORS_ACCUMULATORS_HPP_EAN_28_10_2005
#define BOOST_ACCUMULATORS_ACCUMULATORS_HPP_EAN_28_10_2005

#include <boost/accumulators/framework/accumulator_set.hpp>
#include <boost/accumulators/framework/accumulator_concept.hpp>
#include <boost/accumulators/framework/accumulator_base.hpp>
#include <boost/accumulators/framework/extractor.hpp>
#include <boost/accumulators/framework/external.hpp>
#include <boost/accumulators/framework/features.hpp>
#include <boost/accumulators/framework/parameters/accumulator.hpp>
#include <boost/accumulators/framework/parameters/sample.hpp>
#include <boost/accumulators/framework/parameters/weight.hpp>
#include <boost/accumulators/framework/parameters/weights.hpp>
#include <boost/accumulators/framework/accumulators/external_accumulator.hpp>
#include <boost/accumulators/framework/accumulators/droppable_accumulator.hpp>
#include <boost/accumulators/framework/accumulators/reference_accumulator.hpp>
#include <boost/accumulators/framework/accumulators/value_accumulator.hpp>

#endif
Loading