SoDaRadio-12.2.0-cut_dependencies:6c82803
Loading...
Searching...
No Matches
SoDaThreadRegistry.hxx
Go to the documentation of this file.
1/*
2Copyright (c) 2019, 2025 Matthew H. Reilly (kb1vc)
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are
7met:
8
9 Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11 Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in
13 the documentation and/or other materials provided with the
14 distribution.
15
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28#pragma once
29
30#include "SoDaBase.hxx"
31#include "SoDaThread.hxx"
32#include "Debug.hxx"
33#include <functional>
34
46
47#include <list>
48
49namespace SoDa {
50 class ThreadRegistry;
51 typedef std::shared_ptr<ThreadRegistry> ThreadRegistryPtr;
52
54 public:
55
57
66 static void addThread(SoDa::ThreadPtr thread, const std::string & version);
67
68 static void apply(std::function<bool(SoDa::ThreadPtr)> f);
69
70 static void subscribeThreads(const std::vector<SoDa::MailBoxBasePtr> & mailboxes);
71 static void startThreads();
72 static void joinThreads();
73 static void shutDownThreads();
74
75 private:
84 void priv_addThread(SoDa::ThreadPtr thread, const std::string & version);
85
86 void priv_apply(std::function<bool(SoDa::ThreadPtr)> f);
87
88 void priv_subscribeThreads(const std::vector<SoDa::MailBoxBasePtr> & mailboxes);
92
93 private:
95
96 std::vector<SoDa::ThreadPtr> thread_list;
98 };
99}
100
101
The Baseclass for all SoDa objects, and useful commonly used classes.
The Baseclass for all SoDa thread objects.
static void addThread(SoDa::ThreadPtr thread, const std::string &version)
register a thread so that it can be connected and started
static void startThreads()
static void shutDownThreads()
static void apply(std::function< bool(SoDa::ThreadPtr)> f)
static ThreadRegistryPtr registrar
void priv_subscribeThreads(const std::vector< SoDa::MailBoxBasePtr > &mailboxes)
void priv_apply(std::function< bool(SoDa::ThreadPtr)> f)
static void subscribeThreads(const std::vector< SoDa::MailBoxBasePtr > &mailboxes)
std::vector< SoDa::ThreadPtr > thread_list
static void joinThreads()
void priv_addThread(SoDa::ThreadPtr thread, const std::string &version)
register a thread so that it can be connected and started
static ThreadRegistryPtr getRegistrar()
std::shared_ptr< Thread > ThreadPtr
std::shared_ptr< ThreadRegistry > ThreadRegistryPtr