forked from Alepha/Alepha
Exception problem debugging.
This commit is contained in:
@ -33,9 +33,14 @@ namespace Alepha::Hydrogen::Atomic ::detail:: Dropbox_m
|
|||||||
|
|
||||||
inline namespace exports
|
inline namespace exports
|
||||||
{
|
{
|
||||||
|
struct finished_exception;
|
||||||
template< typename > class Dropbox;
|
template< typename > class Dropbox;
|
||||||
|
|
||||||
using DropboxFinishedException= synthetic_exception< struct finished_exception, FinishedException >;
|
template< template< auto > class > struct ck {};
|
||||||
|
template< typename > class tag;
|
||||||
|
using ck2= ck< tag >;
|
||||||
|
|
||||||
|
using DropboxFinishedException= synthetic_exception< finished_exception, FinishedException >;
|
||||||
using AnyTaggedDropboxFinishedException= AnyTagged< DropboxFinishedException >;
|
using AnyTaggedDropboxFinishedException= AnyTagged< DropboxFinishedException >;
|
||||||
template< typename tag > using TaggedDropboxFinishedException= Tagged< DropboxFinishedException, tag >;
|
template< typename tag > using TaggedDropboxFinishedException= Tagged< DropboxFinishedException, tag >;
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ namespace Alepha::Hydrogen::Atomic ::detail:: Mailbox_m
|
|||||||
|
|
||||||
inline namespace exports
|
inline namespace exports
|
||||||
{
|
{
|
||||||
|
struct finished_exception;
|
||||||
template< typename > class Mailbox;
|
template< typename > class Mailbox;
|
||||||
|
|
||||||
using MailboxFinishedException= synthetic_exception< struct finished_exception, FinishedException >;
|
using MailboxFinishedException= synthetic_exception< struct finished_exception, FinishedException >;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
static_assert( __cplusplus > 2020'99 );
|
static_assert( __cplusplus > 2020'99 );
|
||||||
|
|
||||||
#include "../Mailbox.h"
|
#include "../Mailbox.h"
|
||||||
|
#include "../Dropbox.h"
|
||||||
|
|
||||||
#include <Alepha/Testing/test.h>
|
#include <Alepha/Testing/test.h>
|
||||||
#include <Alepha/Testing/TableTest.h>
|
#include <Alepha/Testing/TableTest.h>
|
||||||
@ -14,7 +15,7 @@ static auto init= Alepha::Utility::enroll <=[]
|
|||||||
|
|
||||||
"Smoke Test"_test <=[]
|
"Smoke Test"_test <=[]
|
||||||
{
|
{
|
||||||
Alepha::Atomic::Mailbox< int > m( 1024 );
|
Alepha::Atomic::Dropbox< int > m( 1024 );
|
||||||
|
|
||||||
m.push( 42 );
|
m.push( 42 );
|
||||||
m.push( 42 );
|
m.push( 42 );
|
||||||
@ -23,6 +24,13 @@ static auto init= Alepha::Utility::enroll <=[]
|
|||||||
assert( m.pop() == 42 );
|
assert( m.pop() == 42 );
|
||||||
assert( m.pop() == 42 );
|
assert( m.pop() == 42 );
|
||||||
|
|
||||||
|
Alepha::Atomic::DropboxFinishedException *de= nullptr;
|
||||||
|
Alepha::Atomic::MailboxFinishedException *me= nullptr;
|
||||||
|
//Alepha::Atomic::MailboxFinishedException2 *me2= nullptr;
|
||||||
|
static_assert( not std::is_same_v< decltype( de ), decltype( me ) > );
|
||||||
|
//me2= me;
|
||||||
|
//de= me;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m.pop();
|
m.pop();
|
||||||
@ -34,15 +42,17 @@ static auto init= Alepha::Utility::enroll <=[]
|
|||||||
std::cerr << "We caught an exception." << std::endl;
|
std::cerr << "We caught an exception." << std::endl;
|
||||||
const Alepha::Exception *const cond_p= &cond;
|
const Alepha::Exception *const cond_p= &cond;
|
||||||
|
|
||||||
assert( dynamic_cast< const Alepha::Atomic::MailboxFinishedException * >( cond_p ) );
|
assert( not dynamic_cast< const Alepha::Atomic::MailboxFinishedException * >( cond_p ) );
|
||||||
|
assert( dynamic_cast< const Alepha::Atomic::DropboxFinishedException * >( cond_p ) );
|
||||||
assert( dynamic_cast< const Alepha::FinishedException * >( cond_p ) );
|
assert( dynamic_cast< const Alepha::FinishedException * >( cond_p ) );
|
||||||
assert( dynamic_cast< const Alepha::Exception * >( cond_p ) );
|
assert( dynamic_cast< const Alepha::Exception * >( cond_p ) );
|
||||||
|
|
||||||
assert( dynamic_cast< const Alepha::Atomic::MailboxFinishedCondition * >( cond_p ) );
|
assert( not dynamic_cast< const Alepha::Atomic::MailboxFinishedCondition * >( cond_p ) );
|
||||||
assert( dynamic_cast< const Alepha::FinishedCondition * >( cond_p ) );
|
assert( dynamic_cast< const Alepha::FinishedCondition * >( cond_p ) );
|
||||||
assert( dynamic_cast< const Alepha::Condition * >( cond_p ) );
|
assert( dynamic_cast< const Alepha::Condition * >( cond_p ) );
|
||||||
|
|
||||||
|
|
||||||
|
assert( not dynamic_cast< const Alepha::CriticalError * >( cond_p ) );
|
||||||
|
|
||||||
assert( not dynamic_cast< const Alepha::Atomic::AnyTaggedMailboxFinishedException * >( cond_p ) );
|
assert( not dynamic_cast< const Alepha::Atomic::AnyTaggedMailboxFinishedException * >( cond_p ) );
|
||||||
assert( not dynamic_cast< const Alepha::AnyTaggedFinishedException * >( cond_p ) );
|
assert( not dynamic_cast< const Alepha::AnyTaggedFinishedException * >( cond_p ) );
|
||||||
|
@ -59,6 +59,9 @@ namespace Alepha::Hydrogen ::detail:: Concepts_m
|
|||||||
template< typename T >
|
template< typename T >
|
||||||
concept EmptyType= std::is_empty_v< T >;
|
concept EmptyType= std::is_empty_v< T >;
|
||||||
|
|
||||||
|
template< typename T >
|
||||||
|
concept Enumeration= std::is_enum_v< T >;
|
||||||
|
|
||||||
// Stream related concepts...
|
// Stream related concepts...
|
||||||
template< typename T >
|
template< typename T >
|
||||||
concept OStreamable=
|
concept OStreamable=
|
||||||
|
@ -18,6 +18,8 @@ static auto init= Alepha::Utility::enroll <=[]
|
|||||||
|
|
||||||
using MyEnum= Alepha::Enum< "Adam"_value, "Baker"_value, "Charlie"_value, "David"_value >;
|
using MyEnum= Alepha::Enum< "Adam"_value, "Baker"_value, "Charlie"_value, "David"_value >;
|
||||||
|
|
||||||
|
static_assert( not std::is_same_v< decltype( "adam"_value ), decltype( "tony"_value ) > );
|
||||||
|
|
||||||
"Enum round trip printing test"_test <= TableTest
|
"Enum round trip printing test"_test <= TableTest
|
||||||
<
|
<
|
||||||
[]( const std::string s ) -> std::string
|
[]( const std::string s ) -> std::string
|
||||||
|
16
Exception.h
16
Exception.h
@ -79,7 +79,7 @@ namespace Alepha::Hydrogen ::detail:: Exception_m
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template< typename unique_handle, typename GradeType, typename ... Bases >
|
template< Enumeration unique_handle, typename GradeType, typename ... Bases >
|
||||||
class synthetic_exception
|
class synthetic_exception
|
||||||
: virtual public bases< GradeType, Bases... >
|
: virtual public bases< GradeType, Bases... >
|
||||||
{
|
{
|
||||||
@ -332,33 +332,35 @@ namespace Alepha::Hydrogen ::detail:: Exception_m
|
|||||||
public:
|
public:
|
||||||
std::string_view resourceName() const noexcept final { return storage; }
|
std::string_view resourceName() const noexcept final { return storage; }
|
||||||
};
|
};
|
||||||
class NamedResourceException : public virtual create_exception< struct named_resource_throwable, Exception >, virtual public NamedResourceInterface {};
|
enum NamedResource;
|
||||||
|
class NamedResourceException : public virtual create_exception< NamedResource, Exception >, virtual public NamedResourceInterface {};
|
||||||
using AnyTaggedNamedResourceException= NamedResourceException::any_tagged_type;
|
using AnyTaggedNamedResourceException= NamedResourceException::any_tagged_type;
|
||||||
template< typename tag >
|
template< typename tag >
|
||||||
using TaggedNamedResourceException= NamedResourceException::tagged_type< tag >;
|
using TaggedNamedResourceException= NamedResourceException::tagged_type< tag >;
|
||||||
|
|
||||||
using NamedResourceNotification= create_exception< struct named_resource_notification, Notification, NamedResourceException >;
|
using NamedResourceNotification= create_exception< NamedResource, Notification, NamedResourceException >;
|
||||||
using AnyTaggedNamedResourceNotification= NamedResourceNotification::any_tagged_type;
|
using AnyTaggedNamedResourceNotification= NamedResourceNotification::any_tagged_type;
|
||||||
template< typename tag >
|
template< typename tag >
|
||||||
using TaggedNamedResourceNotification= NamedResourceNotification::tagged_type< tag >;
|
using TaggedNamedResourceNotification= NamedResourceNotification::tagged_type< tag >;
|
||||||
|
|
||||||
using NamedResourceError= create_exception< struct named_resource_exception, Error, NamedResourceException >;
|
using NamedResourceError= create_exception< NamedResource, Error, NamedResourceException >;
|
||||||
using AnyTaggedNamedResourceError= NamedResourceError::any_tagged_type;
|
using AnyTaggedNamedResourceError= NamedResourceError::any_tagged_type;
|
||||||
template< typename tag >
|
template< typename tag >
|
||||||
using TaggedNamedResourceError= NamedResourceError::tagged_type< tag >;
|
using TaggedNamedResourceError= NamedResourceError::tagged_type< tag >;
|
||||||
|
|
||||||
using NamedResourceCriticalError= create_exception< struct named_resource_error, CriticalError, NamedResourceException >;
|
using NamedResourceCriticalError= create_exception< NamedResource, CriticalError, NamedResourceException >;
|
||||||
using AnyTaggedNamedResourceCriticalError= NamedResourceCriticalError::any_tagged_type;
|
using AnyTaggedNamedResourceCriticalError= NamedResourceCriticalError::any_tagged_type;
|
||||||
template< typename tag >
|
template< typename tag >
|
||||||
using TaggedNamedResourceCriticalError= NamedResourceCriticalError::tagged_type< tag >;
|
using TaggedNamedResourceCriticalError= NamedResourceCriticalError::tagged_type< tag >;
|
||||||
|
|
||||||
using NamedResourceViolation= create_exception< struct named_resource_violation, Violation, NamedResourceException >;
|
using NamedResourceViolation= create_exception< NamedResource, Violation, NamedResourceException >;
|
||||||
using AnyTaggedNamedResourceViolation= NamedResourceViolation::any_tagged_type;
|
using AnyTaggedNamedResourceViolation= NamedResourceViolation::any_tagged_type;
|
||||||
template< typename tag >
|
template< typename tag >
|
||||||
using TaggedNamedResourceViolation= NamedResourceViolation::tagged_type< tag >;
|
using TaggedNamedResourceViolation= NamedResourceViolation::tagged_type< tag >;
|
||||||
|
|
||||||
|
enum OutOfRange;
|
||||||
class OutOfRangeException
|
class OutOfRangeException
|
||||||
: virtual public create_exception< struct out_of_range_throwable, Exception > {};
|
: virtual public create_exception< OutOfRange, Exception > {};
|
||||||
using AnyTaggedOutOfRangeException= OutOfRangeException::any_tagged_type;
|
using AnyTaggedOutOfRangeException= OutOfRangeException::any_tagged_type;
|
||||||
template< typename tag >
|
template< typename tag >
|
||||||
using TaggedOutOfRangeException= OutOfRangeException::tagged_type< tag >;
|
using TaggedOutOfRangeException= OutOfRangeException::tagged_type< tag >;
|
||||||
|
Reference in New Issue
Block a user