Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
AnyObjectBase.h
Go to the documentation of this file.
1
6/*
7 * This file is part of Algorithms library toolkit.
8 * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
9
10 * Algorithms library toolkit is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14
15 * Algorithms library toolkit is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19
20 * You should have received a copy of the GNU General Public License
21 * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#pragma once
25
26#include <ext/ostream>
27#include <ext/memory>
28#include <ext/string>
29
30namespace object {
31
33public:
38 AnyObjectBase ( ) = default;
39
44 AnyObjectBase ( AnyObjectBase && ) noexcept = default;
45
50 AnyObjectBase ( const AnyObjectBase & ) = default;
51
56 AnyObjectBase & operator = ( AnyObjectBase && ) noexcept = default;
57
62 AnyObjectBase & operator = ( const AnyObjectBase & ) = default;
63
68 virtual ~AnyObjectBase ( ) noexcept = default;
69
76 virtual AnyObjectBase * clone ( ) const & = 0;
77
84 virtual AnyObjectBase * clone ( ) && = 0;
85
94 virtual std::strong_ordering operator <=> ( const AnyObjectBase & other ) const = 0;
95
104 virtual bool operator == ( const AnyObjectBase & other ) const = 0;
105
112 virtual void operator >>( ext::ostream & out ) const = 0;
113
118 virtual explicit operator std::string ( ) const = 0;
119
126 virtual void increment ( unsigned by ) = 0;
127
133 virtual unsigned getId ( ) const = 0;
134};
135
136} /* namespace object */
137
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.
AnyObjectBase(AnyObjectBase &&) noexcept=default
Default move constructor. Needed because of default destructor.
AnyObjectBase()=default
Default constructor. Needed because some constructor is specified.
virtual unsigned getId() const =0
Definition: sigHandler.cpp:20
Definition: AnyObject.h:28
Definition: FordFulkerson.hpp:16