ORIGINAL
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | List of all members
original::threadBase< DERIVED > Class Template Referenceabstract

Base class for thread implementations. More...

#include <thread.h>

Inheritance diagram for original::threadBase< DERIVED >:
Inheritance graph
Collaboration diagram for original::threadBase< DERIVED >:
Collaboration graph

Classes

class  threadData
 Wrapper for thread execution data. More...
 

Public Member Functions

 threadBase () noexcept=default
 Default constructor.
 
 ~threadBase () noexcept override=default
 Destructor.
 
 threadBase (const threadBase &)=delete
 Deleted copy constructor.
 
threadBaseoperator= (const threadBase &)=delete
 Deleted copy assignment.
 
 threadBase (threadBase &&other) noexcept=default
 Default move constructor.
 
threadBaseoperator= (threadBase &&other) noexcept=default
 Default move assignment.
 
 operator bool () const
 Check if thread is valid.
 
bool operator! () const
 Check if thread is not valid.
 
virtual bool joinable () const =0
 Check if thread is joinable.
 
virtual void join ()=0
 Wait for thread to complete execution.
 
virtual void detach ()=0
 Detach thread from handle.
 
std::string className () const override
 Gets the class name for type identification.
 
std::string toString (bool enter) const override
 Generates formatted string representation.
 
- Public Member Functions inherited from original::comparable< DERIVED >
virtual integer compareTo (const DERIVED &other) const =0
 Compares the current object with another of the same type.
 
bool operator== (const DERIVED &other) const
 Checks if the current object is equal to another.
 
bool operator!= (const DERIVED &other) const
 Checks if the current object is not equal to another.
 
bool operator< (const DERIVED &other) const
 Checks if the current object is less than another.
 
bool operator> (const DERIVED &other) const
 Checks if the current object is greater than another.
 
bool operator<= (const DERIVED &other) const
 Checks if the current object is less than or equal to another.
 
bool operator>= (const DERIVED &other) const
 Checks if the current object is greater than or equal to another.
 
virtual ~comparable ()=default
 Virtual destructor for proper cleanup of derived objects.
 
- Public Member Functions inherited from original::hashable< DERIVED >
virtual u_integer toHash () const noexcept
 Computes the hash of the object.
 
virtual bool equals (const DERIVED &other) const noexcept
 Compares two objects for equality.
 
virtual ~hashable ()=0
 Virtual destructor.
 
- Public Member Functions inherited from original::printable
 operator std::string () const
 Explicit conversion to std::string.
 
 operator const char * () const
 Explicit conversion to C-style string.
 
const chartoCString (bool enter) const
 Direct C-string access with formatting control.
 
template<typename TYPE >
auto formatString (const TYPE &t) -> std::string
 
template<typename TYPE >
auto formatCString (const TYPE &t) -> const char *
 
template<typename TYPE >
auto formatEnum (const TYPE &t) -> std::string
 
template<typename TYPE >
auto formatString (TYPE *const &ptr) -> std::string
 

Protected Member Functions

virtual bool valid () const =0
 Check if thread is valid.
 
virtual ul_integer id () const =0
 Get thread identifier.
 

Additional Inherited Members

- Static Public Member Functions inherited from original::printable
template<typename TYPE >
static std::string formatString (const TYPE &t)
 Universal value-to-string conversion with type-specific formatting.
 
template<Printable TYPE>
static std::string formatString (const TYPE &t)
 Specialization for types deriving from printable.
 
template<EnumType TYPE>
static std::string formatString (const TYPE &t)
 Specialization for enum types with type-safe formatting.
 
template<typename TYPE >
static std::string formatString (TYPE *const &ptr)
 Pointer-specific formatting with null safety.
 
template<typename TYPE >
static const charformatCString (const TYPE &t)
 C-string cache for temporary usage with static storage.
 
template<typename TYPE >
static std::string formatEnum (const TYPE &t)
 Enum formatting utility with underlying value extraction.
 
template<>
auto formatString (const char &t) -> std::string
 
template<>
auto formatString (const bool &t) -> std::string
 
template<>
auto formatString (const char *const &ptr) -> std::string
 

Detailed Description

template<typename DERIVED>
class original::threadBase< DERIVED >

Base class for thread implementations.

Provides common thread functionality and interface

Key Features:

Note
This is an abstract base class and cannot be instantiated directly

Constructor & Destructor Documentation

◆ threadBase()

template<typename DERIVED >
original::threadBase< DERIVED >::threadBase ( )
explicitdefaultnoexcept

Default constructor.

Note
Creates an invalid thread object

◆ ~threadBase()

template<typename DERIVED >
original::threadBase< DERIVED >::~threadBase ( )
overridedefaultnoexcept

Destructor.

Note
Terminates program if thread is joinable and not joined/detached

Member Function Documentation

◆ className()

template<typename DERIVED >
std::string original::threadBase< DERIVED >::className ( ) const
overridevirtual

Gets the class name for type identification.

Returns
Class name as string.

Override in derived classes to provide accurate type names.

class MyClass : public printable {
std::string className() const override { return "MyClass"; }
};
Unique ownership smart pointer with move semantics.
Definition ownerPtr.h:37
Base class providing polymorphic string conversion capabilities.
Definition printable.h:39

Reimplemented from original::printable.

◆ detach()

template<typename DERIVED >
virtual void original::threadBase< DERIVED >::detach ( )
pure virtual

Detach thread from handle.

Exceptions
sysErrorif detach operation fails
Note
Allows thread to execute independently, resources automatically released when thread completes

Implemented in original::thread.

◆ id()

template<typename DERIVED >
virtual ul_integer original::threadBase< DERIVED >::id ( ) const
protectedpure virtual

Get thread identifier.

Returns
Unique identifier for the thread
Note
Pure virtual function to be implemented by derived classes

Implemented in original::thread.

◆ join()

template<typename DERIVED >
virtual void original::threadBase< DERIVED >::join ( )
pure virtual

Wait for thread to complete execution.

Exceptions
sysErrorif join operation fails
Note
Blocks the calling thread until this thread completes

Implemented in original::thread.

◆ joinable()

template<typename DERIVED >
virtual bool original::threadBase< DERIVED >::joinable ( ) const
pure virtual

Check if thread is joinable.

Returns
true if thread is joinable
Note
A thread is joinable if it represents an active thread of execution
Pure virtual function to be implemented by derived classes

Implemented in original::thread.

◆ operator bool()

template<typename DERIVED >
original::threadBase< DERIVED >::operator bool ( ) const
explicit

Check if thread is valid.

Returns
true if thread is valid

◆ operator!()

template<typename DERIVED >
bool original::threadBase< DERIVED >::operator! ( ) const

Check if thread is not valid.

Returns
true if thread is not valid

◆ toString()

template<typename DERIVED >
std::string original::threadBase< DERIVED >::toString ( bool  enter) const
overridevirtual

Generates formatted string representation.

Parameters
enterWhether to append newline.
Returns
Formatted string in "ClassName(data)" format.
std::cout << obj.toString(true); // Outputs "printable(@0x7ffd) \n"
std::string toString(bool enter) const override
String representation formatter.
Definition autoPtr.h:724

Reimplemented from original::printable.

◆ valid()

template<typename DERIVED >
virtual bool original::threadBase< DERIVED >::valid ( ) const
protectedpure virtual

Check if thread is valid.

Returns
true if thread is valid (has an associated execution context)
Note
Pure virtual function to be implemented by derived classes

The documentation for this class was generated from the following file: