spla
Loading...
Searching...
No Matches
descriptor.hpp
Go to the documentation of this file.
1/**********************************************************************************/
2/* This file is part of spla project */
3/* https://github.com/SparseLinearAlgebra/spla */
4/**********************************************************************************/
5/* MIT License */
6/* */
7/* Copyright (c) 2023 SparseLinearAlgebra */
8/* */
9/* Permission is hereby granted, free of charge, to any person obtaining a copy */
10/* of this software and associated documentation files (the "Software"), to deal */
11/* in the Software without restriction, including without limitation the rights */
12/* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell */
13/* copies of the Software, and to permit persons to whom the Software is */
14/* furnished to do so, subject to the following conditions: */
15/* */
16/* The above copyright notice and this permission notice shall be included in all */
17/* copies or substantial portions of the Software. */
18/* */
19/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR */
20/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
21/* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE */
22/* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER */
23/* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
24/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */
25/* SOFTWARE. */
26/**********************************************************************************/
27
28#ifndef SPLA_DESCRIPTOR_HPP
29#define SPLA_DESCRIPTOR_HPP
30
31#include "object.hpp"
32
33namespace spla {
34
44 class Descriptor final : public Object {
45 public:
46 enum class TraversalMode {
47 Push,
48 Pull,
50 };
51
52 ~Descriptor() override = default;
53
54 void set_traversal_mode(TraversalMode value) { mode = value; }
55 void set_front_factor(float value) { front_factor = value; }
56 void set_early_exit(bool value) { early_exit = value; }
57 void set_struct_only(bool value) { struct_only = value; }
58
59 bool get_push_only() const { return mode == TraversalMode::Push; }
60 bool get_pull_only() const { return mode == TraversalMode::Pull; }
61 bool get_push_pull() const { return mode == TraversalMode::PushPull; }
62 float get_front_factor() const { return front_factor; }
63 bool get_early_exit() const { return early_exit; }
64 bool get_struct_only() const { return struct_only; }
65
66 void set_label(std::string label) override;
67 const std::string& get_label() const override;
68
75
76 private:
77 std::string m_label;
78
80 float front_factor = 0.1f;
81 bool early_exit = false;
82 bool struct_only = false;
83 };
84
89}// namespace spla
90
91#endif//SPLA_DESCRIPTOR_HPP
Descriptor object used to parametrize execution of particular scheduled tasks.
Definition descriptor.hpp:44
bool get_struct_only() const
Definition descriptor.hpp:64
bool get_push_only() const
Definition descriptor.hpp:59
void set_front_factor(float value)
Definition descriptor.hpp:55
bool get_early_exit() const
Definition descriptor.hpp:63
~Descriptor() override=default
bool get_pull_only() const
Definition descriptor.hpp:60
static ref_ptr< Descriptor > make()
Makes new empty descriptor object.
Definition descriptor.cpp:39
const std::string & get_label() const override
Definition descriptor.cpp:36
void set_early_exit(bool value)
Definition descriptor.hpp:56
void set_traversal_mode(TraversalMode value)
Definition descriptor.hpp:54
void set_struct_only(bool value)
Definition descriptor.hpp:57
float get_front_factor() const
Definition descriptor.hpp:62
void set_label(std::string label) override
Definition descriptor.cpp:32
TraversalMode
Definition descriptor.hpp:46
bool get_push_pull() const
Definition descriptor.hpp:61
Base class for any library primitive.
Definition object.hpp:47
Automates reference counting and behaves as shared smart pointer.
Definition ref.hpp:117
#define SPLA_API
Definition config.hpp:43
Definition algorithm.hpp:37