libzypp: zypp/ng/sat/components/architecturecomponent.h Source File

libzypp 17.38.6

architecturecomponent.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8----------------------------------------------------------------------/
9*
10* This file contains private API, this might break at any time between releases.
11* You have been warned!
12*
13*/
14#ifndef ZYPP_NG_SAT_COMPONENTS_ARCHITECTURECOMPONENT_H_INCLUDED
15#define ZYPP_NG_SAT_COMPONENTS_ARCHITECTURECOMPONENT_H_INCLUDED
16
17#include "poolcomponents.h"
18#include <zypp/ng/arch.h>
19#include <zypp/ng/base/serialnumber.h>
20#include <functional>
21
22namespace zyppng::sat {
23
30 class ArchitectureComponent : public IPoolComponent {
31 public:
33 using ArchitectureProvider = std::function<zypp::Arch()>;
34
35 ArchitectureComponent() = default;
36
38 void setProvider( ArchitectureProvider provider );
39
41 zypp::Arch arch() const
42 { return _provider ? _provider() : zypp::Arch::detectSystemArchitecture(); }
43
44 InitStage stage() const override { return InitStage::Environment; }
45 int priority() const override { return 0; }
46
47 void attach(Pool &pool) override;
48 void prepare( Pool & pool ) override;
49 void onRepoAdded( Pool & pool, detail::RepoIdType id ) override;
50 void onReset( Pool & pool ) override;
51
52 private:
53 Pool *_pool = nullptr;
54 ArchitectureProvider _provider;
55 SerialNumberWatcher _watcher;
56 };
57
58
59} // namespace zyppng::sat
60
61#endif
arch.h
zypp::Arch
Architecture.
Definition Arch.h:37
zypp::Arch::detectSystemArchitecture
static Arch detectSystemArchitecture()
Determine system architecture evaluating uname and /proc/cpuinfo.
Definition Arch.cc:701
zypp::SerialNumberWatcher
Simple serial number watcher.
Definition SerialNumber.h:123
zyppng::sat::ArchitectureComponent::_watcher
SerialNumberWatcher _watcher
Definition architecturecomponent.h:55
zyppng::sat::ArchitectureComponent::_pool
Pool * _pool
Definition architecturecomponent.h:53
zyppng::sat::ArchitectureComponent::_provider
ArchitectureProvider _provider
Definition architecturecomponent.h:54
zyppng::sat::ArchitectureComponent::stage
InitStage stage() const override
Definition architecturecomponent.h:44
zyppng::sat::ArchitectureComponent::ArchitectureProvider
std::function< zypp::Arch()> ArchitectureProvider
Provider function returning an Arch.
Definition architecturecomponent.h:33
zyppng::sat::ArchitectureComponent::onReset
void onReset(Pool &pool) override
Definition architecturecomponent.cc:41
zyppng::sat::ArchitectureComponent::ArchitectureComponent
ArchitectureComponent()=default
zyppng::sat::ArchitectureComponent::prepare
void prepare(Pool &pool) override
Definition architecturecomponent.cc:34
zyppng::sat::ArchitectureComponent::onRepoAdded
void onRepoAdded(Pool &pool, detail::RepoIdType id) override
Definition architecturecomponent.cc:46
zyppng::sat::ArchitectureComponent::setProvider
void setProvider(ArchitectureProvider provider)
Set a custom architecture provider.
Definition architecturecomponent.cc:21
zyppng::sat::ArchitectureComponent::arch
zypp::Arch arch() const
Get the current architecture.
Definition architecturecomponent.h:41
zyppng::sat::ArchitectureComponent::attach
void attach(Pool &pool) override
Definition architecturecomponent.cc:29
zyppng::sat::ArchitectureComponent::priority
int priority() const override
Fine-grained ordering within a stage.
Definition architecturecomponent.h:45
zyppng::sat::IPoolComponent
Interface for components that run BEFORE the whatprovides index is built.
Definition poolcomponents.h:91
zyppng::sat::Pool
Orchestrator for a libsolv pool instance.
Definition pool.h:37
zypp::pool
Definition ByIdent.h:24
zyppng::sat::detail::RepoIdType
zypp::sat::detail::RepoIdType RepoIdType
Definition poolconstants.h:45
zyppng::sat
This file contains private API, this might break at any time between releases.
Definition capabilities.h:22
zyppng::sat::InitStage
InitStage
Execution stages for IPoolComponent (pre-index phase).
Definition poolcomponents.h:35
zyppng::sat::InitStage::Environment
@ Environment
Arches, Locales, Namespace Callbacks (The Foundation).
Definition poolcomponents.h:36
poolcomponents.h
serialnumber.h