Arbiter
Dependency manager library that supports decentralization
Types.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef __cplusplus
4 #error "This file must be compiled as C++."
5 #endif
6 
7 #include <arbiter/Types.h>
8 
9 #include <memory>
10 #include <ostream>
11 
12 namespace Arbiter {
13 
14 /**
15  * Base class for public-facing Arbiter types, such that they automatically get
16  * freeing, cloning, equality, and description functionality.
17  */
18 class Base
19 {
20  public:
21  virtual ~Base () noexcept(false)
22  {}
23 
24  virtual std::unique_ptr<Base> clone () const = 0;
25  virtual std::ostream &describe (std::ostream &os) const = 0;
26  virtual bool operator== (const Base &other) const = 0;
27 
28  bool operator!= (const Base &other) const
29  {
30  return !(*this == other);
31  }
32 };
33 
34 } // namespace Arbiter
35 
36 std::ostream &operator<< (std::ostream &os, const Arbiter::Base &object);
auto makeIteratorRange(const Collection &collection)
Creates an IteratorRange encompassing the entirety of the given read-only collection.
Definition: Iterator.h:45
virtual bool operator==(const Base &other) const =0
virtual ~Base() noexcept(false)
Definition: Types.h:21
bool operator!=(const Base &other) const
Definition: Types.h:28
virtual std::ostream & describe(std::ostream &os) const =0
virtual std::unique_ptr< Base > clone() const =0