26 void unify (
Object & other ) {
27 if ( this->m_data.
use_count ( ) > other.m_data.use_count ( ) )
28 other.m_data = this->m_data;
30 this->m_data = other.m_data;
37 template <
class Variant >
38 static Object processVariant ( Variant && data ) {
39 auto visitor = [] (
auto && element ) {
40 return Object ( std::forward <
decltype ( element ) > ( element ) );
43 return ext::visit ( visitor, std::forward < Variant > ( data ) );
76 template <
class Type >
77 requires ( ! std::is_same_v < std::decay_t < Type >,
Object > )
89 template <
class ... Types >
100 template <
class ... Types >
107 template <
class Type >
114 template <
class Type >
121 template <
class Type >
159 setData ( data.
clone ( ) );
166 setData ( std::move ( data ).
clone ( ) );
177 if ( this->m_data.
get ( ) == other.m_data.get ( ) )
178 return std::strong_ordering::equal;
180 std::strong_ordering
res = ( * this->m_data ) <=> ( * other.m_data );
182 const_cast < Object *
> ( this )->unify (
const_cast < Object &
> ( other ) );
195 if ( this->m_data.
get ( ) == other.m_data.get ( ) )
198 bool res = ( * this->m_data ) == ( * other.m_data );
200 const_cast < Object *
> ( this )->unify (
const_cast < Object &
> ( other ) );
223 explicit operator std::string ( )
const {
224 return m_data->operator std::string ( );
Specialisation of copy on write pointer for classes based with copy on write pointer base.
Definition: memory.hpp:46
T * get()
Definition: memory.hpp:156
unsigned use_count() const
Getter of the number how many times the managed pointer is referenced.
Definition: memory.hpp:186
Implementation of the variant class allowing to store any type of those listed in the template parame...
Definition: variant.hpp:98
Definition: AnyObjectBase.h:32
virtual AnyObjectBase * clone() const &=0
Virtual copy constructor.
virtual void increment(unsigned by)=0
Increments the unique counter of the object.
virtual unsigned getId() const =0
Represents an adaptor of any type to a class in type hierarchy of objects in the algorithms library.
Definition: AnyObject.h:37
Object(const AnyObject< object::Object > &data)
Definition: Object.h:128
std::strong_ordering operator<=>(const Object &other) const
Definition: Object.h:176
Object(ext::variant< Types ... > &&data)
Specialisation of the make method for variants.
Definition: Object.h:90
Object(AnyObject< Type > &data)
Definition: Object.h:115
void setData(const AnyObjectBase &data)
Definition: Object.h:158
Object(const ext::variant< Types ... > &data)
Specialisation of the make method for variants.
Definition: Object.h:101
Object(const AnyObject< Type > &data)
Definition: Object.h:108
Object(const char *string)
Specialisation of the make method for c-strings.
Definition: Object.h:69
friend ext::ostream & operator<<(ext::ostream &os, const Object &instance)
Definition: Object.h:213
Object operator+=(unsigned by)
Increments the unique counter of the object.
Definition: Object.h:256
AnyObjectBase & getData()
Definition: Object.h:151
Object(Type &&data)
Specialisation of the make method for objects that are not from the object hierarchy of Algorithms li...
Definition: Object.h:79
unsigned getId() const
Definition: Object.h:266
void setData(AnyObjectBase &&data)
Definition: Object.h:165
Object(AnyObject< object::Object > &&data)
Definition: Object.h:134
Object(AnyObject< Type > &&data)
Definition: Object.h:122
const AnyObjectBase & getData() const
Definition: Object.h:142
bool operator==(const Object &other) const
Definition: Object.h:194
Object & operator++()
Increments the unique counter of the object by one. Prefix version.
Definition: Object.h:233
return res
Definition: MinimizeByPartitioning.h:145
auto clone(T &&tmp)
Wrapper around clone by means of using copy constructor or clone method if available.
Definition: clone.hpp:41
constexpr auto visit(Visitor &&vis, Variants &&... vars)
Definition: variant.hpp:42
Type
Definition: MeasurementTypes.hpp:20
Definition: AnyObject.h:28
Definition: FordFulkerson.hpp:16
Definition: RandomStringFactory.cpp:12