
#ifndef PLS_DATAFLOW_INTERNAL_TOKEN_H_
#define PLS_DATAFLOW_INTERNAL_TOKEN_H_

namespace pls {
namespace dataflow {
namespace internal {

class invocation_info {
 public:
  explicit invocation_info(void **memory) : memory_{memory} {};
  invocation_info(invocation_info const &other) = default;

  template<typename T>
  T *get_instance_buffer(int pos) {
    return reinterpret_cast<T *>(memory_[pos]);
  }

 private:
  void **memory_;
};

template<typename T>
class token {
  T value_;
  invocation_info invocation_;

 public:
  token() : invocation_{nullptr} {}; // Default Constructor Stays uninitialized
  token(T value, invocation_info color) : value_{value}, invocation_{color} {};

  T &value() { return value_; }
  invocation_info invocation() const { return invocation_; }

  void set_invocation(invocation_info invocation_info) { invocation_ = invocation_info; }
};

}
}
}

#endif //PLS_DATAFLOW_INTERNAL_TOKEN_H_
