2021-05-03 05:40:00 +02:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2021 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_GPT_TASK_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2022-06-20 03:59:29 +02:00
|
|
|
namespace ircd::gpt
|
|
|
|
{
|
|
|
|
void seed(task &, const uint64_t &) noexcept;
|
|
|
|
void seed(task &) noexcept;
|
|
|
|
void clear(task &) noexcept;
|
|
|
|
void reset(task &) noexcept;
|
|
|
|
}
|
|
|
|
|
2021-05-03 05:40:00 +02:00
|
|
|
/// Task Context
|
|
|
|
///
|
|
|
|
/// State for a task.
|
|
|
|
struct ircd::gpt::task
|
|
|
|
{
|
|
|
|
enum status :char;
|
|
|
|
|
|
|
|
/// Reference to the attached options.
|
|
|
|
const gpt::opts *opts {nullptr};
|
|
|
|
|
2022-06-20 03:59:29 +02:00
|
|
|
/// Reference to user's control block.
|
2021-09-02 19:40:11 +02:00
|
|
|
gpt::ctrl *ctrl {nullptr};
|
2021-05-03 05:40:00 +02:00
|
|
|
|
2022-06-20 03:59:29 +02:00
|
|
|
/// Pipe code
|
2022-07-31 11:46:05 +02:00
|
|
|
std::shared_ptr<pipe::code> code;
|
2021-05-03 05:40:00 +02:00
|
|
|
|
2022-06-20 03:59:29 +02:00
|
|
|
/// Pipe model
|
|
|
|
std::unique_ptr<pipe::model> model;
|
2021-05-03 05:40:00 +02:00
|
|
|
|
2022-06-20 03:59:29 +02:00
|
|
|
/// Pipe state
|
|
|
|
pipe::desc desc;
|
|
|
|
|
|
|
|
public:
|
|
|
|
bool done() const noexcept;
|
2022-07-02 03:50:20 +02:00
|
|
|
|
|
|
|
bool
|
|
|
|
operator()();
|
|
|
|
|
|
|
|
vector_view<u16>
|
|
|
|
operator()(const vector_view<u16> &out,
|
|
|
|
const vector_view<const u16> &in);
|
|
|
|
|
|
|
|
string_view
|
|
|
|
operator()(const mutable_buffer &out,
|
|
|
|
const string_view &in);
|
2022-06-20 03:59:29 +02:00
|
|
|
|
|
|
|
task(const gpt::opts * = nullptr,
|
|
|
|
gpt::ctrl * = nullptr);
|
2021-05-03 05:40:00 +02:00
|
|
|
|
2022-06-20 03:59:29 +02:00
|
|
|
~task() noexcept;
|
|
|
|
};
|
2021-05-03 05:40:00 +02:00
|
|
|
#endif
|