.gitignore: add some more IDE / tools related file
[babeltrace.git] / doc / api / libbabeltrace2 / dox / api-fund.dox
index 8c60e539f614c5d138fe095776e7ef8d6eef0d73..8f742e73f042431ec40b9a8dd814a2622efc64e8 100644 (file)
@@ -24,34 +24,51 @@ directory: the compiler prints an error when you try to.
 - All libbabeltrace2 definitions, macros, and enumerators start
   with \c BT_.
 
-@section api-fund-pre-post Function precondition and postcondition checking
+@section api-fund-pre-post Function contract checking
 
-All the functions of libbabeltrace2 which have parameters check that
-the caller meets their
+All the functions of libbabeltrace2 check that the caller meets their
 <a href="https://en.wikipedia.org/wiki/Precondition">preconditions</a>.
 
-All the functions of libbabeltrace2 which call a user function which
-returns something check that the returned value meets their
-<a href="https://en.wikipedia.org/wiki/Postcondition">postconditions</a>.
+All the functions of libbabeltrace2 which call a user function check
+that it meets its
+<a href="https://en.wikipedia.org/wiki/Postcondition">postconditions</a>
+when it returns.
 
 The function descriptions in the
-<a class="el" href="modules.html">API reference modules</a>
+<a class="el" href="topics.html">API reference</a>
 list all their preconditions and postconditions, if any.
 
-libbabeltrace2 is very strict regarding function preconditions and
-postconditions: when you break any of them, the library prints how the
-precondition or postcondition was not satisfied, with details, and then
-calls <code>abort()</code>.
+The libbabeltrace2 public functions offer a
+<strong>narrow contract</strong>: when you break it, the library
+prints how the precondition or postcondition was not satisfied, with
+details, and then calls <code>abort()</code>.
 
 Here's an example of what the library prints to the standard error
-before aborting when you break a precondition:
+before aborting when you break a precondition (call
+bt_value_bool_set() with a \c NULL value);
+\ref api-fund-logging "logging" prefixes are removed for clarity:
 
 @code{.unparsed}
-10-06 09:12:20.228 62362 62362 F LIB/VALUE bt_value_array_get_length@value.c:887 Babeltrace 2 library precondition not satisfied; error is:
-10-06 09:12:20.228 62362 62362 F LIB/VALUE bt_value_array_get_length@value.c:887 Value object is NULL:
-10-06 09:12:20.228 62362 62362 F LIB/VALUE bt_value_array_get_length@value.c:887 Aborting...
+Babeltrace 2 library precondition not satisfied.
+------------------------------------------------------------------------
+Condition ID: `pre:value-bool-set:not-null:value-object`.
+Function: bt_value_bool_set().
+------------------------------------------------------------------------
+Error is:
+Value object is NULL.
+Aborting...
 @endcode
 
+In the output above:
+
+- <code>pre:value-bool-set:not-null:value-object</code> is the unique,
+  permanent ID of this precondition.
+
+  We use this ID for internal libbabeltrace2 testing.
+
+- The <code>Function:</code> line shows which function's contract was
+  broken.
+
 Because precondition and postcondition checks detect programming errors,
 libbabeltrace2's approach is to abort as soon as possible so that you
 fix the error. Therefore, the libbabeltrace2 functions never return a
@@ -109,7 +126,7 @@ object type A inherits an object type B, then you can use both the A and
 B API functions with an object of type A. For example, because an
 \bt_enum_fc \em is conceptually an \bt_int_fc, you can use any integer
 field class function with an enumeration field class.
-The <a class="el" href="modules.html">API reference modules</a> always
+The <a class="el" href="topics.html">API reference pages</a> always
 indicate the inheritance relations.
 
 @subsection api-fund-object-shared-unique Shared vs. unique objects
@@ -182,7 +199,7 @@ Some \bt_name objects are \em shared while some others are \em unique:
 
     Because you cannot get a new unique object reference, you \em must
     ensure that you own the unique object's owner to keep it alive. The
-    <a class="el" href="modules.html">API reference modules</a> make it
+    <a class="el" href="topics.html">API reference pages</a> make it
     clear, depending on the context, which
     shared object is the ultimate owner of a given unique object.
 
@@ -195,7 +212,7 @@ Some \bt_name objects are \em shared while some others are \em unique:
   </dd>
 </dl>
 
-In the <a class="el" href="modules.html">API reference</a>, each module
+In the <a class="el" href="topics.html">API reference</a>, each page
 indicates whether the documented objects are shared or unique.
 
 @subsection api-fund-freezing Object freezing
@@ -216,7 +233,7 @@ When an object becomes frozen, its contained objects, if any, also
 become frozen, recursively.
 
 There's no function to check whether or not a given object is frozen.
-Because the <a class="el" href="modules.html">API reference modules</a>
+Because the <a class="el" href="topics.html">API reference pages</a>
 document which functions freeze which objects,
 the "frozen" property is only useful for libbabeltrace2 to catch
 programming errors (\ref api-fund-pre-post "precondition checks").
@@ -247,7 +264,7 @@ be contained in some collection. For example, all \bt_val objects have
 the type #bt_value because an \bt_array_val can contain different
 types of values. You must be careful to only call the functions which
 apply to a specific type of such objects.
-The <a class="el" href="modules.html">API reference modules</a> make
+The <a class="el" href="topics.html">API reference pages</a> make
 this clear in the precondition section. Such objects always have a
 <code>*_get_type()</code> function to get the object's exact type
 enumerator. For example, bt_value_get_type() returns the type enumerator
@@ -357,7 +374,7 @@ if (status != BT_VALUE_COPY_STATUS_OK) {
 }
 @endcode
 
-The <a class="el" href="modules.html">API reference modules</a>
+The <a class="el" href="topics.html">API reference pages</a>
 document, for each function, what each return status enumerator means.
 
 Some functions return properties or objects by output parameter. When
This page took 0.025292 seconds and 4 git commands to generate.