//
// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
//
// The contents of this file are covered under the licence agreement in the
// file "LICENCE" distributed with Cforall.
//
// maybe -- May contain a value.
//
// Author           : Andrew Beach
// Created On       : Wed May 24 14:43:00 2017
// Last Modified By : Peter A. Buhr
// Last Modified On : Sat Jul 22 10:00:52 2017
// Update Count     : 4
//

#pragma once

#include <stdbool.h>

// DO NOT USE DIRECTLY!
forall(otype T)
struct maybe {
    bool has_value;
    T value;
};


forall(otype T)
void ?{}(maybe(T) * this);

forall(otype T)
void ?{}(maybe(T) * this, T value);

forall(otype T)
void ?{}(maybe(T) * this, maybe(T) other);

forall(otype T)
void ^?{}(maybe(T) * this);

forall(otype T)
maybe(T) ?=?(maybe(T) * this, maybe(T) other);

forall(otype T)
bool ?!=?(maybe(T) this, zero_t);

/* Waiting for bug#11 to be fixed.
forall(otype T)
maybe(T) maybe_value(T value);

forall(otype T)
maybe(T) maybe_none();
*/

forall(otype T)
bool has_value(maybe(T) * this);

forall(otype T)
T get(maybe(T) * this);

forall(otype T)
void set(maybe(T) * this, T value);

forall(otype T)
void set_none(maybe(T) * this);

// Local Variables: //
// mode: c //
// tab-width: 4 //
// End: //
