|
| 1 | +/*++ |
| 2 | +
|
| 3 | +Copyright (C) 2018 Automatic Component Toolkit Developers |
| 4 | +
|
| 5 | +All rights reserved. |
| 6 | +
|
| 7 | +This file has been generated by the Automatic Component Toolkit (ACT) version 1.2.4. |
| 8 | +
|
| 9 | +Abstract: This is an autogenerated plain C Header file in order to allow an easy |
| 10 | + use of Prime Numbers Interface |
| 11 | +
|
| 12 | +Interface version: 1.2.0 |
| 13 | +
|
| 14 | +*/ |
| 15 | + |
| 16 | +#ifndef __LIBPRIMES_HEADER |
| 17 | +#define __LIBPRIMES_HEADER |
| 18 | + |
| 19 | +#ifdef __LIBPRIMES_DLL |
| 20 | +#ifdef WIN32 |
| 21 | +#define LIBPRIMES_DECLSPEC __declspec (dllexport) |
| 22 | +#else // WIN32 |
| 23 | +#define LIBPRIMES_DECLSPEC __attribute__((visibility("default"))) |
| 24 | +#endif // WIN32 |
| 25 | +#else // __LIBPRIMES_DLL |
| 26 | +#define LIBPRIMES_DECLSPEC |
| 27 | +#endif // __LIBPRIMES_DLL |
| 28 | + |
| 29 | +#include "libprimes_types.h" |
| 30 | + |
| 31 | +extern "C" { |
| 32 | + |
| 33 | +/************************************************************************************************************************* |
| 34 | + Class definition for Calculator |
| 35 | +**************************************************************************************************************************/ |
| 36 | + |
| 37 | +/** |
| 38 | +* Returns the current value of this Calculator |
| 39 | +* |
| 40 | +* @param[in] pCalculator - Calculator instance. |
| 41 | +* @param[out] pValue - The current value of this Calculator |
| 42 | +* @return error code or 0 (success) |
| 43 | +*/ |
| 44 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_calculator_getvalue (LibPrimes_Calculator pCalculator, unsigned long long * pValue); |
| 45 | + |
| 46 | +/** |
| 47 | +* Sets the value to be factorized |
| 48 | +* |
| 49 | +* @param[in] pCalculator - Calculator instance. |
| 50 | +* @param[in] nValue - The value to be factorized |
| 51 | +* @return error code or 0 (success) |
| 52 | +*/ |
| 53 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_calculator_setvalue (LibPrimes_Calculator pCalculator, unsigned long long nValue); |
| 54 | + |
| 55 | +/** |
| 56 | +* Sets the progress callback function |
| 57 | +* |
| 58 | +* @param[in] pCalculator - Calculator instance. |
| 59 | +* @param[in] pProgressCallback - The progress callback |
| 60 | +* @return error code or 0 (success) |
| 61 | +*/ |
| 62 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_calculator_setprogresscallback (LibPrimes_Calculator pCalculator, LibPrimesProgressCallback pProgressCallback); |
| 63 | + |
| 64 | +/** |
| 65 | +* Performs the specific calculation of this Calculator |
| 66 | +* |
| 67 | +* @param[in] pCalculator - Calculator instance. |
| 68 | +* @return error code or 0 (success) |
| 69 | +*/ |
| 70 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_calculator_calculate (LibPrimes_Calculator pCalculator); |
| 71 | + |
| 72 | +/************************************************************************************************************************* |
| 73 | + Class definition for FactorizationCalculator |
| 74 | +**************************************************************************************************************************/ |
| 75 | + |
| 76 | +/** |
| 77 | +* Returns the prime factors of this number (without multiplicity) |
| 78 | +* |
| 79 | +* @param[in] pFactorizationCalculator - FactorizationCalculator instance. |
| 80 | +* @param[in] nPrimeFactorsBufferSize - Number of elements in buffer |
| 81 | +* @param[out] pPrimeFactorsNeededCount - will be filled with the count of the written elements, or needed buffer size. |
| 82 | +* @param[out] pPrimeFactorsBuffer - PrimeFactor buffer of The prime factors of this number |
| 83 | +* @return error code or 0 (success) |
| 84 | +*/ |
| 85 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_factorizationcalculator_getprimefactors (LibPrimes_FactorizationCalculator pFactorizationCalculator, const unsigned int nPrimeFactorsBufferSize, unsigned int * pPrimeFactorsNeededCount, sLibPrimesPrimeFactor * pPrimeFactorsBuffer); |
| 86 | + |
| 87 | +/************************************************************************************************************************* |
| 88 | + Class definition for SieveCalculator |
| 89 | +**************************************************************************************************************************/ |
| 90 | + |
| 91 | +/** |
| 92 | +* Returns all prime numbers lower or equal to the sieve's value |
| 93 | +* |
| 94 | +* @param[in] pSieveCalculator - SieveCalculator instance. |
| 95 | +* @param[in] nPrimesBufferSize - Number of elements in buffer |
| 96 | +* @param[out] pPrimesNeededCount - will be filled with the count of the written elements, or needed buffer size. |
| 97 | +* @param[out] pPrimesBuffer - uint64 buffer of The primes lower or equal to the sieve's value |
| 98 | +* @return error code or 0 (success) |
| 99 | +*/ |
| 100 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_sievecalculator_getprimes (LibPrimes_SieveCalculator pSieveCalculator, const unsigned int nPrimesBufferSize, unsigned int * pPrimesNeededCount, unsigned long long * pPrimesBuffer); |
| 101 | + |
| 102 | +/************************************************************************************************************************* |
| 103 | + Global functions |
| 104 | +**************************************************************************************************************************/ |
| 105 | + |
| 106 | +/** |
| 107 | +* Creates a new FactorizationCalculator instance |
| 108 | +* |
| 109 | +* @param[out] pInstance - New FactorizationCalculator instance |
| 110 | +* @return error code or 0 (success) |
| 111 | +*/ |
| 112 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_createfactorizationcalculator (LibPrimes_FactorizationCalculator * pInstance); |
| 113 | + |
| 114 | +/** |
| 115 | +* Creates a new SieveCalculator instance |
| 116 | +* |
| 117 | +* @param[out] pInstance - New SieveCalculator instance |
| 118 | +* @return error code or 0 (success) |
| 119 | +*/ |
| 120 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_createsievecalculator (LibPrimes_SieveCalculator * pInstance); |
| 121 | + |
| 122 | +/** |
| 123 | +* Releases the memory of an Instance |
| 124 | +* |
| 125 | +* @param[in] pInstance - Instance Handle |
| 126 | +* @return error code or 0 (success) |
| 127 | +*/ |
| 128 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_releaseinstance (LibPrimes_BaseClass pInstance); |
| 129 | + |
| 130 | +/** |
| 131 | +* retrieves the current version of the library. |
| 132 | +* |
| 133 | +* @param[out] pMajor - returns the major version of the library |
| 134 | +* @param[out] pMinor - returns the minor version of the library |
| 135 | +* @param[out] pMicro - returns the micro version of the library |
| 136 | +* @return error code or 0 (success) |
| 137 | +*/ |
| 138 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_getlibraryversion (unsigned int * pMajor, unsigned int * pMinor, unsigned int * pMicro); |
| 139 | + |
| 140 | +/** |
| 141 | +* Handles Library Journaling |
| 142 | +* |
| 143 | +* @param[in] pFileName - Journal FileName |
| 144 | +* @return error code or 0 (success) |
| 145 | +*/ |
| 146 | +LIBPRIMES_DECLSPEC LibPrimesResult libprimes_setjournal (const char * pFileName); |
| 147 | + |
| 148 | +} |
| 149 | + |
| 150 | +#endif // __LIBPRIMES_HEADER |
| 151 | + |
0 commit comments