acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
system_factory.h
1
// Created by camilo with Mummi on 2024-06-14 21:24 <3ThomasBorregaardSorensen!!
2
#pragma once
3
4
5
#include "acme/parallelization/synchronous_lock.h"
6
7
8
namespace
platform
9
{
10
11
12
class
CLASS_DECL_ACME system_factory :
13
virtual
public
::particle
14
{
15
public
:
16
17
18
system_factory();
19
~system_factory()
override
;
20
21
22
template
<
typename
FACTORY_REPRESENTATIVE_TYPE >
23
FACTORY_REPRESENTATIVE_TYPE* __factory(::pointer < FACTORY_REPRESENTATIVE_TYPE >& p)
24
{
25
26
if
(!p)
27
{
28
29
auto
psystem = system();
30
31
_synchronous_lock
synchronouslock(psystem->synchronization(), DEFAULT_SYNCHRONOUS_LOCK_SUFFIX);
32
33
auto
pfactory = psystem->factory();
34
35
bool
bHasFactoryRepresentativeType = pfactory->has_factory_item<FACTORY_REPRESENTATIVE_TYPE>();
36
37
if
(!bHasFactoryRepresentativeType)
38
{
39
40
::string strComponent = FACTORY_REPRESENTATIVE_TYPE::represented_component_name();
41
42
informationf(
"Trying to create component \"%s\"."
, strComponent.c_str());
43
44
psystem->defer_component_factory(strComponent);
45
46
}
47
48
constructø(p);
49
50
}
51
52
return
p;
53
54
}
55
56
57
};
58
59
60
}
// namespace platform
61
62
63
_synchronous_lock
Definition
synchronous_lock.h:31
platform
include "thread/AutoLock.h"
Definition
_forward_declaration.h:877
platform
system_factory.h
Generated by
1.17.0