C++ library
https://github.com/Voultapher/Vool.git
C++ library
A collection of c++ modules, that are build for cross-platform usage, small code footprint and performance
C++14 compliant compiler. Code is tested using MSVC and Clang. Should work cross-platform
GNP requires gnuplot to be installed on the system and that its location is specified when constructing vool::gnuplot
Include "include" folder into your project and #include wanted modules
Example:
#include "Vecmap.h"
Easiest way is to download the entire project, compile it and take a look at main() in test/Main.cpp
vool::vec_map<K, V> map;
map.insert(key, value);
V lookup = map[key]; // value lookup using binary search
vool::plot_data_2D struct as data representationvool::gnuplot::filepath_t gnuplot_filepath = "C:\\ProgramData\\gnuplot\\bin\\gnuplot";
vool::gnuplot gnp(gnuplot_filepath);
uint32_t samples = 100;
gnp("set samples ", samples);
gnp.name_axis("A", "B");
gnp.set_terminal_window(1200, 500);
gnp.add_linestyle(1, "#FF5A62", 2, 3, 5, 1.5f);
gnp.add_grid();
gnp("plot sin(x) ls 1"); // should open window and display plot of sin(x)
gnp.set_terminal_png(1200, 500);
gnp.set_png_filename("TestGraph");
gnp("plot sin(x) ls 1"); // should save plot of sin(x) as png file
size_t size = 1000;
auto test_vec = vool::make_test("build vec",
[](const size_t size)
{ std::vector<int> v(size); }
);
auto test_list = vool::make_test("build list",
[](const size_t size)
{ std::list<int> l(size); }
);
auto category = vool::make_test_category("build", test_vec, test_list);
vool::suit_config config;
config.filename = "Tst_";
auto suit = vool::make_test_suit(config, category);
suit.perform_categorys(0, size);
suit.render_results();
std::atomic_flag as synchronization primitive
Tasks can be added from different threads
{
vool::task_queue tq;
// add 2 tasks which can execute in parallel
auto condition_a = tq.add_task([&vec_a] { func(vec_a); });
auto condition_b = tq.add_task([&vec_b] { func(vec_b); });
// add a task that should only start as soon as the first 2 are finished
tq.add_task(
[&vec_a, &vec_b, &res]() { combine(vec_a, vec_b, res) },
{ condition_a, condition_b } // requesites returned from adding task A and B
);
}
// tq now out of scope
// task_queue destructor should block until all tasks are done
Fork and open a pull request
This project is licensed under the Apache License 2.0 License - see the LICENSE.md file for details