As we have seen from the examples, the PlTerm
class
plays a central role in conversion and operating on Prolog data. This
section provides complete documentation of this class.
There are a number of subclasses that exist only to provide a safe
way of constructing at term. There is also a subclass (PlTermScoped
)
that helps reclaim terms.
Most of the PlTerm
constructors are defined as
subclasses of
PlTerm
, with a name that reflects the Prolog type of what
is being created (e.g., PlTerm_atom
creates a term from an
atom;
PlTerm_string
creates a term from a Prolog string). This is
done to ensure that the there is no ambiguity in the constructors - for
example, there is no way to distinguish between term_t
,
atom_t
, and ordinary integers, so there are constructors
PlTerm(), PlTerm_atom(), and PlTerm_integer. All of the
constructors are “explicit” because implicit creation of PlTerm
objects can lead to subtle and difficult to debug errors.
If a constructor fails (e.g., out of memory), a PlException
is thrown. The class and subclass constructors are as follows.
- PlTerm :: PlTerm(PlAtom a)
- Creates a term reference containing an atom, using PL_put_atom().
It is the same as PlTerm_atom().
- PlTerm :: PlTerm(term_t t)
- Creates a term reference from a C term (by wrapping it). As this is a
lightweight class, this is a no-op in the generated code.
- PlTerm :: PlTerm(PlRecord r)
- Creates a term reference from a record, using PL_recorded().
- PlTerm_atom :: PlTerm_atom(atom_t a)
- Creates a term reference containing an atom.
- PlTerm_atom :: PlTerm_atom(PlAtom a)
- Creates a term reference containing an atom.
- PlTerm_atom :: PlTerm_atom(const char *text)
- Creates a term reference containing an atom, after creating the atom
from the text.
- PlTerm_atom :: PlTerm_atom(const wchar_t *text)
- Creates a term reference containing an atom, after creating the atom
from the text.
- PlTerm_atom :: PlTerm_atom(const std::string&
text)
- Creates a term reference containing an atom, after creating the atom
from the text.
- PlTerm_atom :: PlTerm_atom(const std::wstring&
text)
- Creates a term reference containing an atom, after creating the atom
from the text.
- PlTerm_var :: PlTerm_var()
- Creates a term reference for an uninstantiated variable. Typically this
term is then unified with another object.
- PlTerm_term_t :: PlTerm_term_t()
- Creates a term reference from a C
term_t
. This is a
lightweight class, so no code is generated.
- PlTerm_integer :: PlTerm_integer()
- Subclass of
PlTerm
with constructors for building a term
that contains a Prolog integer from a
long
.9PL_put_integer()
takes a long
argument.
- PlTerm_int64 :: PlTerm_int64()
- Subclass of
PlTerm
with constructors for building a term
that contains a Prolog integer from a int64_t
.
- PlTerm_uint64 :: PlTerm_uint64()
- Subclass of
PlTerm
with constructors for building a term
that contains a Prolog integer from a uint64_t
.
- PlTerm_size_t :: PlTerm_size_t()
- Subclass of
PlTerm
with constructors for building a term
that contains a Prolog integer from a size_t
.
- PlTerm_float :: PlTerm_float()
- Subclass of
PlTerm
with constructors for building a term
that contains a Prolog float.
- PlTerm_pointer :: PlTerm_pointer()
- Subclass of
PlTerm
with constructors for building a term
that contains a raw pointer. This is mainly for backwards compatibility;
new code should use blobs. A pointer is represented in Prolog
as a mangled integer. The mangling is designed to make most pointers fit
into a tagged-integer. Any valid pointer can be represented.
This mechanism can be used to represent pointers to C++ objects in
Prolog. Please note that MyClass
should define conversion
to and from void *
.
PREDICATE(make_my_object, 1)
{ auto myobj = new MyClass();
return A1.unify_pointer(myobj);
}
PREDICATE(my_object_contents, 2)
{ auto myobj = static_cast<MyClass*>(A1.as_pointer());
return A2.unify_string(myobj->contents);
}
PREDICATE(free_my_object, 1)
{ auto myobj = static_cast<MyClass*>(A1.as_pointer());
delete myobj;
return true;
}
- PlTerm_string :: PlTerm_string()
- Subclass of
PlTerm
with constructors for building a term
that contains a Prolog string object. For constructing a term from the
text form, see
PlCompound
.
- PlTerm_list_codes :: PlTerm_list_codes()
- Subclass of
PlTerm
with constructors for building Prolog
lists of character integer values.
- PlTerm_chars :: PlTerm_chars()
- Subclass of
PlTerm
with constructors for building Prolog
lists of one-character atoms (as atom_chars/2).
- PlTerm_tail :: PlTerm_tail()
- SubClass of
PlTerm
for building and analysing Prolog lists.
The methods are:
- bool PlTerm::get_atom(PlAtom*
a)
- Wrapper of PL_get_atom(), throwing an exception on Prolog error.
- bool PlTerm::get_bool(int*
value)
- Wrapper of PL_get_bool(), throwing an exception on Prolog error.
- chars PlTerm::get_chars(char**s,
unsigned int flags)
- Wrapper of PL_get_chars(), throwing an exception on Prolog error.
- chars PlTerm::get_list_chars(char**s,
unsigned int flags)
- Wrapper of PL_get_list_chars(), throwing an exception on Prolog
error.
- bool PlTerm::get_list_chars(char
**s, unsigned int flags)
- Wrappper of PL_get_list_chars(), throwing an exception on Prolog
error.
- bool PlTerm::get_atom_nchars(size_t
*len, char **a)
- Wrappper of PL_get_atom_nchars(), throwing an exception on Prolog
error.
- bool PlTerm::get_list_nchars(size_t
*len, char **s, unsigned int flags)
- Wrappper of PL_get_list_nchars(), throwing an exception on Prolog
error.
- bool PlTerm::get_nchars(size_t
*len, char **s, unsigned int flags)
- Wrappper of PL_get_nchars(), throwing an exception on Prolog
error. Deprecated: see PlTerm::get_nchars(flags)
that returns a
std::string
. If you use this, be sure to
wrap it with PlStringBuffers
, and if you use the BUF_MALLOC
flag, you can use std::unique_ptr<char, decltype(&PL_free)>
to manage the pointer.
- bool PlTerm::get_wchars(size_t
*length, pl_wchar_t **s, unsigned flags)
- Wrappper of PL_get_wchars(), throwing an exception on Prolog
error. Deprecated: see PlTerm::getwchars(flags) that returns a
std::wstring
.
If you use this, be sure to wrap it with PlStringBuffers
,
and if you use the BUF_MALLOC
flag, you can use std::unique_ptr<char,
decltype(&PL_close)>
to manage the pointer.
- bool PlTerm::get_integer(int
*i)
- Wrappper of PL_get_integer(), throwing an exception on Prolog
error.
- bool PlTerm::get_long(long
*i)
- Wrappper of PL_get_long(), throwing an exception on Prolog error.
- bool PlTerm::get_intptr(intptr_t
*i)
- Wrappper of PL_get_intptr(), throwing an exception on Prolog
error.
- bool PlTerm::get_pointer(void
**ptr)
- Wrappper of PL_get_pointer(), throwing an exception on Prolog
error.
- bool PlTerm::get_float(double
*f)
- Wrapper Plx_get_float(), throwing an exception on Prolog error.
- bool PlTerm::get_functor(PlFunctor
*f)
- Wrappper of PL_get_functor(), throwing an exception on Prolog
error.
- bool PlTerm::get_name_arity(PlAtom
*name, size_t *arity)
- Wrappper of PL_get_name_arity(), throwing an exception on Prolog
error.
- bool PlTerm::get_compound_name_arity(PlAtom
*name, size_t *arity)
- Wrappper of PL_get_compound_name_arity(), throwing an exception
on Prolog error.
- bool PlTerm::get_module(PlModule
*module)
- Wrappper of PL_get_module(), throwing an exception on Prolog
error.
- bool PlTerm::get_arg(size_t
index, PlTerm a)
- Wrappper of PL_get_arg(index,), throwing an exception on Prolog
error.
- bool PlTerm::get_dict_key(PlAtom
key, PlTerm dict, PlTerm value)
- Wrappper of PL_get_dict_key(key.), throwing an exception on
Prolog error.
- bool PlTerm::get_list(PlTerm
h, PlTerm t)
- Wrappper of PL_get_list(), throwing an exception on Prolog error.
- bool PlTerm::get_head(PlTerm
h)
- Wrappper of PL_get_head(), throwing an exception on Prolog error.
- bool PlTerm::get_tail(PlTerm
t)
- Wrappper of PL_get_tail(), throwing an exception on Prolog error.
- bool PlTerm::get_nil()
- Wrappper of PL_get_nil(), throwing an exception on Prolog error.
- bool PlTerm::get_blob(void
**blob, size_t *len, PL_blob_t **type)
- Wrappper of PL_get_blob(), throwing an exception on Prolog error.
- bool PlTerm::get_file_name(char
**name, int flags)
- Wrappper of PL_get_file_name() (does not throw a C++ exception).
- bool PlTerm::get_file_nameW(wchar_t
**name, int flags)
- Wrappper of PL_get_file_nameW(), (does not throw a C++
exception).
- std::string PlTerm::get_file_name(char
**name, int flags)
- Wrapper of PL_get_file_name(), ignoring
PL_FILE_NOERRORS
- throws PlFail
on failure, which is interpreted by the
enclosing PREDICATE
as either failure or an error,
depending on the flag bit PL_FILE_NOERRORS
.
- std::wstring PlTerm::get_file_nameW(int
flags)
- Same as PlTerm::get_file_name(),
but returns a wide-character string.
- bool PlTerm::get_attr(term_t
a)
- Wrappper of PL_get_attr(), throwing an exception on Prolog error.
- void PlTerm::get_atom_ex(PlAtom
*a)
- Wrapper of PL_get_atom_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_integer_ex(int
*i)
- Wrapper of PL_get_integer_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_long_ex(long
*i)
- Wrapper of PL_get_long_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_int64_ex(int64_t
*i)
- Wrapper of PL_get_int64_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_uint64_ex(uint64_t
*i)
- Wrapper of PL_get_uint64_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_intptr_ex(intptr_t
*i)
- Wrapper of PL_get_intptr_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_size_ex(size_t
*i)
- Wrapper of PL_get_size_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_bool_ex(int
*i)
- Wrapper of PL_get_bool_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_float_ex(double
*f)
- Wrapper of PL_get_float_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_char_ex(int
*p, int eof)
- Wrapper of PL_get_char_ex(), throwing an exception on Prolog
error.
- void PlTerm::unify_bool_ex(int
val)
- Wrapper of PL_unify_bool_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_pointer_ex(void
**addrp)
- Wrapper of PL_get_pointer_ex(), throwing an exception on Prolog
error.
- bool PlTerm::unify_list_ex(PlTerm
h, PlTerm t)
- Wrappper of PL_unify_list_ex(), throwing an exception on Prolog
error.
- void PlTerm::unify_nil_ex()
- Wrapper of PL_unify_nil_ex(), throwing an exception on Prolog
error.
- bool PlTerm::get_list_ex(PlTerm
h, PlTerm t)
- Wrappper of PL_get_list_ex(), throwing an exception on Prolog
error.
- void PlTerm::get_nil_ex()
- Wrapper of PL_get_nil_ex(), throwing an exception on Prolog
error.
- int PlTerm::type()
- Wrapper of PL_term_type(unwrap()), returning
PL_VARIABLE
, PL_ATOM
,
etc, throwing an exception on Prolog error. bo
- ol PlTerm::is_attvar()
- Wrappper of PL_is_attvar(), throwing an exception on Prolog
error.
- bool PlTerm::is_variable()
- Wrappper of PL_is_variable(), throwing an exception on Prolog
error.
- bool PlTerm::is_ground()
- Wrappper of PL_is_ground(), throwing an exception on Prolog
error.
- bool PlTerm::is_atom()
- Wrappper of PL_is_atom(), throwing an exception on Prolog error.
- bool PlTerm::is_integer()
- Wrappper of PL_is_integer(), throwing an exception on Prolog
error.
- bool PlTerm::is_string()
- Wrappper of PL_is_string(), throwing an exception on Prolog
error.
- bool PlTerm::is_atom_or_string()
is_atom()
or is_string()
.
- bool PlTerm::is_float()
- Wrappper of PL_is_float(), throwing an exception on Prolog error.
- bool PlTerm::is_rational()
- Wrappper of PL_is_rational(), throwing an exception on Prolog
error.
- bool PlTerm::is_compound()
- Wrappper of PL_is_compound(), throwing an exception on Prolog
error.
- bool PlTerm::is_callable()
- Wrappper of PL_is_callable(), throwing an exception on Prolog
error.
- bool PlTerm::is_list()
- Wrappper of PL_is_list(), throwing an exception on Prolog error.
- bool PlTerm::is_dict()
- Wrappper of PL_is_dict(), throwing an exception on Prolog error.
- bool PlTerm::is_pair()
- Wrappper of PL_is_pair(), throwing an exception on Prolog error.
- bool PlTerm::is_atomic()
- Wrappper of PL_is_atomic(), throwing an exception on Prolog
error.
- bool PlTerm::is_number()
- Wrappper of PL_is_number(), throwing an exception on Prolog
error.
- bool PlTerm::is_acyclic()
- Wrappper of PL_is_acyclic(), throwing an exception on Prolog
error.
- bool PlTerm::is_functor(PlFunctor
f)
- Wrappper of PL_is_functor(), throwing an exception on Prolog
error.
- bool PlTerm::is_blob(PL_blob_t
**type)
- Wrappper of PL_is_blob(), throwing an exception on Prolog error.
- void PlTerm::must_be_attvar()
- Throw
PlTypeError
if PlTerm::is_attvar()
fails.
- void PlTerm::must_be_variable()
- Throw
PlTypeError
if PlTerm::is_variable()
fails.
- void PlTerm::must_be_ground()
- Throw
PlTypeError
if PlTerm::is_ground()
fails.
- void PlTerm::must_be_atom()
- Throw
PlTypeError
if PlTerm::is_atom()
fails.
- void PlTerm::must_be_integer()
- Throw
PlTypeError
if PlTerm::is_integer()
fails.
- void PlTerm::must_be_string()
- Throw
PlTypeError
if PlTerm::is_string()
fails.
- void PlTerm::must_be_atom_or_string()
- Throw
PlTypeError
if PlTerm::is_atom_or_string()
fails.
- void PlTerm::must_be_float()
- Throw
PlTypeError
if PlTerm::is_float()
fails.
- void PlTerm::must_be_rational()
- Throw
PlTypeError
if PlTerm::is_rational()
fails.
- void PlTerm::must_be_compound()
- Throw
PlTypeError
if PlTerm::is_compound()
fails.
- void PlTerm::must_be_callable()
- Throw
PlTypeError
if PlTerm::is_callable()
fails.
- void PlTerm::must_be_list()
- Throw
PlTypeError
if PlTerm::is_list()
fails.
- void PlTerm::must_be_dict()
- Throw
PlTypeError
if PlTerm::is_dict()
fails.
- void PlTerm::must_be_pair()
- Throw
PlTypeError
if PlTerm::is_pair()
fails.
- void PlTerm::must_be_atomic()
- Throw
PlTypeError
if PlTerm::is_atomic()
fails.
- void PlTerm::must_be_number()
- Throw
PlTypeError
if PlTerm::is_number()
fails.
- void PlTerm::must_be_acyclic()
- Throw
PlTypeError
if PlTerm::is_acyclic()
fails.
- void PlTerm::put_variable()
- Wrapper of PL_put_variable(), throwing an exception on Prolog
error.
- void PlTerm::put_atom(PlAtom
a)
- Wrapper of PL_put_atom(), throwing an exception on Prolog error.
- void PlTerm::put_bool(int
val)
- Wrapper of PL_put_bool(), throwing an exception on Prolog error.
- void PlTerm::put_atom_chars(const
char *chars)
- Wrapper of PL_put_atom_chars(), throwing an exception on Prolog
error.
- void PlTerm::put_string_chars(const
char *chars)
- Wrapper of PL_put_string_chars(), throwing an exception on Prolog
error.
- void PlTerm::put_chars(int
flags, size_t len, const char *chars)
- Wrapper of PL_put_chars(), throwing an exception on Prolog error.
- void PlTerm::put_list_chars(const
char *chars)
- Wrapper of PL_put_list_chars(), throwing an exception on Prolog
error.
- void PlTerm::put_list_codes(const
char *chars)
- Wrapper of PL_put_list_codes(), throwing an exception on Prolog
error.
- void PlTerm::put_atom_nchars(size_t
l, const char *chars)
- Wrapper of PL_put_atom_nchars(), throwing an exception on Prolog
error.
- void PlTerm::put_string_nchars(size_t
len, const char *chars)
- Wrapper of PL_put_string_nchars(), throwing an exception on
Prolog error.
- void PlTerm::put_list_nchars(size_t
l, const char *chars)
- Wrapper of PL_put_list_nchars(), throwing an exception on Prolog
error.
- void PlTerm::put_list_ncodes(size_t
l, const char *chars)
- Wrapper of PL_put_list_ncodes(), throwing an exception on Prolog
error.
- void PlTerm::put_integer(long
i)
- Wrapper of PL_put_integer(), throwing an exception on Prolog
error.
- void PlTerm::put_pointer(void
*ptr)
- Wrapper of PL_put_pointer(), throwing an exception on Prolog
error.
- void PlTerm::put_float(double
f)
- Wrapper of PL_put_float(), throwing an exception on Prolog error.
- void PlTerm::put_functor(PlFunctor
functor)
- Wrapper of PL_put_functor(), throwing an exception on Prolog
error.
- void PlTerm::put_list()
- Wrapper of PL_put_list(), throwing an exception on Prolog error.
- void PlTerm::put_nil()
- Wrapper of PL_put_nil(), throwing an exception on Prolog error.
- void PlTerm::put_term(PlTerm
t2)
- Wrapper of PL_put_term(), throwing an exception on Prolog error.
- void PlTerm::put_blob(void
*blob, size_t len, PL_blob_t *type)
- Wrapper of PL_put_blob(), throwing an exception on Prolog error.
- PlRecord PlTerm::record()
- Returns a
PlRecord
constructed from the term. Same as PlRecord(*this).
- void PlTerm::integer(bool
*v)
- Wrapper of PL_cvt_i_bool().
- void PlTerm::integer(char
*v)
- Wrapper of PL_cvt_i_char().
- void PlTerm::integer(int
*v)
- Wrapper of PL_cvt_i_int().
- void PlTerm::integer(long
*v)
- Wrapper of PL_cvt_i_long().
- void PlTerm::integer(long
long *v)
- Wrapper of PL_cvt_i_llong().
- void PlTerm::integer(short
*v)
- Wrapper of PL_cvt_i_short().
- void PlTerm::integer(signed
char *v)
- Wrapper of PL_cvt_i_schar().
- void PlTerm::integer(unsigned
char *v)
- Wrapper of PL_cvt_i_uchar().
- void PlTerm::integer(unsigned
int *v)
- Wrapper of PL_cvt_i_uint().
- void PlTerm::integer(unsigned
long *v)
- Wrapper of PL_cvt_i_ulong().
- void PlTerm::integer(unsigned
long long *v)
- Wrapper of PL_cvt_i_ullong().
- void PlTerm::integer(unsigned
short *v)
- Wrapper of PL_cvt_i_ushort().
- const std::string PlTerm::as_string(PlEncoding
enc=ENC_OUTPUT)
- Calls PlTerm::get_nchars(CVT_ALL|CVT_WRITEQ|CVT_EXCEPTION).
This method is provided mainly for debugging.
The definition is subject to change in future - if you want
precise control, use PlTerm::get_nchars().
- const std::wstring PlTerm::as_wstring()
- Calls PlTerm::get_wchars(CVT_ALL|CVT_WRITEQ|CVT_EXCEPTION).
This method is provided mainly for debugging.
The definition is subject to change in future - if you want
precise control, use PlTerm::get_nchars().
- long PlTerm::as_long()
- Wrapper of PL_cvt_i_*().
- int32_t PlTerm::as_int32_t()
- Wrapper of PL_cvt_i_*().
- uint32_t PlTerm::as_uint32_t()
- Wrapper of PL_cvt_i_*().
- uint64_t PlTerm::as_uint64_t()
- Wrapper of PL_cvt_i_*().
- int64_t PlTerm::as_int64_t()
- Wrapper of PL_cvt_i_*().
- size_t PlTerm::as_size_t()
- Wrapper of PL_cvt_i_*().
- int PlTerm::as_int()
- Wrapper of PL_cvt_i_*().
- unsigned PlTerm::as_uint()
- Wrapper of PL_cvt_i_*().
- unsigned long PlTerm::as_ulong()
- Wrapper of PL_cvt_i_*().
- bool PlTerm::as_bool()
- Wrapper of PL_cvt_i_*().
- void PlTerm::as_nil()
- Wrapper of PL_get_nil_ex(), throwing an exception if the term
isn't “nil” .
- double PlTerm::as_float()
- Wrapper of PL_get_float_ex(), throwing an exception if the term
isn't a float.
- double PlTerm::as_double()
- Wrapper of PL_get_float_ex(), throwing an exception if the term
isn't a float.
- void * PlTerm::as_pointer()
- (Deprecated: should use blob API). Wrapper of PL_get_pointer_ex(),
throwing an exception if the term isn't a blob.
- const std::string PlTerm::get_nchars(unsigned
int flags)
- Calls PL_get_nchars(..., flags) and converts the result to a
std::string
.
The flags BUF_MALLOC
, BUF_STACK
, and BUF_ALLOW_STACK
are ignored and replaced by BUF_DISCARDABLE
.
- const std::wstring PlTerm::get_wchars(unsigned
int flags)
- Calls PL_get_wchars(..., flags) and converts the result to a
std::wstring
.
The flags BUF_MALLOC
, BUF_STACK
, and BUF_ALLOW_STACK
are ignored and replaced by BUF_DISCARDABLE
.
- PlAtom PlTerm::as_atom()
- Wrapper of PL_get_atom_ex(), throwing an exception if the term is
not an atom.
- bool PlTerm::eq_if_atom(PlAtom
a)
- Returns true if the term is an atom and equal to a.
- PlTerm::operator[] size_t
index(W)
- rapper for PL_get_arg(), throwing an exception if the term isn't
a compound or the index is out of range.
- size_t PlTerm::arity()
- Gets the arity of the term; throws
PlTypeError
if not a
"compound" or atom.
- PlAtom PlTerm::name()
- Gets the name of the term;
PlTypeError
if not a "compound"
or atom.
- bool name_arity(PlAtom
*name, size_t *arity)
- Wrapper of PL_get_name_arity(); name and/or arity
can be
nullptr
. Returns false
if the term
isn't a compound or atom.
- PlTerm PlTerm::copy_term_ref()
- Wrapper of PL_copy_term_ref(). Throws an exception error (e.g.,
PlResourceError
).
- void PlTerm::free_term_ref()
- Wrapper of PL_free_term_ref(). Is safe to use if the object wraps
PlTerm::null
.
Does not reset the wrapped term. This is used implicitly in
PlTermScoped
’s destructor, which does reset the
wrapped term.
- void PlTerm::free_term_ref_reset()
- Same as
PlTerm::free_term_ref()
plus PlTerm::reset().
PlTermScoped
’s destructor, which does reset the
wrapped term.
- bool nify_term(PlTerm
t2)
- Wrapper of PL_unify(). Throws an exception on error and returns
false
if unification fails. If on failure, there isn't an immediate return to
Prolog (e.g., by wrapping the call with
PlCheckFail()), this method
should be called within the context of PlFrame
, and PlFrame::rewind()
should be called.
- bool PlTerm::unify_atom(PlAtom
a)
- Wrapper of PL_unify_atom(), throwing an exception on error.
- bool PlTerm::unify_chars(int
flags, size_t len, const char *s)
- Wrapper of PL_unify_chars(), throwing an exception on error.
- bool PlTerm::unify_chars(int
flags, const std::string& s)
- Wrapper of PL_unify_chars(), throwing an exception on error.
- bool PlTerm::unify_atom(const
char* v)
- Wrapper of PL_unify_atom_chars(), throwing an exception on error.
- bool PlTerm::unify_atom(const
wchar_t* v)
- Wrapper of PL_unify_wchars(), throwing an exception on error.
- bool PlTerm::unify_atom(const
std::string& v)
- Wrapper of PL_unify_atom_nchars(), throwing an exception on
error.
- bool PlTerm::unify_atom(const
std::wstring& v)
- Wrapper of PL_unify_wchars(), throwing an exception on error.
cfunctionboolPlTerm::unify_integerbool v Wrapper of PL_unify_int64(),
throwing an exception on error.
- bool PlTerm::unify_integer(char
v)
- Wrapper of PL_unify_int64(), throwing an exception on error.
- bool PlTerm::unify_integer(int
v)
- Wrapper of PL_unify_int64(), throwing an exception on error.
- bool PlTerm::unify_integer(long
v)
- Wrapper of PL_unify_int64(), throwing an exception on error.
- bool PlTerm::unify_integer(long
long v)
- Wrapper of PL_unify_int64(), throwing an exception on error.
- bool PlTerm::unify_integer(short
v)
- Wrapper of PL_unify_int64(), throwing an exception on error.
- bool PlTerm::unify_integer(signed
char v)
- Wrapper of PL_unify_int64(), throwing an exception on error.
- bool PlTerm::unify_integer(unsigned
char v)
- Wrapper of PL_unify_uint64(), throwing an exception on error.
- bool PlTerm::unify_integer(unsigned
int v)
- Wrapper of PL_unify_uint64(), throwing an exception on error.
- bool PlTerm::unify_integer(unsigned
long v)
- Wrapper of PL_unify_uint64(), throwing an exception on error.
- bool PlTerm::unify_integer(unsigned
long long v)
- Wrapper of PL_unify_uint64(), throwing an exception on error.
- bool PlTerm::unify_integer(unsigned
short v)
- Wrapper of PL_unify_uint64(), throwing an exception on error.
- bool PlTerm::unify_float(double
v)
- Wrapper of PL_unify_float(), throwing an exception on error.
- bool PlTerm::unify_string(const
std::string& v)
- Wrapper of PL_unify_string_nchars(), throwing an exception on
error.
- bool PlTerm::unify_string(const
std::wstring& v)
- Wrapper of PL_unify_wchars(), throwing an exception on error.
- bool PlTerm::unify_functor(PlFunctor
f)
- Wrapper of PL_unify_functor(), throwing an exception on error.
- bool PlTerm::unify_pointer(void
*ptr)
- Wrapper of PL_unify_pointer(), throwing an exception on error. An
alternative to this is to use a blob that wraps a pointer - see section
1.6.8.7.
- bool PlTerm::unify_nil()
- Wrapper of PL_unify_nil(), throwing an exception on error.
- bool PlTerm::unify_list(PlTerm
h, PlTerm t)
- Wrapper of PL_unify_list(), throwing an exception on error.
- bool PlTerm::unify_bool(bool
val)
- Wrapper of PL_unify_bool(), throwing an exception on error.
- bool PlTerm::unify_blob(const
PlBlob* blob)
- Wrapper of PL_unify_blob(), throwing an exception on error.
- bool PlTerm::unify_blob(const
void *blob, size_t len, const PL_blob_t *type)
- Wrapper of PL_unify_blob(), throwing an exception on error.
- int PlTerm::compare(PlTerm
t2)
- Wrapper for PL_compare(), returning -1, 0, 1 for the result of
standard order comparison of the term with a2.
- bool operator
==(PlTerm t2)
compare(t2) == 0
.
- bool operator
!=(PlTerm t2)
compare(t2) != 0
.
- bool operator
<(PlTerm t2)
compare(t2) < 0
.
- bool operator
>(PlTerm t2)
compare(t2) > 0
.
- bool operator
<=(PlTerm t2)
compare(t2) <= 0
.
- bool operator
>=(PlTerm t2)
compare(t2) >= 0
.
- int write(IOSTREAM
*s, int precedence, int flags)
- Wrapper for PL_write_term().
- void reset_term_refs()
- Wrapper for PL_reset_term_refs().
- bool call(PlModule
module)
- Wrapper for PL_call(unwrap()); module defaults to “null” .
Throws a C++ exception if there's a Prolog error, otherwise returns the
success or failure of the call.