mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 15:18:20 +00:00
core: introduce 'Core' namespace
The namespace draws a clear line between the base library and the core component. It is declared at the new core-local header <types.h>, which is expected to be included by all code of the core component. It is thereby a natural place for kernel-agnostic general types like commonly used C++ utilities. Fixes #4777
This commit is contained in:
committed by
Christian Helmuth
parent
487aad6db1
commit
2e6dd010ae
@ -14,29 +14,26 @@
|
||||
#ifndef _CORE__OBJECT_H_
|
||||
#define _CORE__OBJECT_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <util/reconstructible.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/capability_space.h>
|
||||
|
||||
/* core includes */
|
||||
#include <types.h>
|
||||
|
||||
/* base-hw includes */
|
||||
#include <kernel/interface.h>
|
||||
#include <kernel/object.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
/**
|
||||
* Represents a kernel object in core
|
||||
*
|
||||
* \param T type of the kernel object
|
||||
*/
|
||||
template <typename T> class Kernel_object;
|
||||
}
|
||||
namespace Core { template <typename T> class Kernel_object; }
|
||||
|
||||
|
||||
/**
|
||||
* Represents a kernel object in core
|
||||
*
|
||||
* \param T type of the kernel object
|
||||
*/
|
||||
template <typename T>
|
||||
class Genode::Kernel_object : public Genode::Constructible<Kernel::Core_object<T>>
|
||||
class Core::Kernel_object : public Constructible<Kernel::Core_object<T>>
|
||||
{
|
||||
protected:
|
||||
|
||||
@ -66,12 +63,12 @@ class Genode::Kernel_object : public Genode::Constructible<Kernel::Core_object<T
|
||||
:
|
||||
_cap(Capability_space::import(Kernel::cap_id_invalid()))
|
||||
{
|
||||
Genode::Constructible<Kernel::Core_object<T>>::construct(args...);
|
||||
Constructible<Kernel::Core_object<T>>::construct(args...);
|
||||
}
|
||||
|
||||
~Kernel_object()
|
||||
{
|
||||
if (Genode::Constructible<Kernel::Core_object<T>>::constructed())
|
||||
if (Constructible<Kernel::Core_object<T>>::constructed())
|
||||
T::syscall_destroy(*this);
|
||||
}
|
||||
|
||||
@ -83,7 +80,7 @@ class Genode::Kernel_object : public Genode::Constructible<Kernel::Core_object<T
|
||||
template <typename... ARGS>
|
||||
bool create(ARGS &&... args)
|
||||
{
|
||||
if (Genode::Constructible<Kernel::Core_object<T>>::constructed())
|
||||
if (Constructible<Kernel::Core_object<T>>::constructed())
|
||||
return false;
|
||||
|
||||
_cap = Capability_space::import(T::syscall_create(*this, args...));
|
||||
|
Reference in New Issue
Block a user