summaryrefslogtreecommitdiff
path: root/lib/block_config.cpp
blob: 227ae08553763b3216f544e34aeb71c5e987bd9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.

#include <gras/block_config.hpp>

using namespace gras;

GlobalBlockConfig::GlobalBlockConfig(void)
{
    maximum_output_items = 0;
    buffer_affinity = -1;
    interruptible_work = false;
}

void GlobalBlockConfig::merge(const GlobalBlockConfig &config)
{
    //overwrite with config's max items only if maxium_items is not set (zero)
    if (this->maximum_output_items == 0)
    {
        this->maximum_output_items = config.maximum_output_items;
    }

    //overwrite with config's node affinity setting for buffers if not set
    if (this->buffer_affinity == -1)
    {
        this->buffer_affinity = config.buffer_affinity;
    }

    //overwrite with config's interruptable setting for work if not set
    if (this->interruptible_work == false)
    {
        this->interruptible_work = config.interruptible_work;
    }

    //overwrite with config's thread pool for actor if not set
    if (not this->thread_pool)
    {
        this->thread_pool = config.thread_pool;
    }
}

InputPortConfig::InputPortConfig(void)
{
    item_size = 1;
    reserve_items = 1;
    maximum_items = 0;
    inline_buffer = false;
    preload_items = 0;
}

OutputPortConfig::OutputPortConfig(void)
{
    item_size = 1;
    reserve_items = 1;
    maximum_items = 0;
}