Program Listing for File context.hpp

Return to documentation for file (rcppsw/metrics/context.hpp)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include "rcppsw/types/named_type.hpp"

/*******************************************************************************
 * Namespaces/Decls
 ******************************************************************************/
namespace rcppsw::metrics {

/*******************************************************************************
 * Type Definitions
 ******************************************************************************/
class context : public rtypes::named_type<int, struct context_tag> {
 public:
  using named_type<int, context_tag>::named_type;

  context(const context&) = default;

  context& operator=(const context& other) {
    set(other.v());
    return *this;
  }

  bool operator!=(const context& other) const { return v() != other.v(); }
  bool operator==(const context& other) const { return v() == other.v(); }

 private:
  /* clang-format off */
  /* clang-format on */
};

namespace constants {
extern context kNoContext;
} /* namespace constants */

} /* namespace rcppsw::metrics */