![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
Classes | |
| class | BitVector |
| class | Comparator< T > |
| class | StaticComparator< T, C > |
| class | DynamicComparator< T > |
| class | AssocComparator< K, T, C > |
| class | GlobalComparator< T > |
| class | CompareEquiv< C > |
| class | HashKey< T > |
| class | JenkinsHasher |
| class | SelfHashKey< T > |
| class | Initializer< T > |
| class | MessageException |
| class | Option< T > |
| class | Pair< T1, T2 > |
| class | Ref< T > |
| class | StrongType |
| class | SolidType< T > |
| class | TestCase |
| class | TestSet |
| class | VarArg |
| class | Version |
| class | Exception |
| class | UniquePtr< T > |
| class | SharedPtr< T > |
| class | LockPtr< T > |
| class | Flags< T > |
Macros | |
| #define | STRONG_TYPE(N, T) OTAWA_STRONG_TYPE(N, T) |
| #define | CHECK_BEGIN(name) ELM_CHECK_BEGIN(name) |
| #define | TEST_BEGIN(name) ELM_TEST_BEGIN(name) |
| #define | TEST_END ELM_TEST_END |
| #define | CHECK(tst) ELM_CHECK(tst) |
| #define | CHECK_END ELM_CHECK_END |
| #define | ELM_CHECK_BEGIN(name) { elm::TestCase __case(name); __case.prepare(); |
| #define | ELM_CHECK(tst) __case.check(__FILE__, __LINE__, #tst, tst) |
| #define | ELM_CHECK_END __case.complete(); } |
| #define | ELM_CHECK_EQUAL(res, ref) __case.check_equal(__FILE__, __LINE__, #res " == " #ref, res, ref) |
| #define | CHECK_EQUAL(res, ref) ELM_CHECK_EQUAL(res, ref) |
Functions | |
| t::hash | hash_jenkins (const void *block, int size) |
| t::hash | hash_string (const char *chars, int length) |
| t::hash | hash_cstring (const char *chars) |
| bool | hash_equals (const void *p1, const void *p2, int size) |
| template<class T > | |
| const T & | min (const T &x, const T &y) |
| template<class T > | |
| const T & | max (const T &x, const T &y) |
| template<class T > | |
| t::hash | hash (const T &x) |
This module contains classes providing miscellaneous services.
Other classes provides base classes to a unified exception system:
Some classes makes easier the management of structured values:
Finally, some classes provides facilities to handle references:
| #define CHECK | ( | tst | ) | ELM_CHECK(tst) |
#include <include/elm/test.h>
See ELM_CHECK.
| test | Test to check. |
@seealso ELM_CHECK, REQUIRE, CHECK_EQUAL, CHECK_EXCEPTION, FAIL_ON_EXCEPTION
| #define CHECK_BEGIN | ( | name | ) | ELM_CHECK_BEGIN(name) |
#include <include/elm/test.h>
This is the first statement of a unit test case. Usually, a unit test case is structured as below:
This statement display a state header, each CHECK displays a check status line and TEST_END a summary of the full test case. A test case defines also an environment like in C blocks { ... }.
| name | Name of the test case (string). |
@seealso CHECK_END, CHECK, elm::TestCase, elm::TestSet
| #define CHECK_END ELM_CHECK_END |
#include <include/elm/test.h>
See CHECK_END.
@seealso CHECK_BEGIN, CHECK, elm::TestCase, elm::TestSet
| #define CHECK_EQUAL | ( | res, | |
| ref | |||
| ) | ELM_CHECK_EQUAL(res, ref) |
#include <include/elm/test.h>
See ELM_CHECK_EQUAL.
| #define ELM_CHECK | ( | tst | ) | __case.check(__FILE__, __LINE__, #tst, tst) |
#include <include/elm/test.h>
Same as CHECK.
| #define ELM_CHECK_BEGIN | ( | name | ) | { elm::TestCase __case(name); __case.prepare(); |
#include <include/elm/test.h>
Same as CHECK_BEGIN.
| #define ELM_CHECK_END __case.complete(); } |
#include <include/elm/test.h>
Same as CHECK_END
| #define ELM_CHECK_EQUAL | ( | res, | |
| ref | |||
| ) | __case.check_equal(__FILE__, __LINE__, #res " == " #ref, res, ref) |
#include <include/elm/test.h>
Test if the result of a test is equal to a reference value.
| res | Result of the test. |
| ref | Reference value. |
@seealso CHECK, REQUIRE, CHECK_EXCEPTION, FAIL_ON_EXCEPTION
| #define STRONG_TYPE | ( | N, | |
| T | |||
| ) | OTAWA_STRONG_TYPE(N, T) |
#include <include/elm/util/strong_type.h>
As type defined with "typedef" command just create aliases to types, they cannot be used to resolve overloading. To circumvent this problem, this macro provide a wrapper around the defined type that is usable as the original type and that provide overload facilities.
This class is usually replaced this kind of declaration:
by :
| N | Name of the new type. |
| T | Encapsulated type. |
| #define TEST_BEGIN | ( | name | ) | ELM_TEST_BEGIN(name) |
#include <include/elm/test.h>
This macro is used to create and to record an integrated test case. Following the macro must be inserted the checked tests with macros based on CHECK and the test must be ended by the macro TEST_END.
| test | Name of the test (must be unquoted !). |
@seealso TEST_END, CHECK, elm::TestCase, elm::TestSet
| #define TEST_END ELM_TEST_END |
#include <include/elm/test.h>
End a test declared with TEST_BEGIN.
@seealso TEST_BEGIN, CHECK, elm::TestCase, elm::TestSet
|
inline |
#include <include/elm/hash.h>
Hash the given value according an existing HashKey implementation for type T. If no hash key is available for the given type, revert to Jenkins hashing that may be inexact in case of padding bytes inside an object!
| x | Value to hash. |
References HashKey< T >::hash().
Referenced by HashKey< const T * >::computeHash(), HashKey< T * >::computeHash(), HashKey< sys::Path >::hash(), and elm::hash_jenkins().
| t::hash hash_cstring | ( | const char * | chars | ) |
#include <include/elm/hash.h>
Use a classical compiler string hashing algorithm (see "The Compilers" by Aho, Sethi, Ullman).
Referenced by HashKey< CString >::hash().
#include <include/elm/hash.h>
Test equality of two memory blocks.
| p1 | First memory block. |
| p2 | Second memory block. |
| size | Block size. |
#include <include/elm/hash.h>
Perform hashing according Jenkins approach (https://en.wikipedia.org/wiki/Jenkins_hash_function).
References elm::hash(), and elm::io::p().
Referenced by HashKey< T >::hash().
| t::hash hash_string | ( | const char * | chars, |
| int | length | ||
| ) |
#include <include/elm/hash.h>
Use a classical compiler string hashing algorithm (see "The Compilers" by Aho, Sethi, Ullman).
Referenced by HashKey< String >::hash().
|
inline |
#include <include/elm/compare.h>
Get the maximum of two values using Comparator<T>.
| v1 | First value. |
| v2 | Second value. |
Referenced by AbstractBlockAllocatorWithGC::AbstractBlockAllocatorWithGC(), Output::print(), elm::quicksort(), AbstractTree::rotateLeft(), and AbstractTree::rotateRight().
|
inline |
#include <include/elm/compare.h>
Get the minimum of two values using Comparator<T>.
| v1 | First value. |
| v2 | Second value. |
Referenced by Array< T >::copy(), WAHVector::includes(), BitVector::meets(), MD5::put(), BitVector::resize(), AbstractTree::rotateLeft(), and AbstractTree::rotateRight().