create a C wrapper for obelisk

This commit is contained in:
2023-02-21 09:09:48 -03:00
parent adc5042c6c
commit 0e9cc0f832
10 changed files with 197 additions and 0 deletions

View File

@@ -1,3 +1,6 @@
#ifndef OBELISK_INCLUDE_OBELISK_H
#define OBELISK_INCLUDE_OBELISK_H
#include <string>
/**
@@ -15,6 +18,18 @@ namespace obelisk
class Obelisk
{
public:
/**
* @brief Construct a new Obelisk object.
*
*/
Obelisk() = default;
/**
* @brief Destroy the Obelisk object.
*
*/
~Obelisk() = default;
/**
* @brief Get the obelisk version.
*
@@ -28,5 +43,34 @@ namespace obelisk
* @return int The version.
*/
int getLibVersion();
/**
* @brief Query the Obelisk KnowledgeBase to see if the Fact is true
* or not.
*
* @param[in] leftEntity The left entity.
* @param[in] verb The verb.
* @param[in] rightEntity The right entity.
* @return double Returns a value between 0 and 1 depending on
* whether it is true or false.
*/
double query(const std::string& leftEntity,
const std::string& verb,
const std::string& rightEntity);
/**
* @brief Query the Obelisk KnowledgeBase and return the suggested
* action to take.
*
* @param[in] leftEntity The left entity.
* @param[in] verb The verb.
* @param[in] rightEntity The right entity.
* @return std::string Returns the suggested action.
*/
std::string query_action(const std::string& leftEntity,
const std::string& verb,
const std::string& rightEntity);
};
} // namespace obelisk
#endif

View File

@@ -0,0 +1,28 @@
#ifndef OBELISK_INCLUDE_OBELISK_PROGRAM_H
#define OBELISK_INCLUDE_OBELISK_PROGRAM_H
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @brief Get the obelisk version.
*
* @return const char* Returns a string containing the version. This must be
* freed by the caller.
*/
extern const char* obelisk_get_version();
/**
* @brief Get the obelisk library so version.
*
* @return int Returns the so version.
*/
extern int obelisk_get_lib_version();
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -0,0 +1,45 @@
#ifndef OBELISK_INCLUDE_OBELISK_WRAPPER_H
#define OBELISK_INCLUDE_OBELISK_WRAPPER_H
typedef struct CObelisk CObelisk;
#ifdef __cplusplus
extern "C"
{
#endif
/**
* @brief Create a obelisk object.
*
* @return CObelisk* Returns the obelisk object.
*/
CObelisk *create_obelisk();
/**
* @brief Calls the obelisk method getVersion.
*
* @param[in] p_obelisk The obelisk object pointer.
* @return const char* Returns the version. Must be freed by caller.
*/
const char *call_obelisk_getVersion(CObelisk *p_obelisk);
/**
* @brief Calls the obelisk method getLibVersion.
*
* @param[in] p_obelisk The obelisk object pointer.
* @return int Returns the library so version.
*/
int call_obelisk_getLibVersion(CObelisk *p_obelisk);
/**
* @brief Delete a obelisk object.
*
* @param[in] p_obelisk The obelisk object pointer.
*/
void destroy_obelisk(CObelisk *p_obelisk);
#ifdef __cplusplus
};
#endif
#endif