4#include "acme/prototype/comparison/equals.h"
6#include "acme/exception/no_memory.h"
9#include "acme/prototype/prototype/_impl_pointer.h"
10#include "acme/prototype/prototype/_impl_ptr.h"
13#include "acme/prototype/prototype/_impl_factory.h"
25#include "acme/prototype/prototype/_impl_atom.h"
26#include "acme/prototype/prototype/_impl_prototype.h"
27#include "acme/prototype/prototype/_impl_type.h"
37template <
typename BASE_TYPE >
41 if (::is_null(pfactory))
44 pfactory = this->factory();
48 auto pfactoryitem = pfactory->get_factory_item<BASE_TYPE>();
53 throw ::exception(error_no_factory);
57 auto p = pfactoryitem->__call__create_particle();
62 throw ::exception(error_wrong_type);
102template <
typename TYPE >
103inline ::pointer<TYPE>particle::__call__create_new()
117 ::pointer < TYPE > p = { transfer_t{}, __new_refdbg_continuation TYPE() };
126 return ::transfer(p);
134template <
typename TYPE >
135inline ::pointer<TYPE>particle::__call__create_new_clone(TYPE * psrc)
149 ::pointer < TYPE > ptypeNew = { transfer_t{}, __new_refdbg_continuation TYPE() };
154 ptypeNew->initialize(
this);
160 return ::transfer(ptypeNew);
180template <
typename BASE_TYPE >
181inline void particle::__call__construct(::pointer<BASE_TYPE>& p,
::factory::factory * pfactory)
184 if (::is_null(pfactory))
187 pfactory = this->factory();
194 throw ::exception(::error_no_factory);
198 auto pfactoryitem = pfactory->get_factory_item < BASE_TYPE >();
205 strError.format(
"No factory for type : '{}'", ::type<BASE_TYPE>().name());
209 throw ::exception(::error_no_factory, strError);
213 auto ptypeNew = pfactoryitem->__call__create_particle();
215 p = ::transfer(ptypeNew);
220 throw ::exception(error_wrong_type);
433template <
typename TYPE >
434inline void particle::__call__construct_new(::pointer<TYPE>& p)
443 ::pointer < TYPE > ptypeNew = { transfer_t{}, __new_refdbg_continuation TYPE() };
452 p = ::transfer(ptypeNew);
710template <
typename T >
711inline ::pointer < T > pointer_transfer(T* p) {
return {
transfer_t{}, p}; }
927#define IMPL_VAR_REF(TYPE, VAR, NAME) \
928 inline TYPE & payload::as_ ## NAME() \
931 if(m_etype == ::e_type_payload_pointer) \
934 return m_ppayload->as_ ## NAME(); \
937 else if(m_etype == ::e_type_property) \
940 return m_pproperty->as_ ## NAME(); \
943 else if(m_etype == ::e_type_p ## NAME) \
946 return *m_p ## VAR; \
949 else if(m_etype == ::e_type_ ## NAME) \
958 set_type(::e_type_ ## NAME, true); \
1220#if REFERENCING_DEBUGGING
1223template <
typename TYPE,
typename T >
1224void reference_count_debug_assign(::pointer<TYPE>&
ptr, T * p)
1227 auto pold =
ptr.m_p;
1231 p->increment_reference_count();
1233 reference_count_debug_release(pold);
1238template <
typename TYPE >
1239void reference_count_debug_release(::pointer<TYPE>&
ptr)
1242 reference_count_debug_release(
ptr.m_p);
1247template <
typename TYPE >
1248void reference_count_debug_release(TYPE * & p)
1530#define IMPL_VAR_REF(TYPE, VAR, ENUM) \
1531 inline payload::operator TYPE &() \
1534 if(m_etype == ::type_pvar) \
1537 return m_ppayload->operator TYPE &(); \
1540 else if(m_etype == ::type_prop) \
1543 return m_pproperty->operator TYPE &(); \
1546 else if(m_etype == ::type_p ## ENUM) \
1549 return *m_p ## VAR; \
1552 else if(m_etype == ::type_ ## ENUM) \
1561 set_type(::type_ ## ENUM, true); \
1762template <
typename TYPE >
1763inline bool particle::__calldefer_construct_newø(::pointer<TYPE> & p)
1768#if REFERENCING_DEBUGGING
1770 ::allocator::defer_erase_referer();
1778 __call__construct_new(p);
1785template <
typename TYPE >
1786inline bool particle::__call__defer_raw_construct_new(::pointer<TYPE>& p)
1791#if REFERENCING_DEBUGGING
1793 ::allocator::defer_erase_referer();
1801 __call__raw_construct_new(p);
1808constexpr ::e_status e_status::worst(const ::e_status & e)
const
1811 return (::e_status)(::enum_status)minimum((::i64)m_eenum, (::i64)e.m_eenum);
1816constexpr ::i64 posix_time::minutes()
const {
return m_iSecond / 60; }
1817constexpr ::i64 posix_time::hours()
const {
return m_iSecond / (60 * 60); }
1818constexpr ::i64 posix_time::days()
const {
return m_iSecond / (24 * 60 * 60); }
Definition _structures.h:6