CONZEPT 16 C++ API
C16::Procedures Class Referenceabstract

Procedures of a database. More...

#include "C16/Procedures.hpp"

Inheritance diagram for C16::Procedures:
C16::Texts

Detailed Description

Procedures of a database.

Examples

Execution

#include "C16/Library.hpp"
using namespace C16;
void procedure_execute(const Database& database)
{
// Executes the main function of the procedure "P" and
// passes no arguments.
// Executes the main function of the procedure "P",
// passes no arguments and
// gets the return value (of type "alpha").
Value::Alpha return_alpha = database.procedures().execute("P");
// Executes the function "f" of the procedure "P" and
// passes literals as arguments (of type "alpha" and "int") by value.
database.procedures().execute("P:f", "abc", 123);
// Executes the function "f" of the procedure "P",
// passes literals as arguments (of type "alpha" and "int") by value and
// gets the return value (of type "int").
Value::Int return_int = database.procedures().execute("P:f", "abc", 123);
{
// Declares and defines constant arguments.
const Value::Alpha argument_alpha = "abc";
const Value::Int argument_int = 123;
// Executes the function "f" of the procedure "P" and
// passes variables as arguments by value.
database.procedures().execute("P:f", argument_alpha, argument_int);
}
{
// Declares and defines non-constant arguments.
Value::Alpha argument_alpha = "abc";
Value::Int argument_int = 123;
// Executes the function "f" of the procedure "P" and
// passes variables as arguments by reference.
database.procedures().execute("P:f", argument_alpha, argument_int);
}
}

Public Member Functions

Procedure::Execution execution (const std::string &procedure_name, const std::string &function_name) const
 Gets an execution of a function of a procedure. More...
 
Procedure::Execution execution (const std::string &function_name) const
 Gets an execution of a function of a procedure. More...
 
template<typename ... Arguments>
Variant execute (const std::string &function_name, Arguments &&... arguments) const
 Executes a function of a procedure. More...
 
virtual Procedure::Compilation::Error compile (const std::string &name) const =0
 Compiles a procedure and gets its error. More...
 
virtual Procedure::Compilation::Result compile_result (const std::string &name, Procedure::Compilation::ErrorLanguage error_language=Procedure::Compilation::ErrorLanguage::ENGLISH_US) const =0
 Compiles a procedure and gets its result. More...
 
- Public Member Functions inherited from C16::Texts
virtual Databasedatabase () const =0
 Gets the database of the texts. More...
 
virtual Result create (const std::string &name, Locking locking=Locking::NONE)=0
 Creates a text. More...
 
virtual Result erase (const std::string &name)=0
 Deletes a text. More...
 
virtual Result rename (const std::string &name, const std::string &name_renamed)=0
 Renames a text. More...
 
virtual Result copy (const std::string &name, const std::string &name_copy)=0
 Copies a text. More...
 

Member Function Documentation

◆ execution() [1/2]

Procedure::Execution C16::Procedures::execution ( const std::string &  procedure_name,
const std::string &  function_name 
) const

Gets an execution of a function of a procedure.

Parameters
procedure_nameName of the procedure
function_nameName of the function
See also
Procedure::execution

Referenced by execute().

◆ execution() [2/2]

Procedure::Execution C16::Procedures::execution ( const std::string &  function_name) const

Gets an execution of a function of a procedure.

Parameters
function_nameName of the function (including the name of the procedure)

The name of the function is of the form <procedure_name> [ :<name> ], where the parts in angle brackets (< ... >) contain the following data:

  • <procedure_name> – Name of the procedure.
  • <name> – Name of the function of the procedure.

Fragments in square brackets ([ ... ]) may be ommitted.

See also
Procedure::execution

◆ execute()

template<typename ... Arguments>
Variant C16::Procedures::execute ( const std::string &  function_name,
Arguments &&...  arguments 
) const
inline

Executes a function of a procedure.

Parameters
function_nameName of the function (including the name of the procedure)
argumentsArguments
Returns
Return value of the function
Exceptions
Procedure::Execution::ExceptionProcedure execution exception occurred.

The name of the function is of the form <procedure_name> [ :<name> ], where the parts in angle brackets (< ... >) contain the following data:

  • <procedure_name> – Name of the procedure.
  • <name> – Name of the function of the procedure.

Fragments in square brackets ([ ... ]) may be ommitted.

See also
Examples

References C16::Procedure::Execution::arguments_add(), C16::Procedure::Execution::execute_error_throw(), and execution().

◆ compile()

virtual Procedure::Compilation::Error C16::Procedures::compile ( const std::string &  name) const
pure virtual

Compiles a procedure and gets its error.

Parameters
nameName of the procedure (1 to Procedure::NAME_LENGTH_LIMIT characters)
Returns
Error
Exceptions
Exception::InvalidityName invalid.

◆ compile_result()

virtual Procedure::Compilation::Result C16::Procedures::compile_result ( const std::string &  name,
Procedure::Compilation::ErrorLanguage  error_language = Procedure::Compilation::ErrorLanguage::ENGLISH_US 
) const
pure virtual

Compiles a procedure and gets its result.

Parameters
nameName of the procedure (1 to Procedure::NAME_LENGTH_LIMIT characters)
error_languageLanguage of the error text
Returns
Result
Exceptions
Exception::InvalidityName invalid.
C16::Value::Int
std::int32_t Int
Integer number (signed, 32 bits).
Definition: Native.hpp:24
C16::Procedures::execute
Variant execute(const std::string &function_name, Arguments &&... arguments) const
Executes a function of a procedure.
Definition: Procedures.hpp:142
C16::Texts::database
virtual Database & database() const =0
Gets the database of the texts.
C16::Database::procedures
const Procedures & procedures() const
Gets the procedures of the database.
Library.hpp
CONZEPT 16 C++ API.
C16::Value::Alpha
std::string Alpha
String.
Definition: Native.hpp:16
C16::Database
Database hosted by a server.
Definition: Database.hpp:38
C16
Namespace.
Definition: Array.hpp:6