acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
extended_transport.h
1#pragma once
2
3//
4//namespace extended
5//{
6//
7//
8// template < typename T >
9// class transport :
10// public pointer < T >,
11// public ::extended::status
12// {
13// public:
14//
15//
16// transport() :
17// status(::error_not_initialized)
18// {
19//
20// }
21//
22// template < typename T2 >
23// transport(T2 * p) :
24// pointer<T>(p)
25// {
26//
27// if (this->is_null())
28// {
29//
30// add(::error_null_result);
31//
32// }
33//
34// }
35//
36//
37// template < typename TYPE >
38// transport(const ::pointer<TYPE>& p) :
39// pointer<T>(p),
40// ::extended::status(::is_null(this->m_p) ? error_null_result : ::success)
41// {
42//
43// }
44//
45//
46// template < typename TYPE >
47// transport(::pointer<TYPE>& p) :
48// pointer<T>(::transfer(p)),
49// ::extended::status(::is_null(this->m_p) ? error_null_result : ::success)
50// {
51//
52// }
53//
54//
55// template < typename TYPE >
56// transport(transport < TYPE > && p) :
57// pointer<T>(::transfer(p)),
58// ::extended::status(::transfer(p))
59// {
60//
61//
62// }
63//
64//
65// transport(nullptr_t) :
66// status(::error_failed)
67// {
68//
69// }
70//
71//
72// transport(::enum_status estatus) :
73// status(estatus)
74// {
75//
76//
77// }
78//
79//
80// transport(const ::e_status & estatus) :
81// status(estatus)
82// {
83//
84// add(estatus);
85//
86// }
87//
88//
89// transport(const ::exception & e)
90// {
91//
92// add(e);
93//
94// }
95//
96//
97// transport(const std::initializer_list < ::exception > &list_base)
98// {
99//
100// for (auto& e : list_base)
101// {
102//
103// add(e);
104//
105// }
106//
107// }
108//
109//
110// transport(const ::extended::status & status) :
111// ::extended::status(status)
112// {
113//
114// add(::error_null_result);
115//
116// }
117//
118//
119// transport(const transport & transport) :
120// pointer < T >(transport),
121// status(transport)
122// {
123//
124// }
125//
126//
127// transport(transport && transport) :
128// pointer < T >(::transfer(transport)),
129// status(::transfer(transport))
130// {
131//
132// }
133//
134//
135// transport & operator =(nullptr_t)
136// {
137//
138// this->release();
139//
140// m_estatus = ::error_failed;
141//
142// return *this;
143//
144// }
145//
146//
147// // set main status
148// transport & operator =(const ::e_status & estatus)
149// {
150//
151// m_estatus = estatus;
152//
153// if (failed())
154// {
155//
156// this->release();
157//
158// }
159//
160// return *this;
161//
162// }
163//
164//
165// transport& operator =(const ::enum_status& estatus)
166// {
167//
168// return this->operator = ((const void&) estatus);
169//
170// }
171//
172//
173// transport & operator =(const ::extended::status & status)
174// {
175//
176// this->release();
177//
178// status::operator=(status);
179//
180// if (succeeded())
181// {
182//
183// add(::error_null_result);
184//
185// }
186//
187// return *this;
188//
189// }
190//
191//
192// transport & operator =(extended::status && status)
193// {
194//
195// this->release();
196//
197// status::operator=(::transfer(status));
198//
199// if (succeeded())
200// {
201//
202// add(::error_null_result);
203//
204// }
205//
206// return *this;
207//
208// }
209//
210//
211// transport & operator =(const transport & transport)
212// {
213//
214// if (this != &transport)
215// {
216//
217// pointer < T >::operator =(transport);
218//
219//
220// status::operator=(transport);
221//
222// }
223//
224// return *this;
225//
226// }
227//
228// transport & operator =(transport && transport)
229// {
230//
231// pointer < T >::operator =(::transfer(transport));
232//
233// status::operator=(::transfer(transport));
234//
235// return *this;
236//
237// }
238//
239// template < typename T2 >
240// transport & operator =(T2 * p)
241// {
242//
243// pointer < T >::operator =(p);
244//
245// if (this->is_null())
246// {
247//
248// add(::error_null_result);
249//
250// }
251//
252// return *this;
253//
254// }
255//
256//
257// template < typename TYPE >
258// transport & operator =(const TYPE * p)
259// {
260//
261// pointer < T >::operator =(p);
262//
263// if (this->is_null())
264// {
265//
266// if (::is_set(p))
267// {
268//
269// add(::error_wrong_type);
270//
271// }
272// else
273// {
274//
275// add(::error_null_result);
276//
277// }
278//
279// }
280//
281// return *this;
282//
283// }
284//
285//
286// transport & operator =(const pointer < T > & p)
287// {
288//
289// return this->operator = (p.m_p);
290//
291// }
292//
293//
294// template < typename TYPE >
295// transport & operator =(const ::pointer<TYPE>& p)
296// {
297//
298// return this->operator = (p.m_p);
299//
300// }
301//
302//
303// bool is_initialized() const
304// {
305//
306// return m_estatus != error_not_initialized;
307//
308// }
309//
310//
311// bool not_initialized() const
312// {
313//
314// return !is_initialized();
315//
316// }
317//
318//
319// ::e_status estatus() const
320// {
321//
322// return m_estatus;
323//
324// //if (m_pexceptiona.is_null() || m_pexceptiona->is_empty())
325// //{
326//
327// // if (pointer < T >::is_null())
328// // {
329//
330// // return error_null_result;
331//
332// // }
333// // else
334// // {
335//
336// // return ::success;
337//
338// // }
339//
340// //}
341// //else if (m_pexceptiona->get_size() == 1)
342// //{
343//
344// // return m_pexceptiona->element_at(0).m_estatus;
345//
346// //}
347// //else
348// //{
349//
350// // for (auto& e : *m_pexceptiona)
351// // {
352//
353// // if (::failed(e.m_estatus))
354// // {
355//
356// // return error_multiple;
357//
358// // }
359//
360// // }
361//
362// // return success_multiple;
363//
364// //}
365//
366// }
367//
368// bool succeeded() const { return ::succeeded(estatus()); }
369//
370// bool failed() const { return !succeeded(); }
371//
372// operator bool() const { return succeeded(); }
373//
374// operator void() const { return estatus(); }
375//
376// bool operator !() const { return failed(); }
377//
378// auto operator ->() { return pointer<T>::operator ->(); }
379//
380// auto operator ->() const { return pointer<T>::operator ->(); }
381//
382//
383// };
384//
385//
386// template < typename OBJECT >
387// using sequence = ::sequence < OBJECT, ::extended::transport < OBJECT > >;
388//
389//
390// template < typename OBJECT >
391// using asynchronous = ::asynchronous < OBJECT, ::extended::transport < OBJECT >, ::extended::sequence < OBJECT > >;
392//
393//
394//} // namespace extended
395//
396
397
398template < typename TYPE >
399inline bool is_set(const ::extended::transport < TYPE > & t)
400{
401
402 return is_set(t.m_p);
403
404}
405
406
407