File comp_wptt_canonicity.h
File List > comp-wptt_canonicity > src > comp_wptt_canonicity.h
Go to the documentation of this file
#ifndef COMPUTATION_WPTT_CANONICITY_H
#define COMPUTATION_WPTT_CANONICITY_H
/******************************************************************************/
/*************************** Includes *****************************************/
/******************************************************************************/
#include "computation_defs.h"
#include "stdbool.h"
#include "stdlib.h"
#include "string.h"
#include "notation_wptt.h"
#include "storage_defs.h"
/******************************************************************************/
/*************************** Defines ******************************************/
/******************************************************************************/
/*************************** Config Flags**************************************/
/*
*
| Flag\bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| -------------------------- | --- | --- | --- | --- | --- | --- | --- | --- |
| Success | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Fail | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| Param | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
| Config is null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| positivity is uninit | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| tree is null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
| `
|
*/
#define COMP_WPTT_CANON_CONFIG_PARAM (0x1u << 1u)
#define COMP_WPTT_CANON_CONFIG_IS_NULL (0x1u << 2u)
#define COMP_WPTT_CANON_CONFIG_POS_ERROR (0x1u << 3u)
#define COMP_WPTT_CANON_CONFIG_TREE_ERROR (0x1u << 4u)
/*************************** Compute Flags************************************/
/*
*
| Flag\bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| -------------------------- | --- | --- | --- | --- | --- | --- | --- | --- |
| Success | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Fail | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| Config error | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
| Already Computed | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| Vertex computation error | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| Stack error | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
| `
|
*/
#define COMP_WPTT_CANON_COMPUTE_CFG_ERROR (0x1u << 1u)
#define COMP_WPTT_CANON_COMPUTE_ALREADY_COMPUTED (0x1u << 2u)
#define COMP_WPTT_CANON_COMPUTE_VERTCOMP_ERROR (0x1u << 3u)
#define COMP_WPTT_CANON_COMPUTE_STACK_ERROR (0x1u << 4u)
/******************************************************************************/
/*************************** Typedefs *****************************************/
/******************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum comp_wptt_canonicity_canon_e {
COMP_WPTT_CANON_CAN_UNINIT,
COMP_WPTT_CANON_IS_CANONICAL,
COMP_WPTT_CANON_IS_NONCANONICAL,
} comp_wptt_canonicity_canon_e;
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum comp_wptt_cononicity_positivity_e {
COMP_WPTT_CANON_POS_UNINIT,
COMP_WPTT_CANON_POS_POS,
COMP_WPTT_CANON_POS_NEG,
} comp_wptt_cononicity_positivity_e;
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct {
comp_wptt_canonicity_canon_e is_canonical;
} comp_wptt_canonicity_result_t;
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct {
storage_write_funptr_t storage_write;
note_wptt_t * wptt;
comp_wptt_cononicity_positivity_e positivity;
} comp_wptt_canonicity_config_t;
#ifdef __cplusplus
}
#endif
/******************************************************************************/
/*************************** Public Function Declarations *********************/
/******************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
extern "C"
{
#endif
uint8_t comp_wptt_canonicity_config(comp_wptt_canonicity_config_t *config_arg);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
uint8_t comp_wptt_canonicity_compute();
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
const comp_wptt_canonicity_result_t * comp_wptt_canonicity_result();
#ifdef __cplusplus
}
#endif
#endif /* end COMPUTATION_WPTT_CANONICITY_H */