acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
library.h
1#pragma once
2
3
4namespace acme
5{
6
7
8 class CLASS_DECL_ACME library:
9 virtual public ::particle
10 {
11 public:
12
13
14 string m_strFolder;
15 string m_strName;
16 library_t * m_plibrary;
17 string m_strMessage;
18 PFN_factory m_pfnFactory;
19 ::factory::factory_pointer m_pfactory;
20
21
22 //static ::pointer< ::mutex > s_pmutexLoading;
23 //static ::acme::library * s_plibraryLoading;
24
25
26 library();
27 ~library() override;
28
30 //void dump(dump_context &) const override;
31
32 //void initialize_matter(::matter * pmatter) override;
33 //virtual void initialize_library(::matter* pmatter, ::i32 iDesmabi, const ::scoped_string & scopedstrRoot = nullptr, const ::scoped_string & scopedstrName = nullptr, const ::scoped_string & scopedstrFolder = nullptr);
34 //virtual void initialize_library(::matter* pmatter, const ::scoped_string & scopedstrName = nullptr, const ::scoped_string & scopedstrFolder = nullptr);
35
36 //virtual void open(const ::file::path & path,bool bAutoClose = true,bool bCa2Path = false);
37
38 virtual void open(const ::file::path & path);
39
40
41 //static ::acme::library* loading_library();
42
43 //virtual bool open_library(const ::scoped_string & scopedstrTitle = "");
44
45 //library * get_library();
46
47
48 //virtual ::factory::factory * factory() { return m_pfactory; }
49
50
51 virtual bool close();
52
53 virtual void * get_os_data();
54
55
56 virtual bool is_opened();
57 virtual bool is_closed();
58
59 template < typename TARGET >
60 TARGET get(const ::scoped_string & scopedstrEntryName)
61 {
62 return reinterpret_cast <TARGET>(raw_get(scopedstrEntryName));
63 }
64
65 template < typename TARGET >
66 TARGET & get(TARGET & ptarget, const ::scoped_string & scopedstrEntryName)
67 {
68 return ptarget = get<TARGET>(scopedstrEntryName);
69 }
70
71 void * raw_get(const ::scoped_string & scopedstrEntryName);
72
73
74
75
76 // virtual bool contains_app(const ::scoped_string & scopedstrAppId);
77
78
79 //virtual void get_create_impact_id_list(::array < ::atom > & ida);
80
81
82 //virtual string get_root();
83
84
85 //virtual ::pointer<::object>new_application(const ::scoped_string & scopedstrAppId);
86 //virtual void get_app_list(string_array_base & stra);
87
88
89 //virtual ::matter* new_object(const ::scoped_string & scopedstrClass);
90
91
92 virtual string get_library_name();
93
94 //virtual string get_app_id(const ::scoped_string & scopedstrAppName);
95 //virtual string get_app_name(const ::scoped_string & scopedstrAppId);
96
97 //virtual void get_extension_list(string_array_base & stra);
98
99
100 // virtual ::matter * factory_new(::particle * pparticle, const_char_pointer pszClass);
101
102
103 //virtual ::pointer<::matter>factory_create(const_char_pointer pszClass);
104 //virtual bool factory_has_object_class(const_char_pointer pszClass);
105
106 //library_object_allocator_base * find_allocator(const_char_pointer pszClass);
107
108 //virtual void initialize_factory();
109
110
111 //virtual bool add_factory_item();
112
113 //virtual ::pointer<::factory::factory>& factory(const ::scoped_string & scopedstrComponent, const ::scoped_string & scopedstrImplementation);
114
115 //virtual ::pointer<::factory::factory>& factory(const ::scoped_string & scopedstrLibrary);
116
117 //virtual void _load_factory(::pointer<::factory::factory>& pfactory, const ::scoped_string & scopedstrComponent);
118
119 //virtual void factory_exchange(const ::scoped_string & scopedstrName = nullptr, ::factory::factory * pfactory = nullptr);
120 //virtual ::pointer<::factory::factory>create_factory(const ::scoped_string & scopedstrLibrary);
121
122 virtual ::factory::factory_pointer & factory() const override;
123
124 virtual void create_factory();
125
126
127 };
128
129
130
131 CLASS_DECL_ACME void * open_ca2_library(const ::scoped_string & scopedstr);
132
133
134
135
136
137
138} // namespace acme
139
140
141
142
143
144#define BEGIN_LIBRARY \
145 \
146 \
147class library : \
148 virtual public ::acme::library \
149{ \
150public: \
151 \
152 \
153 library(::particle * pparticle) : ::acme::library(pparticle) {} \
154 virtual ~library(){} \
155 \
156 \
157
158
159
160
161#define BEGIN_CREATE_OBJECT \
162 \
163 \
164virtual void initialize_factory() override \
165{
166
167
168#define CREATE_OBJECT_ENTRY(name, TYPE) m_allocatorptra.add(allocateø library_object_allocator < TYPE > (name));
169
170#define END_CREATE_OBJECT }
171
172#define END_LIBRARY };
173
174#define BEG_ONLY_FACT BEGIN_LIBRARY \
175 BEGIN_CREATE_OBJECT
176
177#define END_ONLY_FACT(libname) END_CREATE_OBJECT \
178 END_LIBRARY \
179 \
180CLASS_DECL_EXPORT ::acme::library * libname ## _ ## get_new_library(::particle * pparticle) \
181{ \
182\
183 return ___new library(pparticle); \
184 \
185} \
186 \
187 \
188
189
190
191
192
193
194//
195//
196//namespace factory
197//{
198//
199//
200// template < typename TYPE, typename BASE_TYPE>
201// inline pointer< ::factory::factory_item_base < BASE_TYPE > > _add_factory_item_from(const ::atom & atomSource)
202// {
203//
204// critical_section_lock lock(::factory_critical_section());
205//
206// if (::acme::library::loading_library() != nullptr)
207// {
208//
209// return ::acme::library::loading_library()->get_factory()->add_factory_item < TYPE, BASE_TYPE >();
210//
211// }
212//
213// auto pfactoryitem = allocateø ::factory::factory_item< TYPE, BASE_TYPE > ();
214//
215// factory_item < BASE_TYPE >(atomSource) = pfactoryitem;
216//
217// return pfactoryitem;
218//
219// }
220//
221//
222//} // namespace factory
223//
224//
225
226CLASS_DECL_ACME string implementation_name(const ::scoped_string & scopedstrComponent, const ::scoped_string & scopedstrImplementation);
227
228
229CLASS_DECL_ACME string library_name(const ::scoped_string & scopedstrComponent, const ::scoped_string & scopedstrImplementation);
230
231
232CLASS_DECL_ACME string factory_name(const ::scoped_string & scopedstrLibrary);
233
234
235CLASS_DECL_ACME string library_filter(const ::scoped_string & scopedstr);
236
237
238
virtual void open(const ::file::path &path)
Definition solaris_library.cpp:35
include "aura/graphics/image/context.h"
Definition aaaa__defer.h:32