From a78687686f5b490d99fae21f9fa8aaa9a34f1812 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.a@mailoo.org>
Date: Mon, 24 Nov 2014 00:51:30 +0100
Subject: [PATCH 1/1] initial commit

---
 AUTHORS                |   13 +
 INSTALL                |    9 +
 LICENSE                |   21 +
 Makefile               |   31 +
 README.md              |   16 +
 cgds                   |    1 +
 doc/.gitignore         |    2 +
 doc/Doxyfile           | 1890 ++++++++++++++++++++++++++++++++++++++++
 doc/Makefile           |   10 +
 makeMakefile.sh        |   27 +
 src/.gitignore         |    2 +
 src/BufferTop.c        |   96 ++
 src/BufferTop.h        |  138 +++
 src/Heap.c             |  180 ++++
 src/Heap.h             |  206 +++++
 src/List.c             |  218 +++++
 src/List.h             |  374 ++++++++
 src/Makefile.base      |   13 +
 src/PriorityQueue.c    |   56 ++
 src/PriorityQueue.h    |  135 +++
 src/Queue.c            |   85 ++
 src/Queue.h            |  141 +++
 src/Stack.c            |   84 ++
 src/Stack.h            |  137 +++
 src/Tree.c             |  323 +++++++
 src/Tree.h             |  336 +++++++
 src/Vector.c           |  160 ++++
 src/Vector.h           |  269 ++++++
 src/cds.h              |   13 +
 src/safe_alloc.c       |   44 +
 src/safe_alloc.h       |   45 +
 src/types.h            |   51 ++
 test/.gitignore        |    2 +
 test/Makefile.base     |   13 +
 test/helpers.h         |   15 +
 test/lut.h             |   36 +
 test/main.c            |   62 ++
 test/makeMain.sh       |   20 +
 test/t.BufferTop.c     |  160 ++++
 test/t.Heap.c          |  172 ++++
 test/t.List.c          |  160 ++++
 test/t.PriorityQueue.c |  172 ++++
 test/t.Queue.c         |  130 +++
 test/t.Stack.c         |  131 +++
 test/t.Tree.c          |  140 +++
 test/t.Vector.c        |  148 ++++
 46 files changed, 6487 insertions(+)
 create mode 100644 AUTHORS
 create mode 100644 INSTALL
 create mode 100644 LICENSE
 create mode 100644 Makefile
 create mode 100644 README.md
 create mode 120000 cgds
 create mode 100644 doc/.gitignore
 create mode 100644 doc/Doxyfile
 create mode 100644 doc/Makefile
 create mode 100644 makeMakefile.sh
 create mode 100644 src/.gitignore
 create mode 100644 src/BufferTop.c
 create mode 100644 src/BufferTop.h
 create mode 100644 src/Heap.c
 create mode 100644 src/Heap.h
 create mode 100644 src/List.c
 create mode 100644 src/List.h
 create mode 100644 src/Makefile.base
 create mode 100644 src/PriorityQueue.c
 create mode 100644 src/PriorityQueue.h
 create mode 100644 src/Queue.c
 create mode 100644 src/Queue.h
 create mode 100644 src/Stack.c
 create mode 100644 src/Stack.h
 create mode 100644 src/Tree.c
 create mode 100644 src/Tree.h
 create mode 100644 src/Vector.c
 create mode 100644 src/Vector.h
 create mode 100644 src/cds.h
 create mode 100644 src/safe_alloc.c
 create mode 100644 src/safe_alloc.h
 create mode 100644 src/types.h
 create mode 100644 test/.gitignore
 create mode 100644 test/Makefile.base
 create mode 100644 test/helpers.h
 create mode 100644 test/lut.h
 create mode 100644 test/main.c
 create mode 100644 test/makeMain.sh
 create mode 100644 test/t.BufferTop.c
 create mode 100644 test/t.Heap.c
 create mode 100644 test/t.List.c
 create mode 100644 test/t.PriorityQueue.c
 create mode 100644 test/t.Queue.c
 create mode 100644 test/t.Stack.c
 create mode 100644 test/t.Tree.c
 create mode 100644 test/t.Vector.c

diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..e81aef4
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,13 @@
+#Document updated on 2013-07-22.
+################################
+
+#Active developers.
+
+Years    | Name               | Contact email
+---------|--------------------|--------------------------
+2013-now | Benjamin Auder     | benjamin.auder@gmail.com
+
+#Past code contributors.
+
+Years     | Name
+----------|--------------------
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..fc04dbc
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,9 @@
+To build on (hopefully) any GNU/Linux [brackets means "optional"] :
+
+    make [src]
+    [make test]
+    make install
+
+To (un)install the library :
+
+    make (un)install
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..4422e1d
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+Expat License (often called "MIT license")
+
+Copyright (c) 2013-2014 Benjamin Auder
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..66c4f3a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,31 @@
+#http://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line
+#to reconstruct dependency rules or not
+
+LIBRARY = libcgds.so
+INSTALL_PREFIX = /usr/local
+
+src:
+	cd src && make && cd ..
+
+test:
+	cd test && make && cd ..
+
+doc:
+	cd doc && make && cd ..
+
+clean:
+	cd src && make clean && cd ..
+	cd test && make clean && cd ..
+	cd doc && make clean && cd ..
+
+install:
+#	if [ ! -e src/obj/libcds.so ]; then make src; fi
+	cp src/obj/$(LIBRARY) $(INSTALL_PREFIX)/lib/
+	mkdir -p $(INSTALL_PREFIX)/include/cgds
+	cp src/*.h $(INSTALL_PREFIX)/include/cgds/
+
+uninstall:
+	rm -f ${INSTALL_PREFIX}/lib/${LIBRARY}
+	[[ -d ${INSTALL_PREFIX}/include/cgds ]] && rm -rf ${INSTALL_PREFIX}/include/cgds
+
+.PHONY: src test doc clean install uninstall
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3ac85d7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+# cgds: C Generic Data Structures library
+
+Various data structures, from stack to tree, which can contain any data type.
+
+### Example
+    Vector v = vector_new(int);
+    vector_push(v, 32);
+    vector_push(v, 42);
+    int a; vector_get(v, 1, a); //a now contains 42
+    vector_set(v, 0, 0); //v[0] now contains 0
+    vector_destroy(v);
+
+More examples in the unit tests under test/ folder.
+
+### Contact
+benjamin [dot] a [at] mailoo.org
diff --git a/cgds b/cgds
new file mode 120000
index 0000000..e831038
--- /dev/null
+++ b/cgds
@@ -0,0 +1 @@
+src
\ No newline at end of file
diff --git a/doc/.gitignore b/doc/.gitignore
new file mode 100644
index 0000000..6789717
--- /dev/null
+++ b/doc/.gitignore
@@ -0,0 +1,2 @@
+html/
+latex/
diff --git a/doc/Doxyfile b/doc/Doxyfile
new file mode 100644
index 0000000..645ae27
--- /dev/null
+++ b/doc/Doxyfile
@@ -0,0 +1,1890 @@
+# Doxyfile 1.8.4
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed
+# in front of the TAG it is preceding .
+# All text after a hash (#) is considered a comment and will be ignored.
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or sequence of words) that should
+# identify the project. Note that if you do not use Doxywizard you need
+# to put quotes around the project name if it contains spaces.
+
+PROJECT_NAME           = "cds"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER         = 0.1.0
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = "Generic data structures library in C"
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Latvian, Lithuanian, Norwegian, Macedonian,
+# Persian, Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic,
+# Slovak, Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip. Note that you specify absolute paths here, but also
+# relative paths, which will be relative from the directory where doxygen is
+# started.
+
+STRIP_FROM_PATH        = 
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding
+# "class=itcl::class" will allow you to use the command class in the
+# itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension,
+# and language is one of the parsers supported by doxygen: IDL, Java,
+# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C,
+# C++. For instance to make doxygen treat .inc files as Fortran files (default
+# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note
+# that for custom extensions you also need to set FILE_PATTERNS otherwise the
+# files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
+# comments according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you
+# can mix doxygen, HTML, and XML commands with Markdown formatting.
+# Disable only in case of backward compatibilities issues.
+
+MARKDOWN_SUPPORT       = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also makes the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES (the
+# default) will make doxygen replace the get and set methods by a property in
+# the documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
+# unions with only public data fields or simple typedef fields will be shown
+# inline in the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO (the default), structs, classes, and unions are shown on a separate
+# page (for HTML and Man pages) or section (for LaTeX and RTF).
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can
+# be an expensive process and often the same symbol appear multiple times in
+# the code, doxygen keeps a cache of pre-resolved symbols. If the cache is too
+# small doxygen will become slower. If the cache is too large, memory is wasted.
+# The cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid
+# range is 0..9, the default is 0, corresponding to a cache size of 2^16 = 65536
+# symbols.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if section-label ... \endif
+# and \cond section-label ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files
+# containing the references data. This must be a list of .bib files. The
+# .bib extension is automatically appended if omitted. Using this command
+# requires the bibtex tool to be installed. See also
+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
+# feature you need bibtex and perl available in the search path. Do not use
+# file names with spaces, bibtex cannot handle them.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT                  = ../src ../../src ../../../src
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS          = *.c *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = _*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be ignored.
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C, C++ and Fortran comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header. Note that when using a custom header you are responsible
+#  for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is advised to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when
+# changing the value of configuration settings such as GENERATE_TREEVIEW!
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If left blank doxygen will
+# generate a default style sheet. Note that it is recommended to use
+# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this
+# tag will in the future become obsolete.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional
+# user-defined cascading style sheet that is included after the standard
+# style sheets created by doxygen. Using this option one can overrule
+# certain style aspects. This is preferred over using HTML_STYLESHEET
+# since it does not replace the standard style sheet and is therefor more
+# robust against future updates. Doxygen will copy the style sheet file to
+# the output directory.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the style sheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of
+# entries shown in the various tree structured indices initially; the user
+# can expand and collapse entries dynamically later on. Doxygen will expand
+# the tree to such a level that at most the specified number of entries are
+# visible (unless a fully collapsed tree already exceeds this amount).
+# So setting the number of entries 1 will produce a full collapsed tree by
+# default. 0 is a special value representing an infinite number of entries
+# and will result in a full expanded tree by default.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely
+# identify the documentation publisher. This should be a reverse domain-name
+# style string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+#  will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
+# at top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it. Since the tabs have the same information as the
+# navigation tree you can set this option to NO if you already set
+# GENERATE_TREEVIEW to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+# Since the tree basically has the same information as the tab index you
+# could consider to set DISABLE_INDEX to NO when enabling this option.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you may also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and
+# SVG. The default value is HTML-CSS, which is slower, but has the best
+# compatibility.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to
+# the MathJax Content Delivery Network so you can quickly see the result without
+# installing MathJax.
+# However, it is strongly recommended to install a local
+# copy of MathJax from http://www.mathjax.org before deployment.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
+# names that should be enabled during MathJax rendering.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript
+# pieces of code that will be used on startup of the MathJax code.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript.
+# There are two flavours of web server based search depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools.
+# See the manual for details.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain
+# the search results. Doxygen ships with an example indexer (doxyindexer) and
+# search engine (doxysearch.cgi) which are based on the open source search
+# engine library Xapian. See the manual for configuration details.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will returned the search results when EXTERNAL_SEARCH is enabled.
+# Doxygen ships with an example search engine (doxysearch) which is based on
+# the open source search engine library Xapian. See the manual for configuration
+# details.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id
+# of to a relative location where the documentation can be found.
+# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ...
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, letter, legal and
+# executive. If left blank a4 will be used.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images
+# or other source files which should be copied to the LaTeX output directory.
+# Note that the files will be copied as-is; there are no commands or markers
+# available.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
+# http://en.wikipedia.org/wiki/BibTeX for more info.
+
+LATEX_BIB_STYLE        = plain
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load style sheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES Doxygen will generate DOCBOOK files
+# that can be used to generate PDF.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the DOCBOOK pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it. If left blank docbook will be used as the default path.
+
+DOCBOOK_OUTPUT         = docbook
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. For each
+# tag file the location of the external documentation should be added. The
+# format of a tag file without this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths
+# or URLs. Note that each tag file must have a unique name (where the name does
+# NOT include the path). If a tag file is not located in the directory in which
+# doxygen is run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed
+# in the related pages index. If set to NO, only the current project's
+# pages will be listed.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will use the Helvetica font for all dot files that
+# doxygen generates. When you want a differently looking font you can specify
+# the font name using DOT_FONTNAME. You need to make sure dot is able to find
+# the font, which can be done by putting it in a standard location or by setting
+# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
+# directory containing the font.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the Helvetica font.
+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
+# set the path where dot can find it.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside
+# the class node. If there are many fields or methods and many nodes the
+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
+# threshold limits the number of items for each type to make the size more
+# manageable. Set this to 0 for no limit. Note that the threshold may be
+# exceeded by 50% before the limit is enforced.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used. If you choose svg you need to set
+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible in IE 9+ (other browsers do not have this requirement).
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+# Note that this requires a modern browser other than Internet Explorer.
+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible. Older versions of IE do not have SVG support.
+
+INTERACTIVE_SVG        = NO
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP            = YES
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 0000000..6612691
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,10 @@
+all: latex/refman.pdf
+
+latex/refman.pdf:
+	doxygen Doxyfile
+	cd latex && pdflatex refman.tex && pdflatex refman.tex && cd ..
+
+clean:
+	rm -rf html latex
+
+.PHONY: latex/refman.pdf clean
diff --git a/makeMakefile.sh b/makeMakefile.sh
new file mode 100644
index 0000000..7419805
--- /dev/null
+++ b/makeMakefile.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/bash
+
+subfolder=$1
+
+cd $subfolder
+cat Makefile.base > Makefile
+printf "\n" >> Makefile
+for folder in `find . -path ./obj -prune -o -type d -print`; do
+	mkdir -p obj/$folder
+done
+
+sources=`find . -type f -name \*.c`
+objects=""
+for file in $sources; do
+	objects+="obj/${file%?}o "
+done
+printf "obj/\$(TARGET): $objects\n" >> Makefile
+printf '\t$(CC) $(LDFLAGS) -o $@ $^\n\n' >> Makefile 
+
+for file in $sources; do
+	deps=`grep '#include "' $file | cut -d ' ' -f 2 | sed 's/^"\(.*\)"$/..\/\1/g' | tr '\n' ' '`
+	fileDotO="obj/${file%?}o"
+	printf "$fileDotO: $file $deps\n" >> Makefile
+	printf '\t$(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<\n\n' >> Makefile
+done
+
+cd ..
diff --git a/src/.gitignore b/src/.gitignore
new file mode 100644
index 0000000..5d3fa11
--- /dev/null
+++ b/src/.gitignore
@@ -0,0 +1,2 @@
+obj/
+Makefile
diff --git a/src/BufferTop.c b/src/BufferTop.c
new file mode 100644
index 0000000..db66476
--- /dev/null
+++ b/src/BufferTop.c
@@ -0,0 +1,96 @@
+/**
+ * @file BufferTop.c
+ */
+
+#include "cgds/BufferTop.h"
+
+// NOTE: no _init() method here, since BufferTop has no specific initialization
+
+BufferTop* _buffertop_new(size_t dataSize, UInt capacity, OrderType bType, UInt arity)
+{
+	BufferTop* bufferTop = (BufferTop*) safe_malloc(sizeof (BufferTop));
+	bufferTop->capacity = capacity;
+	bufferTop->bType = bType; //redondant, but facilitate understanding
+	// WARNING: heap must have opposite type: "smallest" element first
+	bufferTop->heap = _heap_new(dataSize, (bType == MAX_T ? MIN_T : MAX_T), arity);
+	return bufferTop;
+}
+
+BufferTop* buffertop_copy(BufferTop* bufferTop)
+{
+	BufferTop* bufferTopCopy = _buffertop_new(
+		bufferTop->heap->dataSize, bufferTop->capacity,
+		bufferTop->heap->hType, bufferTop->heap->arity);
+	heap_destroy(bufferTopCopy->heap); //TODO: bad style...
+	bufferTopCopy->heap = heap_copy(bufferTop->heap);
+	return bufferTopCopy;
+}
+
+List* buffertop_2list(BufferTop* bufferTop)
+{
+	// Copy the buffer, and then use the copy to build the list
+	BufferTop* bufferTopCopy = buffertop_copy(bufferTop);
+	List* bufferInList = _list_new(bufferTop->heap->array->dataSize);
+	while (!buffertop_empty(bufferTopCopy))
+	{
+		void* topItem = buffertop_first_raw(bufferTopCopy)->item;
+		// NOTE: list_insert_front(), to reverse (wrong) items order
+		// ==> in the returned list, top element is at head.
+		_list_insert_front(bufferInList, topItem);
+		buffertop_pop(bufferTopCopy);
+	}
+	buffertop_destroy(bufferTopCopy);
+	return bufferInList;
+}
+
+Bool buffertop_empty(BufferTop* bufferTop)
+{
+	return (heap_size(bufferTop->heap) == 0);
+}
+
+UInt buffertop_size(BufferTop* bufferTop)
+{
+	return heap_size(bufferTop->heap);
+}
+
+void _buffertop_tryadd(BufferTop* bufferTop, void* item, Real value)
+{
+	if (heap_size(bufferTop->heap) >= bufferTop->capacity &&
+		((bufferTop->bType == MIN_T &&
+		value >= ((ItemValue*) (bufferTop->heap->array->datas[0]))->value)
+		||
+		(bufferTop->bType == MAX_T &&
+		value <= ((ItemValue*) (bufferTop->heap->array->datas[0]))->value)))
+	{
+		// shortcut : if value "worse" than top->value and buffer is full, skip
+		return;
+	}
+
+	// insertion somewhere in the item-values heap
+	_heap_insert(bufferTop->heap, item, value);
+
+	if (heap_size(bufferTop->heap) > bufferTop->capacity)
+		// we must remove current root
+		heap_pop(bufferTop->heap);
+}
+
+ItemValue* buffertop_first_raw(BufferTop* bufferTop)
+{
+	return heap_top_raw(bufferTop->heap);
+}
+
+void buffertop_pop(BufferTop* bufferTop)
+{
+	heap_pop(bufferTop->heap);
+}
+
+void buffertop_clear(BufferTop* bufferTop)
+{
+	heap_clear(bufferTop->heap);
+}
+
+void buffertop_destroy(BufferTop* bufferTop)
+{
+	heap_destroy(bufferTop->heap);
+	safe_free(bufferTop);
+}
diff --git a/src/BufferTop.h b/src/BufferTop.h
new file mode 100644
index 0000000..1f7d9a9
--- /dev/null
+++ b/src/BufferTop.h
@@ -0,0 +1,138 @@
+/**
+ * @file BufferTop.h
+ */
+
+#ifndef CGDS_BUFFER_TOP_H
+#define CGDS_BUFFER_TOP_H
+
+#include <stdlib.h>
+#include <string.h>
+#include "cgds/types.h"
+#include "cgds/Heap.h"
+#include "cgds/List.h"
+#include "cgds/safe_alloc.h"
+
+/**
+ * @brief Data structure to store top (MAX or MIN) elements in a buffer.
+ */
+typedef struct BufferTop {
+	UInt capacity; ///< Buffer capacity (in items count).
+	OrderType bType; ///< Type of buffer: keep max items (MAX_T) or min items (MIN_T).
+	Heap* heap; ///< Item-ValueS are internally organized into a heap.
+} BufferTop;
+
+/**
+ * @brief Return an allocated and initialized buffer.
+ */
+BufferTop* _buffertop_new(
+	size_t dataSize, ///< Size in bytes of a buffer element.
+	UInt capacity, ///< Maximum number of elements that the buffer can contain.
+	OrderType bType, ///< Type of buffer: keep max items (bType==MAX_T) or min items (bType==MIN_T).
+	UInt arity ///< Arity of the wrapped heap: any integer >=2.
+);
+
+/**
+ * @brief Return an allocated and initialized buffer.
+ * @param type Type of a buffer item (int, char*, ...).
+ * @param capacity Maximum number of elements that the buffer can contain.
+ * @param bType type of buffer top: max items (bType==MAX_T) or min items (bType==MIN_T).
+ * @param arity Arity of the wrapped heap: any integer >=2.
+ * 
+ * Usage: BufferTop* buffertop_new(<Type> type, UInt capacity, OrderTypebType, UInt arity)
+ */
+#define buffertop_new(type, capacity, bType, arity) \
+	_buffertop_new(sizeof(type), capacity, bType, arity)
+
+/**
+ * @brief Copy constructor (works well if items do not have allocated sub-pointers).
+ */
+BufferTop* buffertop_copy(
+	BufferTop* bufferTop ///< "this" pointer.
+);
+
+/**
+ * @brief Turn the buffer into a list to scan its content linearly.
+ */
+List* buffertop_2list(
+	BufferTop* bufferTop ///< "this" pointer.
+);
+
+/**
+ * @brief Check if the buffer is empty.
+ */
+Bool buffertop_empty(
+	BufferTop* bufferTop ///< "this" pointer.
+);
+
+/**
+ * @brief Return the size of current buffer (<= capacity).
+ */
+UInt buffertop_size(
+	BufferTop* bufferTop ///< "this" pointer.
+);
+
+/**
+ * @brief (Try to) add an item-value in the buffer.
+ */
+void _buffertop_tryadd(
+	BufferTop* bufferTop, ///< "this" pointer.
+	void* item, ///< Pointer to an item of type as defined in the constructor.
+	Real value ///< Value associated with the item.
+);
+
+/**
+ * @brief (Try to) add an item-value in the buffer.
+ * @param bufferTop "this" pointer.
+ * @param item Item of type as defined in the constructor.
+ * @param value Value associated with the item.
+ * 
+ * Usage: void buffertop_tryadd(BufferTop* bufferTop, void item, Real value)
+ */
+#define buffertop_tryadd(bufferTop, item, value) \
+{ \
+	typeof((item)) tmp = item; \
+	_buffertop_tryadd(bufferTop, &tmp, value); \
+}
+
+/**
+ * @brief Return the top ("worst among best") ItemValue inside current buffer.
+ */
+ItemValue* buffertop_first_raw(
+	BufferTop* bufferTop ///< "this" pointer.
+);
+
+/**
+ * @brief Set item_ to the top ("worst among best") item inside current buffer.
+ * @param bufferTop "this" pointer.
+ * @param item_ Variable to be assigned.
+ * 
+ * Usage: void buffertop_first(BufferTop* bufferTop, void item)
+ */
+#define buffertop_first(bufferTop, item_) \
+{ \
+	void* pItem = buffertop_first_raw(bufferTop)->item; \
+	item_ = *((typeof(&item_))pItem); \
+}
+
+/**
+ * @brief Remove the top ("worst among best") item-value inside the buffer.
+ */
+void buffertop_pop(
+	BufferTop* bufferTop ///< "this" pointer.
+);
+
+/**
+ * @brief Clear the entire buffer.
+ */
+void buffertop_clear(
+	BufferTop* bufferTop ///< "this" pointer.
+);
+
+/**
+ * @brief Destroy the buffer: clear it, and free 'bufferTop' pointer.
+ */
+void buffertop_destroy(
+	BufferTop* bufferTop ///< "this" pointer.
+);
+
+#endif
diff --git a/src/Heap.c b/src/Heap.c
new file mode 100644
index 0000000..659e539
--- /dev/null
+++ b/src/Heap.c
@@ -0,0 +1,180 @@
+/**
+ * @file Heap.c
+ */
+
+#include "cgds/Heap.h"
+
+// NOTE: no _init() method here, since Heap has no specific initialization
+
+Heap* _heap_new(size_t dataSize, OrderType hType, UInt arity)
+{
+	Heap* heap = (Heap*)safe_malloc(sizeof(Heap));
+	heap->arity = arity;
+	heap->hType = hType;
+	heap->dataSize = dataSize;
+	heap->array = _vector_new(sizeof(ItemValue));
+	return heap;
+}
+
+Heap* heap_copy(Heap* heap)
+{
+	Heap* heapCopy = _heap_new(heap->dataSize, heap->hType, heap->arity);
+	// HACK: vector_copy is not enough, since we also have to allocate ItemValue(->item)
+	heapCopy->array->size = heap->array->size;
+	heapCopy->array->capacity = heap->array->capacity;
+	heapCopy->array->datas = (void**)safe_malloc(heap->array->capacity*sizeof(void*));
+	for (UInt i=0; i<heap->array->size; i++)
+	{
+		heapCopy->array->datas[i] = safe_malloc(sizeof(ItemValue));
+		ItemValue itemValueCopy = (ItemValue){
+			.item=safe_malloc(heap->dataSize), 
+			.value=((ItemValue*)(heap->array->datas[i]))->value};
+		memcpy(itemValueCopy.item, ((ItemValue*)(heap->array->datas[i]))->item, heap->dataSize);
+		memcpy(heapCopy->array->datas[i], &itemValueCopy, sizeof(ItemValue));
+	}
+	return heapCopy;
+}
+
+Bool heap_empty(Heap* heap)
+{
+	return vector_empty(heap->array);
+}
+
+UInt heap_size(Heap* heap)
+{
+	return vector_size(heap->array);
+}
+
+// NOTE: [perf] in two following methods, full heap[k] exchanges are not needed;
+// we keep track of the moving element without assigning it at every step,
+// thus saving array accesses and affectations + 'aux' temp. memory.
+// --> this is not the most natural way of writing these functions.
+
+void _heap_bubble_up(Heap* heap, UInt startIndex)
+{
+	UInt currentIndex = startIndex;
+	ItemValue* startItemValue = heap->array->datas[startIndex];
+	while (C_TRUE)
+	{
+		// get parent
+		UInt nextIndex = currentIndex / heap->arity;
+		Real nextValue = ((ItemValue*)(heap->array->datas[nextIndex]))->value;
+		// compare to parent (if applicable)
+		if (currentIndex == 0 || 
+			(heap->hType == MIN_T && startItemValue->value >= nextValue) ||
+			(heap->hType == MAX_T && startItemValue->value <= nextValue))
+		{
+			// moving element has landed: apply final affectation
+			heap->array->datas[currentIndex] = startItemValue;
+			break;
+		}
+		// move one level up: the parent goes one level down
+		heap->array->datas[currentIndex] = heap->array->datas[nextIndex];
+		currentIndex = nextIndex;
+	}
+}
+
+void _heap_bubble_down(Heap* heap, UInt startIndex)
+{
+	UInt currentIndex = startIndex;
+	ItemValue* startItemValue = heap->array->datas[startIndex];
+	while (C_TRUE)
+	{
+		if (currentIndex * heap->arity >= heap->array->size)
+		{
+			// moving element has landed (in a leaf): apply final affectation
+			heap->array->datas[currentIndex] = startItemValue;
+			break;
+		}
+		// find top child (min or max)
+		UInt topChildIndex;
+		Real topChildValue = (heap->hType == MIN_T ? INFINITY : -INFINITY);
+		for (Int i=0; i<heap->arity; i++)
+		{
+			UInt childIndex = i + currentIndex * heap->arity;
+			if (childIndex >= heap->array->size)
+				break;
+			Real childValue = ((ItemValue*)(heap->array->datas[childIndex]))->value;
+			if ((heap->hType == MIN_T && childValue < topChildValue) ||
+				(heap->hType == MAX_T && childValue > topChildValue))
+			{
+				topChildIndex = childIndex;
+				topChildValue = childValue;
+			}
+		}
+		// compare to top child
+		if ((heap->hType == MIN_T && startItemValue->value > topChildValue) ||
+			(heap->hType == MAX_T && startItemValue->value < topChildValue))
+		{
+			// move one level down: the child goes one level up
+			heap->array->datas[currentIndex] = heap->array->datas[topChildIndex];
+		}
+		else
+		{
+			// moving element has landed: apply final affectation
+			heap->array->datas[currentIndex] = startItemValue;
+			break;
+		}
+		currentIndex = topChildIndex;
+	}
+}
+
+void _heap_insert(Heap* heap, void* item, Real value)
+{
+	ItemValue itemValue = (ItemValue){.item=safe_malloc(heap->dataSize), .value=value};
+	memcpy(itemValue.item, item, heap->dataSize);
+	_vector_push(heap->array, &itemValue);
+	_heap_bubble_up(heap, heap->array->size-1);
+}
+
+void _heap_modify(Heap* heap, UInt index, Real newValue)
+{
+	double oldValue = ((ItemValue*)(heap->array->datas[index]))->value;
+	((ItemValue*)(heap->array->datas[index]))->value = newValue;
+	if ((heap->hType == MIN_T && newValue > oldValue) ||
+		(heap->hType == MAX_T && newValue < oldValue))
+	{
+		_heap_bubble_down(heap, index);
+	}
+	else 
+		_heap_bubble_up(heap, index);
+}
+
+void _heap_remove(Heap* heap, UInt index)
+{
+	safe_free(((ItemValue*)(heap->array->datas[index]))->item);
+	ItemValue* tmp = heap->array->datas[index];
+	heap->array->datas[index] = heap->array->datas[heap_size(heap)-1];
+	heap->array->datas[heap_size(heap)-1] = tmp;
+	vector_pop(heap->array);
+	if (heap->array->size > 0) 
+		_heap_bubble_down(heap, index);
+}
+
+ItemValue* heap_top_raw(Heap* heap)
+{
+	return (ItemValue*)(heap->array->datas[0]);
+}
+
+void heap_pop(Heap* heap)
+{
+	_heap_remove(heap, 0);
+}
+
+void heap_clear(Heap* heap)
+{
+	for (UInt i = 0; i < heap->array->size; i++)
+	{
+		// Extra memory releases which wouldn't be done in vector_clear()
+		safe_free(((ItemValue*)(heap->array->datas[i]))->item);
+		//safe_free((ItemValue*)heap->array->datas[i]);
+	}
+	vector_clear(heap->array);
+}
+
+void heap_destroy(Heap* heap)
+{
+	heap_clear(heap);
+	safe_free(heap->array);
+	safe_free(heap);
+}
diff --git a/src/Heap.h b/src/Heap.h
new file mode 100644
index 0000000..895eb32
--- /dev/null
+++ b/src/Heap.h
@@ -0,0 +1,206 @@
+/**
+ * @file Heap.h
+ */
+
+#ifndef CGDS_HEAP_H
+#define CGDS_HEAP_H
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "cgds/types.h"
+#include "cgds/Vector.h"
+#include "cgds/safe_alloc.h"
+
+/**
+ * @brief Generic d-ary heap.
+ */
+typedef struct Heap {
+	size_t dataSize; ///< Size of a heap item in bytes.
+	OrderType hType; ///< Type of heap: max first (MAX_T) or min first (MIN_T).
+	UInt arity; ///< Arity of the underlying tree.
+	Vector* array; ///< Vector of ItemValue* (internal representation).
+} Heap;
+
+/**
+ * @brief Return an allocated and initialized heap.
+ */
+Heap* _heap_new(
+	size_t dataSize, ///< Size in bytes of a heap element.
+	OrderType hType, ///< Type of heap: max first (MAX_T) or min first (MIN_T).
+	UInt arity ///< Arity of the underlying tree.
+);
+
+/**
+ * @brief Return an allocated and initialized heap.
+ * @param type Type of a buffer item (int, char*, ...).
+ * @param hType Type of heap: max first (MAX_T) or min first (MIN_T).
+ * @param arity Arity of the underlying tree.
+ * 
+ * Usage: Heap* heap_new(<Type> type, OrderType hType, UInt arity)
+ */
+#define heap_new(type, hType, arity) \
+	_heap_new(sizeof(type), hType, arity)
+
+/**
+ * @brief Copy constructor (works well if items do not have allocated sub-pointers).
+ */
+Heap* heap_copy(
+	Heap* heap ///< "this" pointer.
+);
+
+/**
+ * @brief Check if the heap is empty.
+ */
+Bool heap_empty(
+	Heap* heap ///< "this" pointer.
+);
+
+/**
+ * @brief Return the size of current heap.
+ */
+UInt heap_size(
+	Heap* heap ///< "this" pointer.
+);
+
+/**
+ * @brief "Bubble up" an item-value inserted somewhere in the tree in O(log(n)) operations.
+ */
+void _heap_bubble_up(
+	Heap* heap, ///< "this" pointer.
+	UInt startIndex ///< Index to bubble up.
+);
+
+/**
+ * @brief "Bubble down" an item-value inserted somewhere in the tree in O(log(n)) operations.
+ */
+void _heap_bubble_down(
+	Heap* heap, ///< "this" pointer.
+	UInt startIndex ///< Index to bubble down.
+);
+
+/**
+ * @brief Insert a pair (item,value) inside the heap.
+ */
+void _heap_insert(
+	Heap* heap, ///< "this" pointer.
+	void* item, ///< Pointer to an item of type as defined in the constructor.
+	Real value ///< Value associated with the item.
+);
+
+/**
+ * @brief Insert a pair (item,value) inside the heap.
+ * @param heap "this" pointer.
+ * @param item Item of type as defined in the constructor.
+ * @param value Value associated with the item.
+ * 
+ * Usage: void heap_insert(Heap* heap, void item, Real value)
+ */
+#define heap_insert(heap, item, value) \
+{ \
+	typeof((item)) tmp = item; \
+	_heap_insert(heap, &tmp, value); \
+}
+
+/**
+ * @brief Change the value of an item at a given index.
+ */
+void _heap_modify(
+	Heap* heap, ///< "this" pointer.
+	UInt index, ///< Index of the item to modify.
+	Real newValue ///< New value for the item.
+);
+
+/**
+ * @brief Change the value of an item inside the heap.
+ * @param heap "this" pointer.
+ * @param item_ Item to modify.
+ * @param newValue New value for the item.
+ * @note If several similar items are present, only the first is affected.
+ * 
+ * Usage: void heap_modify(Heap* heap, void item_, Real newValue)
+ * WARNING: does not work if items are not basic type nor pointers.
+ */
+#define heap_modify(heap, item_, newValue) \
+{ \
+    UInt index = 0; \
+	typeof((item_)) item__ = item_; \
+    for (; index<heap->array->size; index++) \
+	{ \
+		void* pItem = ((ItemValue*)(heap->array->datas[index]))->item; \
+        if (*((typeof(&item__))pItem) == item__) break; \
+    } \
+	_heap_modify(heap, index, newValue); \
+}
+
+/**
+ * @brief Remove an item-value at a given index.
+ */
+void _heap_remove(
+	Heap* heap, ///< "this" pointer.
+	UInt index  ///< Index of the item to remove.
+);
+
+/**
+ * @brief Remove an item-value inside the heap.
+ * @param heap "this" pointer.
+ * @param item_ Item to remove.
+ * @note If several similar items are present, only the first is deleted.
+ * 
+ * Usage: void heap_remove(Heap* heap, void item_)
+ * WARNING: does not work if items are not basic type nor pointers.
+ */
+#define heap_remove(heap, item_) \
+{ \
+    UInt index = 0; \
+	typeof((item_)) item__ = item_; \
+    for (; index<heap->array->size; index++) \
+	{ \
+		void* pItem = ((ItemValue*)(heap->array->datas[index]))->item; \
+        if (*((typeof(&item__))pItem) == item__) break; \
+    } \
+	_heap_remove(heap, index); \
+}
+
+/**
+ * @brief Return what is at the beginning of the heap.
+ */
+ItemValue* heap_top_raw(
+	Heap* heap ///< "this" pointer.
+);
+
+/**
+ * @brief Return what is at the beginning of the heap.
+ * @param heap "this" pointer.
+ * @param item_ Item to be assigned.
+ * 
+ * Usage: void heap_top(Heap* heap, void item_)
+ */
+#define heap_top(heap, item_) \
+{ \
+	void* pItem = heap_top_raw(heap)->item; \
+	item_ = *((typeof(&item_))pItem); \
+}
+
+/**
+ * @brief Remove the top of the heap.
+ */
+void heap_pop(
+	Heap* heap ///< "this" pointer.
+);
+
+/**
+ * @brief Clear the entire heap.
+ */
+void heap_clear(
+	Heap* heap ///< "this" pointer.
+);
+
+/**
+ * @brief Destroy the heap: clear it, and free 'heap' pointer.
+ */
+void heap_destroy(
+	Heap* heap ///< "this" pointer.
+);
+
+#endif
diff --git a/src/List.c b/src/List.c
new file mode 100644
index 0000000..d34fc92
--- /dev/null
+++ b/src/List.c
@@ -0,0 +1,218 @@
+/**
+ * @file List.c
+ */
+
+#include "cgds/List.h"
+
+////////////////
+// List logic //
+////////////////
+
+void _list_init(List* list, size_t dataSize)
+{
+	list->size = 0;
+	list->dataSize = dataSize;
+	list->head = NULL;
+	list->tail = NULL;
+}
+
+List* _list_new(size_t dataSize)
+{
+	List* list = (List*) safe_malloc(sizeof (List));
+	_list_init(list, dataSize);
+	return list;
+}
+
+List* list_copy(List* list)
+{
+	List* listCopy = _list_new(list->dataSize);
+	ListCell* listCell = list->head;
+	while (listCell != NULL)
+	{
+		_list_insert_back(listCopy, listCell->data);
+		listCell = listCell->next;
+	}
+	return listCopy;
+}
+
+Bool list_empty(List* list)
+{
+	return (list->size == 0);
+}
+
+UInt list_size(List* list)
+{
+	return list->size;
+}
+
+void* _list_get(ListCell* listCell)
+{
+	return listCell->data;
+}
+
+void _list_set(List* list, ListCell* listCell, void* data)
+{
+	memcpy(listCell->data, data, list->dataSize);
+}
+
+void _list_insert_first_element(List* list, void* data)
+{
+	ListCell* newListCell = (ListCell*) safe_malloc(sizeof (ListCell));
+	newListCell->data = safe_malloc(list->dataSize);
+	memcpy(newListCell->data, data, list->dataSize);
+	newListCell->prev = NULL;
+	newListCell->next = NULL;
+	list->head = newListCell;
+	list->tail = newListCell;
+	list->size = 1;
+}
+
+void _list_insert_before(List* list, ListCell* listCell, void* data)
+{
+	ListCell* newListCell = (ListCell*) safe_malloc(sizeof (ListCell));
+	newListCell->data = safe_malloc(list->dataSize);
+	memcpy(newListCell->data, data, list->dataSize);
+	newListCell->prev = listCell->prev;
+	newListCell->next = listCell;
+	if (listCell->prev != NULL)
+		listCell->prev->next = newListCell;
+	else
+		list->head = newListCell;
+	listCell->prev = newListCell;
+	list->size++;
+}
+
+void _list_insert_after(List* list, ListCell* listCell, void* data)
+{
+	ListCell* newListCell = (ListCell*) safe_malloc(sizeof (ListCell));
+	newListCell->data = safe_malloc(list->dataSize);
+	memcpy(newListCell->data, data, list->dataSize);
+	newListCell->prev = listCell;
+	newListCell->next = listCell->next;
+	if (listCell->next != NULL)
+		listCell->next->prev = newListCell;
+	else
+		list->tail = newListCell;
+	listCell->next = newListCell;
+	list->size++;
+}
+
+void _list_insert_front(List* list, void* data)
+{
+	if (list->head != NULL)
+		_list_insert_before(list, list->head, data);
+	else
+		_list_insert_first_element(list, data);
+}
+
+void _list_insert_back(List* list, void* data)
+{
+	if (list->tail != NULL)
+		_list_insert_after(list, list->tail, data);
+	else
+		_list_insert_first_element(list, data);
+}
+
+void list_remove(List* list, ListCell* listCell)
+{
+	if (listCell->prev != NULL) 
+		listCell->prev->next = listCell->next;
+	else 
+		list->head = listCell->next;
+	if (listCell->next != NULL) 
+		listCell->next->prev = listCell->prev;
+	else 
+		list->tail = listCell->prev;
+	safe_free(listCell->data);
+	safe_free(listCell);
+	list->size--;
+}
+
+void list_remove_front(List* list)
+{
+	list_remove(list, list->head);
+}
+
+void list_remove_back(List* list)
+{
+	list_remove(list, list->tail);
+}
+
+void list_clear(List* list)
+{
+	ListCell* current = list->head;
+	while (current != NULL)
+	{
+		safe_free(current->data);
+		ListCell* nextListCell = current->next;
+		safe_free(current);
+		current = nextListCell;
+	}
+	_list_init(list, list->dataSize);
+}
+
+void list_destroy(List* list)
+{
+	list_clear(list);
+	safe_free(list);
+}
+
+////////////////////
+// Iterator logic //
+////////////////////
+
+ListIterator* list_get_iterator(List* list)
+{
+	ListIterator* listI = (ListIterator*) safe_malloc(sizeof (ListIterator));
+	listI->list = list;
+	listI->current = NULL;
+	listI_reset_head(listI);
+	return listI;
+}
+
+void listI_reset_head(ListIterator* listI)
+{
+	listI->current = listI->list->head;
+}
+
+void listI_reset_tail(ListIterator* listI)
+{
+	listI->current = listI->list->tail;
+}
+
+Bool listI_has_data(ListIterator* listI)
+{
+	return (listI->current != NULL);
+}
+
+void listI_remove(ListIterator* listI, Direction direction)
+{
+	ListCell* toTrash = listI->current;
+	switch (direction)
+	{
+	case FORWARD:
+		listI->current = listI->current->next;
+		break;
+	case BACKWARD:
+		listI->current = listI->current->prev;
+		break;
+	}
+	list_remove(listI->list, toTrash);
+}
+
+void listI_move_next(ListIterator* listI)
+{
+	if (listI->current != NULL)
+		listI->current = listI->current->next;
+}
+
+void listI_move_prev(ListIterator* listI)
+{
+	if (listI->current != NULL)
+		listI->current = listI->current->prev;
+}
+
+void listI_destroy(ListIterator* listI)
+{
+	safe_free(listI);
+}
diff --git a/src/List.h b/src/List.h
new file mode 100644
index 0000000..3e1c4ad
--- /dev/null
+++ b/src/List.h
@@ -0,0 +1,374 @@
+/**
+ * @file List.h
+ */
+
+#ifndef CGDS_LIST_H
+#define CGDS_LIST_H
+
+#include <stdlib.h>
+#include <string.h>
+#include "cgds/safe_alloc.h"
+#include "cgds/types.h"
+
+////////////////
+// List logic //
+////////////////
+
+/**
+ * @brief Cell of a double-linked list.
+ */
+typedef struct ListCell {
+	void* data; ///< Generic data contained in this cell.
+	struct ListCell* prev; ///< Pointer to previous cell in the list.
+	struct ListCell* next; ///< Pointer to next cell in the list.
+} ListCell;
+
+/**
+ * @brief Double-linked list data structure.
+ */
+typedef struct List {
+	UInt size; ///< Count elements in the list.
+	size_t dataSize; ///< Size of a list cell elements in bytes.
+	ListCell* head; ///< Pointer to the first cell in the list.
+	ListCell* tail; ///< Pointer to the last cell in the list.
+} List;
+
+/**
+ * @brief Initialize an empty list.
+ */
+void _list_init(
+	List* list, ///< "this" pointer.
+	size_t dataSize ///< Size of a list cell elements in bytes.
+);
+
+/**
+ * @brief Return an allocated and initialized list.
+ * @param dataSize Size in bytes of a list element.
+ */
+List* _list_new(
+	size_t dataSize ///< Size of a list cell elements in bytes.
+);
+
+/**
+ * @brief Return an allocated and initialized list.
+ * @param type Type of a list element (int, char*, ...).
+ * 
+ * Usage: List* list_new(<Type> type)
+ */
+#define list_new(type) \
+	_list_new(sizeof(type))
+
+/**
+ * @brief Copy constructor (works well if items do not have allocated sub-pointers).
+ */
+List* list_copy(
+	List* list ///< "this" pointer.
+);
+
+/**
+ * @brief Check if the list is empty.
+ */
+Bool list_empty(
+	List* list ///< "this" pointer.
+);
+
+/**
+ * @brief return the size of current list.
+ */
+UInt list_size(
+	List* list ///< "this" pointer.
+);
+
+/**
+ * @brief Get data at the given list cell argument.
+ */
+void* _list_get(
+	ListCell* listCell ///< Pointer to a cell inside "this" list.
+);
+
+/**
+ * @brief Get data at the given list cell argument.
+ * @param listCell Pointer to a cell inside "this" list.
+ * @param data Data to be assigned.
+ * 
+ * Usage: void list_get(ListCell* listCell, void data)
+ */
+#define list_get(listCell, data) \
+{ \
+	void* pData = _list_get(listCell); \
+	data = *((typeof(&data))pData); \
+}
+
+/**
+ * @brief Set data at the given list cell argument.
+ */
+void _list_set(
+	List* list, ///< "this" pointer.
+	ListCell* listCell, ///< Pointer to a cell inside "this" list.
+	void* data ///< Pointer to data to be set.
+);
+
+/**
+ * @brief Set data at the given list cell argument.
+ * @param list "this" pointer.
+ * @param listCell Pointer to a cell inside "this" list.
+ * @param data Data to be set.
+ * 
+ * Usage: void list_set(List* list, ListCell* listCell, void data);
+ */
+#define list_set(list, listCell, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_list_set(list, listCell, &tmp); \
+}
+
+/**
+ * @brief Add data to the list when list is empty.
+ */
+void _list_insert_first_element(
+	List* list, ///< "this" pointer.
+	void* data ///< Pointer to data to be added
+);
+
+/**
+ * @brief Add data before list cell argument.
+ */
+void _list_insert_before(
+	List* list, ///< "this" pointer.
+	ListCell* listCell, ///< Pointer to a cell inside "this" list.
+	void* data ///< Pointer to data to be added.
+);
+
+/**
+ * @brief Add data before list cell argument.
+ * @param list "this" pointer.
+ * @param listCell Pointer to a cell inside "this" list.
+ * @param data Data to be inserted.
+ * 
+ * Usage: void list_insert_before(List* list, ListCell* listCell, void data)
+ */
+#define list_insert_before(list, listCell, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_list_insert_before(list, listCell, &tmp); \
+}
+
+/**
+ * @brief Add data after list cell argument.
+ */
+void _list_insert_after(
+	List* list, ///< "this" pointer.
+	ListCell* listCell, ///< Pointer to a cell inside "this" list.
+	void* data ///< Pointer to data to be inserted.
+);
+
+/**
+ * @brief Add data after list cell argument.
+ * @param list "this" pointer.
+ * @param listCell Pointer to a cell inside "this" list.
+ * @param data Data to be inserted.
+ * 
+ * Usage: void list_insert_after(List* list, ListCell* listCell, void data)
+ */
+#define list_insert_after(list, listCell, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_list_insert_after(list, listCell, &tmp); \
+}
+
+/**
+ * @brief Add data at the beginning of the list.
+ */
+void _list_insert_front(
+	List* list, ///< "this" pointer.
+	void* data ///< Pointer to data to be inserted.
+);
+
+/**
+ * @brief Add data at the beginning of the list.
+ * @param list "this" pointer.
+ * @param data Data to be inserted.
+ * 
+ * Usage: void list_insert_front(List* list, void data)
+ */
+#define list_insert_front(list, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_list_insert_front(list, &tmp); \
+}
+
+/**
+ * @brief Add data at the end of the list.
+ */
+void _list_insert_back(
+	List* list, ///< "this" pointer.
+	void* data ///< Pointer to data to be inserted.
+);
+
+/**
+ * @brief Add data at the end of the list.
+ * @param list "this" pointer.
+ * @param data Data to be inserted.
+ * 
+ * Usage: void list_insert_back(List* list, void data)
+ */
+#define list_insert_back(list, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_list_insert_back(list, &tmp); \
+}
+
+/** 
+ * @brief Remove data at position given by 'listCell'.
+ */
+void list_remove(
+	List* list, ///< "this" pointer.
+	ListCell* listCell ///< Pointer to a cell inside "this" list.
+);
+
+/**
+ * @brief Remove data at the beginning of the list.
+ */
+void list_remove_front(
+	List* list ///< "this" pointer.
+);
+
+/**
+ * @brief Remove data at the end of the list.
+ */
+void list_remove_back(
+	List* list ///< "this" pointer.
+);
+
+/**
+ * @brief Clear the entire list.
+ */
+void list_clear(
+	List* list ///< "this" pointer.
+);
+
+/**
+ * @brief Destroy the list: clear it, and free 'list' pointer.
+ */
+void list_destroy(
+	List* list ///< "this" pointer.
+);
+
+////////////////////
+// Iterator logic //
+////////////////////
+
+/**
+ * @brief Iterator on a double-linked list.
+ */
+typedef struct ListIterator {
+	List* list; ///< The list to be iterate.
+	ListCell* current; ///< The current iterated list cell.
+} ListIterator;
+
+/**
+ * @brief Obtain an iterator object, starting at list beginning.
+ */
+ListIterator* list_get_iterator(
+	List* list ///< Pointer to the list to be iterated over.
+);
+
+/**
+ * @brief (Re)set current position inside list to head.
+ */
+void listI_reset_head(
+	ListIterator* listI ///< "this" pointer.
+);
+
+/**
+ * @brief (Re)set current position inside list to tail.
+ */
+void listI_reset_tail(
+	ListIterator* listI ///< "this" pointer.
+);
+
+/**
+ * @brief Tell if there is some data at the current index.
+ */
+Bool listI_has_data(
+	ListIterator* listI ///< "this" pointer.
+);
+
+/**
+ * @brief Return data contained in the current list cell.
+ * @param listI "this" pointer.
+ * @param data Data to be assigned.
+ * 
+ * Usage: void listI_get(ListIterator* listI, void data)
+ */
+#define listI_get(listI, data) \
+	list_get(listI->current, data)
+
+/**
+ * @brief Set data at the current iterator position.
+ * @param listI "this" pointer
+ * @param data Data to assign.
+ * 
+ * Usage: void listI_set(ListIterator* listI, void data); 
+ */
+#define listI_set(listI, data) \
+	list_set(listI->list, listI->current, data)
+
+/**
+ * @brief Add data before current list cell.
+ * @param listI "this" pointer
+ * @param data Data to be inserted.
+ * 
+ * Usage: void listI_insert_before(ListIteratorI* listI, void data)
+ */
+#define listI_insert_before(listI, data) \
+	list_insert_before(listI->list, listI->current, data)
+
+/**
+ * @brief Add data after current list cell.
+ * @param listI "this" pointer
+ * @param data Data to be inserted.
+ * 
+ * Usage: void listI_insert_after(ListIteratorI* listI, void data)
+ */
+#define listI_insert_after(listI, data) \
+	list_insert_after(listI->list, listI->current, data)
+
+/**
+ * @brief Type to encode a direction (forward / backward).
+ */
+typedef enum {
+	BACKWARD = -1, ///< Move toward head.
+	FORWARD = 1 ///< Move toward tail.
+} Direction;
+
+/**
+ * @brief Remove data at the current iterator position.
+ */
+void listI_remove(
+	ListIterator* listI, ///< "this" pointer.
+	Direction direction ///< Indicate the position of iterator after removal.
+);
+
+/**
+ * @brief Move current iterator position forward (toward tail).
+ */
+void listI_move_next(
+	ListIterator* listI ///< "this" pointer.
+);
+
+/**
+ * @brief Move current iterator position backward (toward head).
+ */
+void listI_move_prev(
+	ListIterator* listI ///< "this" pointer.
+);
+
+/**
+ * @brief Free memory allocated for the iterator.
+ */
+void listI_destroy(
+	ListIterator* listI ///< "this" pointer.
+);
+
+#endif
diff --git a/src/Makefile.base b/src/Makefile.base
new file mode 100644
index 0000000..2df7d91
--- /dev/null
+++ b/src/Makefile.base
@@ -0,0 +1,13 @@
+CC = gcc
+CFLAGS = -g -std=gnu99 -fPIC
+LDFLAGS = -shared
+INCLUDES = -I..
+TARGET = libcgds.so
+
+all: obj/$(TARGET)
+
+clean:
+	rm -f obj/*.o
+	rm -f obj/$(TARGET)
+
+.PHONY: all clean
diff --git a/src/PriorityQueue.c b/src/PriorityQueue.c
new file mode 100644
index 0000000..5606db3
--- /dev/null
+++ b/src/PriorityQueue.c
@@ -0,0 +1,56 @@
+/**
+ * @file PriorityQueue.c
+ */
+
+#include "cgds/PriorityQueue.h"
+
+// NOTE: no _init() method here, since PriorityQueue has no specific initialization
+
+PriorityQueue* _priorityqueue_new(size_t dataSize, OrderType pType, UInt arity)
+{
+	PriorityQueue* priorityQueue = (PriorityQueue*) safe_malloc(sizeof (PriorityQueue));
+	Heap* heap = _heap_new(dataSize, pType, arity);
+	priorityQueue->heap = heap;
+	return priorityQueue;
+}
+
+PriorityQueue* priorityqueue_copy(PriorityQueue* priorityQueue)
+{
+	PriorityQueue* priorityQueueCopy = _priorityqueue_new(
+		priorityQueue->heap->array->dataSize,
+		priorityQueue->heap->hType, priorityQueue->heap->arity);
+	heap_destroy(priorityQueueCopy->heap); //TODO: bad style...
+	priorityQueueCopy->heap = heap_copy(priorityQueue->heap);
+	return priorityQueueCopy;
+}
+
+Bool priorityqueue_empty(PriorityQueue* priorityQueue)
+{
+	return heap_empty(priorityQueue->heap);
+}
+
+UInt priorityqueue_size(PriorityQueue* priorityQueue)
+{
+	return heap_size(priorityQueue->heap);
+}
+
+ItemValue* priorityqueue_peek_raw(PriorityQueue* priorityQueue)
+{
+	return heap_top_raw(priorityQueue->heap);
+}
+
+void priorityqueue_pop(PriorityQueue* priorityQueue)
+{
+	heap_pop(priorityQueue->heap);
+}
+
+void priorityqueue_clear(PriorityQueue* priorityQueue)
+{
+	heap_clear(priorityQueue->heap);
+}
+
+void priorityqueue_destroy(PriorityQueue* priorityQueue)
+{
+	heap_destroy(priorityQueue->heap);
+	safe_free(priorityQueue);
+}
diff --git a/src/PriorityQueue.h b/src/PriorityQueue.h
new file mode 100644
index 0000000..a543dd8
--- /dev/null
+++ b/src/PriorityQueue.h
@@ -0,0 +1,135 @@
+/**
+ * @file PriorityQueue.h
+ */
+
+#ifndef CGDS_PRIORITY_QUEUE_H
+#define CGDS_PRIORITY_QUEUE_H
+
+#include <stdlib.h>
+#include <string.h>
+#include "types.h"
+#include "cgds/Heap.h"
+#include "cgds/safe_alloc.h"
+
+/**
+ * @brief Priority queue data structure (wrapper around Heap).
+ */
+typedef struct PriorityQueue {
+	Heap* heap; ///< Internal heap.
+} PriorityQueue;
+
+/**
+ * @brief Return an allocated and initialized Queue.
+ */
+PriorityQueue* _priorityqueue_new(
+	size_t dataSize, ///< Size in bytes of a priority queue element.
+	OrderType pType, ///< Type of priority queue: max first (hType==MAX_T) or min first (hType==MIN_T).
+	UInt arity ///< Arity of the wrapped heap: any integer >=2.
+);
+
+/**
+ * @brief Return an allocated and initialized Queue.
+ * @param type Type of a priority queue item (int, char*, ...).
+ * @param pType type of priority queue: max first (hType==MAX_T) or min first (hType==MIN_T).
+ * @param arity Arity of the wrapped heap: any integer >=2.
+ * 
+ * Usage: PriorityQueue* priorityqueue_new(<Type> type, OrderType pType, UInt arity)
+ */
+#define priorityqueue_new(type, pType, arity) \
+	_priorityqueue_new(sizeof(type), pType, arity)
+
+/**
+ * @brief Copy constructor (works well if items do not have allocated sub-pointers).
+ */
+PriorityQueue* priorityqueue_copy(
+	PriorityQueue* priorityQueue ///< "this" pointer.
+);
+
+/**
+ * @brief Check if the priority queue is empty.
+ */
+Bool priorityqueue_empty(
+	PriorityQueue* priorityQueue ///< "this" pointer.
+);
+
+/**
+ * @brief Return the size of current priority queue.
+ */
+UInt priorityqueue_size(
+	PriorityQueue* priorityQueue ///< "this" pointer.
+);
+
+/**
+ * @brief Add an (item,priority) inside the priority queue.
+ * @param priorityQueue "this" pointer.
+ * @param item Item to be added.
+ * @param priority Priority of the added item.
+ * 
+ * Usage: void priorityqueue_insert(PriorityQueue* priorityQueue, void item, Real priority)
+ */
+#define priorityqueue_insert(priorityQueue, item, priority) \
+	heap_insert(priorityQueue->heap, item, priority)
+
+/**
+ * @brief Change the priority of an item in the queue.
+ * @param priorityQueue "this" pointer.
+ * @param item Item to be modified.
+ * @param newPriority New priority of the modified item.
+ * @note If several similar items are present, only the first is affected.
+ * 
+ * Usage: void priorityqueue_set_priority(PriorityQueue* priorityQueue, void item, Real newPriority)
+ */
+#define priorityqueue_set(priorityQueue, item, newPriority) \
+	heap_modify(priorityQueue->heap, item, newPriority)
+
+/**
+ * @brief Remove an item in the queue.
+ * @param priorityQueue "this" pointer.
+ * @param item Item to be removed.
+ * @note If several similar items are present, only the first is deleted.
+ * 
+ * Usage: void priorityqueue_remove(PriorityQueue* priorityQueue, void item)
+ */
+#define priorityqueue_remove(priorityQueue, item) \
+	heap_remove(priorityQueue->heap, item)
+
+/**
+ * @brief Return what is at the beginning of the queue.
+ * @return An ItemValue* 'iv' with iv->item is the data, and iv->value its priority.
+ */
+ItemValue* priorityqueue_peek_raw(
+	PriorityQueue* priorityQueue ///< "this" pointer.
+);
+
+/**
+ * @brief Peek the item at the beginning of the queue.
+ * @param priorityQueue "this" pointer.
+ * @param item Item to be assigned.
+ * 
+ * Usage: void priorityqueue_peek(PriorityQueue* priorityQueue, void item)
+ */
+#define priorityqueue_peek(priorityQueue, item) \
+	heap_top(priorityQueue->heap, item)
+
+/**
+ * @brief Remove the top element in the queue.
+ */
+void priorityqueue_pop(
+	PriorityQueue* priorityQueue ///< "this" pointer.
+);
+
+/** 
+ * @brief Clear the entire queue.
+ */
+void priorityqueue_clear(
+	PriorityQueue* priorityQueue ///< "this" pointer.
+);
+
+/**
+ * @brief Destroy the queue: clear it and free 'priorityQueue' memory.
+ */
+void priorityqueue_destroy(
+	PriorityQueue* priorityQueue ///< "this" pointer.
+);
+
+#endif
diff --git a/src/Queue.c b/src/Queue.c
new file mode 100644
index 0000000..5b24a3d
--- /dev/null
+++ b/src/Queue.c
@@ -0,0 +1,85 @@
+/**
+ * @file Queue.c
+ */
+
+#include "cgds/Queue.h"
+
+void _queue_init(Queue* queue, size_t dataSize)
+{
+	queue->size = 0;
+	queue->dataSize = dataSize;
+	queue->front = NULL;
+	queue->back = NULL;
+}
+
+Queue* _queue_new(size_t dataSize)
+{
+	Queue* queue = (Queue*) safe_malloc(sizeof (Queue));
+	_queue_init(queue, dataSize);
+	return queue;
+}
+
+Queue* queue_copy(Queue* queue)
+{
+	Queue* queueCopy = _queue_new(queue->dataSize);
+	QueueCell* queueCell = queue->front;
+	while (queueCell != NULL)
+	{
+		_queue_push(queueCopy, queueCell->data);
+		queueCell = queueCell->next;
+	}
+	return queueCopy;
+}
+
+Bool queue_empty(Queue* queue)
+{
+	return (queue->size == 0);
+}
+
+UInt queue_size(Queue* queue)
+{
+	return queue->size;
+}
+
+void _queue_push(Queue* queue, void* data)
+{
+	QueueCell* newQueueBack = (QueueCell*) safe_malloc(sizeof (QueueCell));
+	newQueueBack->data = safe_malloc(queue->dataSize);
+	memcpy(newQueueBack->data, data, queue->dataSize);
+	newQueueBack->next = NULL;
+	if (queue->size > 0) 
+		queue->back->next = newQueueBack;
+	queue->back = newQueueBack;
+	if (queue->size == 0) 
+		queue->front = newQueueBack;
+	queue->size++;
+}
+
+void* _queue_peek(Queue* queue)
+{
+	return queue->front->data;
+}
+
+void queue_pop(Queue* queue)
+{
+	QueueCell* toTrash = queue->front;
+	queue->front = queue->front->next;
+	if (queue->front == NULL) 
+		queue->back = NULL;
+	safe_free(toTrash->data);
+	safe_free(toTrash);
+	queue->size--;
+}
+
+void queue_clear(Queue* queue)
+{
+	while (queue->size > 0) 
+		queue_pop(queue);
+	_queue_init(queue, queue->dataSize);
+}
+
+void queue_destroy(Queue* queue)
+{
+	queue_clear(queue);
+	safe_free(queue);
+}
diff --git a/src/Queue.h b/src/Queue.h
new file mode 100644
index 0000000..db71579
--- /dev/null
+++ b/src/Queue.h
@@ -0,0 +1,141 @@
+/**
+ * @file Queue.h
+ */
+
+#ifndef CGDS_QUEUE_H
+#define CGDS_QUEUE_H
+
+#include <stdlib.h>
+#include <string.h>
+#include "cgds/types.h"
+#include "cgds/safe_alloc.h"
+
+/**
+ * @brief Generic internal queue cell.
+ */
+typedef struct QueueCell {
+	void* data; ///< Generic data contained in the cell.
+	struct QueueCell* next; ///< Next cell in the internal single-linked list.
+} QueueCell;
+
+/**
+ * @brief Queue containing generic data.
+ * @param dataSize Size in bytes of a queue element.
+ */
+typedef struct Queue {
+	UInt size; ///< Count elements in the queue.
+	size_t dataSize; ///< Size in bytes of a queue element.
+	QueueCell* front; ///< Pointer to the next dequeued element.
+	QueueCell* back; ///< Pointer to the last enqueued element.
+} Queue;
+
+/**
+ * @brief Initialize an empty queue.
+ * @param queue "this" pointer.
+ * @param dataSize Size in bytes of a queue element.
+ */
+void _queue_init(
+	Queue* queue, ///< "this" pointer.
+	size_t dataSize ///< Size in bytes of a queue element.
+);
+
+/** 
+ * @brief Return an allocated and initialized queue.
+ */
+Queue* _queue_new(
+	size_t dataSize ///< Size in bytes of a queue element.
+);
+
+/** 
+ * @brief Return an allocated and initialized queue.
+ * @param type Type of a queue element (int, char*, ...).
+ * 
+ * Usage: Queue* queue_new(<Type> type)
+ */
+#define queue_new(type) \
+	_queue_new(sizeof(type))
+
+/**
+ * @brief Copy constructor (works well if items do not have allocated sub-pointers).
+ */
+Queue* queue_copy(
+	Queue* queue ///< "this" pointer.
+);
+
+/**
+ * @brief Check if the queue is empty.
+ */
+Bool queue_empty(
+	Queue* queue ///< "this" pointer.
+);
+
+/**
+ * @brief Return size of the current queue.
+ */
+UInt queue_size(
+	Queue* queue ///< "this" pointer.
+);
+
+/**
+ * @brief Add something at the end of the queue.
+ */
+void _queue_push(
+	Queue* queue, ///< "this" pointer.
+	void* data ///< Data to be pushed.
+);
+
+/**
+ * @brief Add something at the end of the queue.
+ * @param queue "this" pointer
+ * @param data Data to be pushed.
+ * 
+ * Usage: void queue_push(Queue* queue, void data)
+ */
+#define queue_push(queue, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_queue_push(queue, &tmp); \
+}
+
+/**
+ * @brief Return what is at the beginning of the queue.
+ */
+void* _queue_peek(
+	Queue* queue ///< "this" pointer.
+);
+
+/**
+ * @brief Return what is at the beginning of the queue.
+ * @param queue "this" pointer.
+ * @param data Data to be assigned.
+ * 
+ * Usage: void queue_peek(Queue* queue, void data)
+ */
+#define queue_peek(queue, data) \
+{ \
+	void* pData = _queue_peek(queue); \
+	data = *((typeof(&data))pData); \
+}
+
+/**
+ * @brief Remove the beginning of the queue.
+ */
+void queue_pop(
+	Queue* queue ///< "this" pointer.
+);
+
+/**
+ * @brief Clear the entire queue.
+ */
+void queue_clear(
+	Queue* queue ///< "this" pointer.
+);
+
+/**
+ * @brief Destroy the queue: clear it, and free 'queue' pointer.
+ */
+void queue_destroy(
+	Queue* queue ///< "this" pointer.
+);
+
+#endif
diff --git a/src/Stack.c b/src/Stack.c
new file mode 100644
index 0000000..c37b775
--- /dev/null
+++ b/src/Stack.c
@@ -0,0 +1,84 @@
+/**
+ * @file Stack.c
+ */
+
+#include "cgds/Stack.h"
+
+void _stack_init(Stack* stack, size_t dataSize)
+{
+	stack->size = 0;
+	stack->dataSize = dataSize;
+	stack->top = NULL;
+}
+
+Stack* _stack_new(size_t dataSize)
+{
+	Stack* stack = (Stack*) safe_malloc(sizeof (Stack));
+	_stack_init(stack, dataSize);
+	return stack;
+}
+
+Stack* stack_copy(Stack* stack)
+{
+	// since a stack is a single-linked list, an auxiliary storage is required
+	void** tmpStorage = (void**) malloc(stack->size * sizeof (void*));
+	StackCell* stackCell = stack->top;
+	for (UInt i = 0; i < stack->size; i++)
+	{
+		tmpStorage[stack->size - 1 - i] = stackCell->data;
+		stackCell = stackCell->previous;
+	}
+	// now transfer tmpStorage contents (pushed in right order) in a new stack
+	Stack* stackCopy = _stack_new(stack->dataSize);
+	for (UInt i = 0; i < stack->size; i++)
+		_stack_push(stackCopy, tmpStorage[i]);
+	free(tmpStorage);
+	return stackCopy;
+}
+
+Bool stack_empty(Stack* stack)
+{
+	return (stack->size == 0);
+}
+
+UInt stack_size(Stack* stack)
+{
+	return stack->size;
+}
+
+void _stack_push(Stack* stack, void* data)
+{
+	StackCell* newStackTop = (StackCell*) safe_malloc(sizeof (StackCell));
+	newStackTop->data = safe_malloc(stack->dataSize);
+	memcpy(newStackTop->data, data, stack->dataSize);
+	newStackTop->previous = stack->top;
+	stack->top = newStackTop;
+	stack->size++;
+}
+
+void* _stack_top(Stack* stack)
+{
+	return stack->top->data;
+}
+
+void stack_pop(Stack* stack)
+{
+	StackCell* toTrash = stack->top;
+	stack->top = stack->top->previous;
+	safe_free(toTrash->data);
+	safe_free(toTrash);
+	stack->size--;
+}
+
+void stack_clear(Stack* stack)
+{
+	while (stack->size > 0) 
+		stack_pop(stack);
+	_stack_init(stack, stack->dataSize);
+}
+
+void stack_destroy(Stack* stack)
+{
+	stack_clear(stack);
+	safe_free(stack);
+}
diff --git a/src/Stack.h b/src/Stack.h
new file mode 100644
index 0000000..d246107
--- /dev/null
+++ b/src/Stack.h
@@ -0,0 +1,137 @@
+/**
+ * @file Stack.h
+ */
+
+#ifndef CGDS_STACK_H
+#define CGDS_STACK_H
+
+#include <stdlib.h>
+#include <string.h>
+#include "cgds/types.h"
+#include "cgds/safe_alloc.h"
+
+/**
+ * @brief Generic internal stack cell.
+ */
+typedef struct StackCell {
+	void* data; ///< Generic data contained in the cell.
+	struct StackCell* previous; ///< Previous cell in the internal single-linked list.
+} StackCell;
+
+/**
+ * @brief Stack containing generic data.
+ */
+typedef struct Stack {
+	UInt size; ///< Count elements in the stack.
+	size_t dataSize; ///< Size in bytes of a stack element.
+	StackCell* top; ///< Last added element, on top of the stack.
+} Stack;
+
+/**
+ * @brief Initialize an empty stack.
+ */
+void _stack_init(
+	Stack* stack, ///< "this" pointer.
+	size_t dataSize ///< Size in bytes of a stack element.
+);
+
+/** 
+ * @brief Return an allocated and initialized stack.
+ */
+Stack* _stack_new(
+	size_t dataSize ///< Size in bytes of a stack element.
+);
+
+/** 
+ * @brief Return an allocated and initialized stack.
+ * @param type Type of a stack element (int, char*, ...).
+ * 
+ * Usage: Stack* stack_new(<Type> type)
+ */
+#define stack_new(type) \
+	_stack_new(sizeof(type))
+
+/**
+ * @brief Copy constructor (works well if items do not have allocated sub-pointers).
+ */
+Stack* stack_copy(
+	Stack* stack ///< "this" pointer.
+);
+
+/**
+ * @brief Check if the stack is empty.
+ */
+Bool stack_empty(
+	Stack* stack ///< "this" pointer.
+);
+
+/**
+ * @brief Return size of the current stack.
+ */
+UInt stack_size(
+	Stack* stack ///< "this" pointer.
+);
+
+/**
+ * @brief Add something on top of the stack.
+ */
+void _stack_push(
+	Stack* stack, ///< "this" pointer.
+	void* data ///< Data to be added.
+);
+
+/**
+ * @brief Add something on top of the stack.
+ * @param stack "this" pointer.
+ * @param data Data to be added.
+ * 
+ * Usage: void stack_push(Stack* stack, void data)
+ */
+#define stack_push(stack, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_stack_push(stack,&tmp); \
+}
+
+/**
+ * @brief Return what is on top of the stack.
+ */
+void* _stack_top(
+	Stack* stack ///< "this" pointer.
+);
+
+/**
+ * @brief Return what is on top of the stack.
+ * @param stack "this" pointer.
+ * @param data Data to be assigned.
+ * 
+ * Usage: void stack_top(Stack* stack, void data)
+ */
+#define stack_top(stack, data) \
+{ \
+	void* pData = _stack_top(stack); \
+	data = *((typeof(&data))pData); \
+}
+
+/**
+ * @brief Remove the top of the stack.
+ */
+void stack_pop(
+	Stack* stack ///< "this" pointer.
+);
+
+/**
+ * @brief Clear the entire stack.
+ */
+void stack_clear(
+	Stack* stack ///< "this" pointer.
+);
+
+/**
+ * @brief Destroy the stack: clear it, and free 'stack' pointer.
+ */
+void stack_destroy(
+	Stack* stack ///< "this" pointer.
+);
+
+#endif
diff --git a/src/Tree.c b/src/Tree.c
new file mode 100644
index 0000000..fe21a6b
--- /dev/null
+++ b/src/Tree.c
@@ -0,0 +1,323 @@
+/**
+ * @file Tree.c
+ */
+
+#include "cgds/Tree.h"
+
+////////////////
+// Tree logic //
+////////////////
+
+void _tree_init(Tree* tree, size_t dataSize)
+{
+	tree->root = NULL;
+	tree->dataSize = dataSize;
+	tree->size = 0;
+}
+
+Tree* _tree_new(size_t dataSize)
+{
+	Tree* tree = (Tree*) safe_malloc(sizeof (Tree));
+	_tree_init(tree, dataSize);
+	return tree;
+}
+
+Tree* tree_copy(Tree* tree)
+{
+	Tree* treeCopy = _tree_new(tree->dataSize);
+	if (tree->root == NULL) 
+		return treeCopy;
+	_tree_set_root(treeCopy, tree->root->data);
+
+	// Now parallel run on both trees (manual breadth-first walk)
+	TreeNode* treeNode = tree->root;
+	TreeNode* treeNodeCopy = treeCopy->root;
+	while (treeNode != NULL)
+	{
+		// process current children
+		TreeNode* child = treeNode->firstChild;
+		while (child != NULL)
+		{
+			_tree_add_child(treeCopy, treeNodeCopy, child->data);
+			child = child->next;
+		}
+
+		// try to go to next sibling (NOTE: already added as child of parent)
+		if (treeNode->next != NULL)
+		{
+			treeNode = treeNode->next;
+			treeNodeCopy = treeNodeCopy->next;
+			continue;
+		}
+
+		// try to go to next "cousin" on same level
+		if (treeNode->parent != NULL && treeNode->parent->next != NULL)
+		{
+			TreeNode* treeNodeParent = treeNode->parent->next;
+			TreeNode* treeNodeParentCopy = treeNodeCopy->parent->next;
+			while (treeNodeParent != NULL && tree_is_leaf(treeNodeParent))
+			{
+				treeNodeParent = treeNodeParent->next;
+				treeNodeParentCopy = treeNodeParentCopy->next;
+			}
+			if (treeNodeParent != NULL)
+			{
+				treeNode = treeNodeParent->firstChild;
+				treeNodeCopy = treeNodeParentCopy->firstChild;
+				continue;
+			}
+		}
+
+		// try to go to next level, and move treeNodeCopy accordingly
+		while (treeNode->prev != NULL)
+		{
+			treeNode = treeNode->prev;
+			treeNodeCopy = treeNodeCopy->prev;
+		}
+		while (treeNode != NULL && tree_is_leaf(treeNode))
+		{
+			treeNode = treeNode->next;
+			treeNodeCopy = treeNodeCopy->next;
+		}
+		if (treeNode != NULL)
+		{
+			treeNode = treeNode->firstChild;
+			treeNodeCopy = treeNodeCopy->firstChild;
+		}
+	}
+	return treeCopy;
+}
+
+Bool tree_empty(Tree* tree)
+{
+	return (tree->root == NULL);
+}
+
+UInt tree_size(Tree* tree)
+{
+	return tree->size;
+}
+
+UInt _tree_height_rekursiv(TreeNode* treeNode)
+{
+	if (tree_is_leaf(treeNode)) 
+		return 1;
+	TreeNode* child = treeNode->firstChild;
+	UInt maxHeightChild = 0;
+	while (child != NULL)
+	{
+		UInt heightChild = _tree_height_rekursiv(child);
+		if (heightChild > maxHeightChild) 
+			maxHeightChild = heightChild;
+		child = child->next;
+	}
+	return 1 + maxHeightChild;
+}
+
+UInt tree_height(Tree* tree)
+{
+	if (tree_empty(tree)) 
+		return 0;
+	return _tree_height_rekursiv(tree->root);
+}
+
+Bool tree_is_leaf(TreeNode* treeNode)
+{
+	return (treeNode->firstChild == NULL);
+}
+
+void _tree_set_root(Tree* tree, void* data)
+{
+	tree->root = (TreeNode*) safe_malloc(sizeof (TreeNode));
+	tree->root->data = safe_malloc(tree->dataSize);
+	memcpy(tree->root->data, data, tree->dataSize);
+	tree->root->parent = NULL;
+	tree->root->firstChild = NULL;
+	tree->root->lastChild = NULL;
+	tree->root->prev = NULL;
+	tree->root->next = NULL;
+	tree->size = 1;
+}
+
+void* _tree_get(TreeNode* treeNode)
+{
+	return treeNode->data;
+}
+
+void _tree_set(Tree* tree, TreeNode* treeNode, void* data)
+{
+	memcpy(treeNode->data, data, tree->dataSize);
+}
+
+void _tree_add_child(Tree* tree, TreeNode* treeNode, void* data)
+{
+	TreeNode* newChildNode = (TreeNode*) safe_malloc(sizeof (TreeNode));
+	newChildNode->data = safe_malloc(tree->dataSize);
+	memcpy(newChildNode->data, data, tree->dataSize);
+	newChildNode->next = NULL;
+	if (treeNode->lastChild != NULL) 
+		treeNode->lastChild->next = newChildNode;
+	newChildNode->prev = treeNode->lastChild;
+	treeNode->lastChild = newChildNode;
+	if (treeNode->firstChild == NULL) 
+		treeNode->firstChild = newChildNode;
+	newChildNode->parent = treeNode;
+	newChildNode->firstChild = NULL;
+	newChildNode->lastChild = NULL;
+	tree->size++;
+}
+
+void _tree_add_sibling(Tree* tree, TreeNode* treeNode, void* data)
+{
+	TreeNode* newSiblingNode = (TreeNode*) safe_malloc(sizeof (TreeNode));
+	newSiblingNode->data = safe_malloc(tree->dataSize);
+	memcpy(newSiblingNode->data, data, tree->dataSize);
+	newSiblingNode->next = treeNode->next;
+	if (treeNode->next != NULL) 
+		treeNode->next->prev = newSiblingNode;
+	newSiblingNode->prev = treeNode;
+	treeNode->next = newSiblingNode;
+	newSiblingNode->parent = treeNode->parent;
+	newSiblingNode->firstChild = NULL;
+	newSiblingNode->lastChild = NULL;
+	tree->size++;
+}
+
+void _tree_remove_rekursiv(Tree* tree, TreeNode* treeNode)
+{
+	TreeNode* child = treeNode->firstChild;
+	while (child != NULL)
+	{
+		TreeNode* nextChild = child->next;
+		_tree_remove_rekursiv(tree, child);
+		child = nextChild;
+	}
+	safe_free(treeNode->data);
+	safe_free(treeNode);
+	tree->size--;
+}
+
+void tree_remove(Tree* tree, TreeNode* treeNode)
+{
+	if (treeNode->parent != NULL)
+	{
+		if (treeNode->prev == NULL) 
+			treeNode->parent->firstChild = treeNode->next;
+		if (treeNode->next == NULL) 
+			treeNode->parent->lastChild = treeNode->prev;
+	}
+	if (treeNode->next != NULL) 
+		treeNode->next->prev = treeNode->prev;
+	if (treeNode->prev != NULL) 
+		treeNode->prev->next = treeNode->next;
+	_tree_remove_rekursiv(tree, treeNode);
+}
+
+void tree_rm_childs(Tree* tree, TreeNode* treeNode)
+{
+	TreeNode* child = treeNode->firstChild;
+	while (child != NULL)
+	{
+		TreeNode* nextChild = child->next;
+		_tree_remove_rekursiv(tree, child);
+		child = nextChild;
+	}
+	treeNode->firstChild = NULL;
+	treeNode->lastChild = NULL;
+}
+
+void tree_clear(Tree* tree)
+{
+	if (tree->root != NULL) 
+		_tree_remove_rekursiv(tree, tree->root);
+	_tree_init(tree, tree->dataSize);
+}
+
+void tree_destroy(Tree* tree)
+{
+	if (tree->root != NULL) 
+		tree_clear(tree);
+	safe_free(tree);
+}
+
+////////////////////
+// Iterator logic //
+////////////////////
+
+TreeIterator* tree_get_iterator(Tree* tree, TreeIteratorMode mode)
+{
+	TreeIterator* treeI = (TreeIterator*) safe_malloc(sizeof (TreeIterator));
+	treeI->tree = tree;
+	treeI->mode = mode;
+	treeI_reset(treeI);
+	return treeI;
+}
+
+void treeI_reset(TreeIterator* treeI)
+{
+	treeI->current = treeI->tree->root;
+}
+
+Bool treeI_has_data(TreeIterator* treeI)
+{
+	return (treeI->current != NULL);
+}
+
+TreeNode* treeI_get_raw(TreeIterator* treeI)
+{
+	return treeI->current;
+}
+
+void treeI_move_next(TreeIterator* treeI)
+{
+	TreeIteratorMode mode = treeI->mode;
+	switch (mode)
+	{
+	case IN_DEPTH:
+		if (!tree_is_leaf(treeI->current))
+		{
+			// easy case: just descend deeper in the tree
+			treeI->current = treeI->current->firstChild;
+			return;
+		}
+		// leaf: while no next sibling is available, move up
+		while (treeI->current != NULL && treeI->current->next == NULL)
+			treeI->current = treeI->current->parent;
+		if (treeI->current != NULL)
+			// run goes on from next sibling
+			treeI->current = treeI->current->next;
+		break;
+	case IN_BREADTH:
+		if (treeI->current->next != NULL)
+		{
+			// easy case : just move to the next sibling
+			treeI->current = treeI->current->next;
+			return;
+		}
+		// try to go to next "cousin" on same level
+		if (treeI->current->parent != NULL && treeI->current->parent->next != NULL)
+		{
+			TreeNode* treeNodeParent = treeI->current->parent->next;
+			while (treeNodeParent != NULL && tree_is_leaf(treeNodeParent))
+				treeNodeParent = treeNodeParent->next;
+			if (treeNodeParent != NULL)
+			{
+				treeI->current = treeNodeParent->firstChild;
+				return;
+			}
+		}
+		// try to go to next level
+		while (treeI->current->prev != NULL)
+			treeI->current = treeI->current->prev;
+		while (treeI->current != NULL && tree_is_leaf(treeI->current))
+			treeI->current = treeI->current->next;
+		if (treeI->current != NULL)
+			treeI->current = treeI->current->firstChild;
+		break;
+	}
+}
+
+void treeI_destroy(TreeIterator* treeI)
+{
+	safe_free(treeI);
+}
diff --git a/src/Tree.h b/src/Tree.h
new file mode 100644
index 0000000..3fa66fc
--- /dev/null
+++ b/src/Tree.h
@@ -0,0 +1,336 @@
+/**
+ * @file Tree.h
+ */
+
+#ifndef CGDS_TREE_H
+#define CGDS_TREE_H
+
+#include <stdlib.h>
+#include <string.h>
+#include "cgds/safe_alloc.h"
+#include "cgds/types.h"
+
+//***********
+// Tree logic
+//***********
+
+/**
+ * @brief Tree node, containing some generic data.
+ */
+typedef struct TreeNode {
+	void* data; ///< Generic data contained in this node.
+	struct TreeNode* parent; ///< Pointer to parent node (NULL if node is root).
+	struct TreeNode* firstChild; ///< Pointer to the first child (if any).
+	struct TreeNode* lastChild; ///< Pointer to the last child (if any).
+	struct TreeNode* prev; ///< Pointer to the previous sibling (on the left).
+	struct TreeNode* next; ///< Pointer to the next sibling (on the right).
+} TreeNode;
+
+/**
+ * @brief Generic multi-ary tree.
+ */
+typedef struct Tree {
+	TreeNode* root; ///< Root node of the tree.
+	size_t dataSize; ///< Size of *data at a tree node, in bytes.
+	UInt size; ///< Count nodes in the tree.
+} Tree;
+
+/**
+ * @brief Initialize an empty tree.
+ */
+void _tree_init(
+	Tree* tree, ///< "this" pointer.
+	size_t dataSize ///< Size in bytes of a tree element.
+);
+
+/**
+ * @brief Return an allocated and initialized tree.
+ */
+Tree* _tree_new(
+	size_t dataSize ///< Size in bytes of a tree node element.
+);
+
+/**
+ * @brief Return an allocated and initialized tree.
+ * @param type Type at a tree node (int, char*, ...).
+ * 
+ * Usage: Tree* tree_new(<Type> type)
+ */
+#define tree_new(type) \
+	_tree_new(sizeof(type))
+
+/**
+ * @brief Copy constructor (works well if items do not have allocated sub-pointers).
+ */
+Tree* tree_copy(
+	Tree* tree ///< "this" pointer.
+);
+
+/**
+ * @brief Check if the tree is empty.
+ */
+Bool tree_empty(
+	Tree* tree ///< "this" pointer.
+);
+
+/**
+ * @brief return current size of the tree (counting nodes).
+ */
+UInt tree_size(
+	Tree* tree ///< "this" pointer.
+);
+
+/**
+ * @brief Auxiliary function to get tree height.
+ */
+UInt _tree_height_rekursiv(
+	TreeNode* treeNode ///< Pointer to a node in the "this" tree.
+);
+
+/**
+ * @brief Return tree height (max depth from root to leaves).
+ */
+UInt tree_height(
+	Tree* tree ///< "this" pointer.
+);
+
+/**
+ * @brief Check if a sub-tree is a leaf (without children).
+ */
+Bool tree_is_leaf(
+	TreeNode* treeNode ///< Pointer to a node in the "this" tree.
+);
+
+/**
+ * @brief Initialize tree root when the tree is empty.
+ */
+void _tree_set_root(
+	Tree* tree, ///< "this" pointer.
+	void* data ///< Pointer to data to be assigned.
+);
+
+/**
+ * @brief Initialize tree root when the tree is empty.
+ * @param tree "this" pointer.
+ * @param data Data to be assigned.
+ * 
+ * Usage: void tree_set_root(Tree* tree, void data)
+ */
+#define tree_set_root(tree, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_tree_set_root(tree, &tmp); \
+}
+
+/**
+ * @brief Return data contained in a given tree node.
+ */
+void* _tree_get(
+	TreeNode* treeNode ///< Pointer to a node in the "this" tree.
+);
+
+/**
+ * @brief Retrieve data contained in a given tree node.
+ * @param treeNode Pointer to a node in the "this" tree.
+ * @param data Data to be assigned.
+ * 
+ * Usage: void tree_get(TreeNode* treeNode, void data)
+ */
+#define tree_get(treeNode, data) \
+{ \
+	void* pData = _tree_get(treeNode); \
+	data = *((typeof(&data))pData); \
+}
+
+/**
+ * @brief Set (alter) data at tree node passed as argument.
+ */
+void _tree_set(
+	Tree* tree, ///< "this" pointer.
+	TreeNode* treeNode, ///< Pointer to a node in the "this" tree.
+	void* data ///< Pointer to data to be assigned.
+);
+
+/**
+ * @brief Set (alter) data at tree node passed as argument.
+ * @param tree "this" pointer.
+ * @param treeNode Pointer to a node in the "this" tree.
+ * @param data Data to be assigned.
+ * 
+ * Usage: void tree_set(Tree* tree, TreeNode* treeNode, void data)
+ */
+#define tree_set(tree, treeNode, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_tree_set(tree,treeNode,&tmp); \
+}
+
+/**
+ * @brief Add a child to current node children.
+ */
+void _tree_add_child(
+	Tree* tree, ///< "this" pointer.
+	TreeNode* treeNode, ///< Pointer to a node in the "this" tree.
+	void* data ///< Pointer to data to be added.
+);
+
+/**
+ * @brief Add a child to current node children.
+ * @param tree "this" pointer.
+ * @param treeNode Pointer to a node in the "this" tree.
+ * @param data Data to be added.
+ * 
+ * Usage: void tree_add_child(Tree* tree, TreeNode* treeNode, void data)
+ */
+#define tree_add_child(tree,treeNode,data) \
+{ \
+	typeof((data)) tmp = data; \
+	_tree_add_child(tree,treeNode,&tmp); \
+}
+
+/**
+ * @brief Add a sibling to current node (after it on the right).
+ */
+void _tree_add_sibling(
+	Tree* tree, ///< "this" pointer.
+	TreeNode* treeNode, ///< Pointer to a node in the "this" tree.
+	void* data ///< Pointer to data to be added.
+);
+
+/**
+ * @brief Add a sibling to current node (after it on the right).
+ * @param tree "this" pointer.
+ * @param treeNode Pointer to a node in the "this" tree.
+ * @param data Data to be added.
+ * 
+ * Usage: void tree_add_sibling(Tree* tree, TreeNode* treeNode, void data)
+ */
+#define tree_add_sibling(tree, treeNode, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_tree_add_sibling(tree, treeNode, &tmp); \
+}
+
+/**
+ * @brief Auxiliary to remove a subtree.
+ */
+void _tree_remove_rekursiv(
+	Tree* tree, ///< "this" pointer.
+	TreeNode* treeNode ///< Pointer to a node in the "this" tree.
+);
+
+/**
+ * @brief Remove the whole subtree rooted at 'treeNode'.
+ */
+void tree_remove(
+	Tree* tree, ///< "this" pointer.
+	TreeNode* treeNode ///< Pointer to a node in the "this" tree.
+);
+
+/**
+ * @brief Remove children of the tree node given as argument.
+ */
+void tree_rm_childs(
+	Tree* tree, ///< "this" pointer.
+	TreeNode* treeNode ///< Pointer to a node in the "this" tree.
+);
+
+/**
+ * @brief Clear the entire tree.
+ */
+void tree_clear(
+	Tree* tree ///< "this" pointer.
+);
+
+/**
+ * @brief Destroy the tree: clear it, and free 'tree' pointer.
+ */
+void tree_destroy(
+	Tree* tree ///< "this" pointer.
+);
+
+//***************
+// Iterator logic
+//***************
+
+/**
+ * @brief Type of tree search: depth first or breadth first walk.
+ */
+typedef enum TreeIteratorMode {
+	IN_DEPTH = 0, ///< Depth first.
+	IN_BREADTH = 1 ///< Breadth first.
+} TreeIteratorMode;
+
+/**
+ * @brief Iterator on a tree object.
+ */
+typedef struct TreeIterator {
+	Tree* tree; ///< Pointer to the tree to iterate over.
+	TreeNode* current; ///< Current iterator position.
+	TreeIteratorMode mode; ///< Mode of iteration (in depth or in breadth).
+} TreeIterator;
+
+/**
+ * @brief Obtain an iterator object, starting at tree root.
+ */
+TreeIterator* tree_get_iterator(
+	Tree* tree, ///< Pointer to the tree to iterate over.
+	TreeIteratorMode mode ///< Mode of iteration (in depth or in breadth).
+);
+
+/**
+ * @brief (Re)set current position inside tree to root.
+ */
+void treeI_reset(
+	TreeIterator* treeI ///< "this" pointer.
+);
+
+/**
+ * @brief Tell if there is some data at the current index.
+ */
+Bool treeI_has_data(
+	TreeIterator* treeI ///< "this" pointer.
+);
+
+/**
+ * @brief Return current tree node.
+ */
+TreeNode* treeI_get_raw(
+	TreeIterator* treeI ///< "this" pointer.
+);
+
+/**
+ * @brief Get data at current tree node.
+ * @param treeI "this" pointer.
+ * @param data Data to be assigned.
+ * 
+ * Usage: void treeI_get(TreeIterator* treeI, void data)
+ */
+#define treeI_get(treeI, data) \
+	tree_get(treeI->current, data)
+
+/**
+ * @brief Set (alter) data at current tree node.
+ * @param treeI "this" pointer.
+ * @param data Data to be assigned.
+ * 
+ * Usage: void treeI_set(TreeIterator* treeI, void data)
+ */
+#define treeI_set(treeI, data) \
+	tree_set(treeI->tree, treeI->current, data)
+
+/**
+ * @brief Move current iterator position forward (toward leaves).
+ */
+void treeI_move_next(
+	TreeIterator* treeI ///< "this" pointer.
+);
+
+/**
+ * @brief Free memory allocated for the iterator.
+ */
+void treeI_destroy(
+	TreeIterator* treeI ///< "this" pointer.
+);
+
+#endif
diff --git a/src/Vector.c b/src/Vector.c
new file mode 100644
index 0000000..2d00985
--- /dev/null
+++ b/src/Vector.c
@@ -0,0 +1,160 @@
+/**
+ * @file Vector.cpp
+ */
+
+#include "cgds/Vector.h"
+
+//////////////////
+// Vector logic //
+//////////////////
+
+void _vector_init(Vector* vector, size_t dataSize)
+{
+	vector->datas = NULL;
+	vector->dataSize = dataSize;
+	vector->size = 0;
+	vector->capacity = 0;
+}
+
+Vector* _vector_new(size_t dataSize)
+{
+	Vector* vector = (Vector*) safe_malloc(sizeof (Vector));
+	_vector_init(vector, dataSize);
+	return vector;
+}
+
+Vector* vector_copy(Vector* vector)
+{
+	Vector* vectorCopy = _vector_new(vector->dataSize);
+	vectorCopy->size = vector->size;
+	vectorCopy->capacity = vector->capacity;
+	vectorCopy->datas = (void**) safe_malloc(vector->capacity * sizeof (void*));
+	for (UInt i = 0; i < vector->size; i++)
+	{
+		vectorCopy->datas[i] = safe_malloc(vector->dataSize);
+		memcpy(vectorCopy->datas[i], vector->datas[i], vector->dataSize);
+	}
+	return vectorCopy;
+}
+
+Bool vector_empty(Vector* vector)
+{
+	return (vector->size == 0);
+}
+
+UInt vector_size(Vector* vector)
+{
+	return vector->size;
+}
+
+void _vector_realloc(Vector* vector, UInt newCapacity)
+{
+	void** rellocatedDatas = (void**) safe_malloc(newCapacity * sizeof (void*));
+	for (UInt i = 0; i < vector->size; i++)
+	{
+		rellocatedDatas[i] = (void*) safe_malloc(vector->dataSize);
+		memcpy(rellocatedDatas[i], vector->datas[i], vector->dataSize);
+		safe_free(vector->datas[i]);
+	}
+	safe_free(vector->datas);
+	vector->datas = rellocatedDatas;
+	vector->capacity = newCapacity;
+}
+
+void _vector_push(Vector* vector, void* data)
+{
+	void* pData = safe_malloc(vector->dataSize);
+	memcpy(pData, data, vector->dataSize);
+	if (vector->size >= vector->capacity)
+	{
+		UInt increasedCapacity = vector->capacity > 0 ? 2 * vector->capacity : 1;
+		_vector_realloc(vector, increasedCapacity);
+	}
+	vector->datas[vector->size] = pData;
+	vector->size++;
+}
+
+void vector_pop(Vector* vector)
+{
+	safe_free(vector->datas[vector_size(vector) - 1]);
+	vector->size--;
+	if (vector_size(vector) <= (vector->capacity >> 1))
+		_vector_realloc(vector, vector->capacity >> 1);
+}
+
+void* _vector_get(Vector* vector, UInt index)
+{
+	return vector->datas[index];
+}
+
+void _vector_set(Vector* vector, UInt index, void* data)
+{
+	memcpy(vector->datas[index], data, vector->dataSize);
+}
+
+void vector_clear(Vector* vector)
+{
+	for (UInt i = 0; i < vector->size; i++)
+		safe_free(vector->datas[i]);
+	safe_free(vector->datas);
+	_vector_init(vector, vector->dataSize);
+}
+
+void vector_destroy(Vector* vector)
+{
+	vector_clear(vector);
+	safe_free(vector);
+}
+
+////////////////////
+// Iterator logic //
+////////////////////
+
+VectorIterator* vector_get_iterator(Vector* vector)
+{
+	VectorIterator* vectorI = (VectorIterator*) safe_malloc(sizeof (VectorIterator));
+	vectorI->vector = vector;
+	vectorI_reset_begin(vectorI);
+	return vectorI;
+}
+
+void vectorI_reset_begin(VectorIterator* vectorI)
+{
+	vectorI->current = vectorI->vector->datas;
+}
+
+void vectorI_reset_end(VectorIterator* vectorI)
+{
+	vectorI->current = vectorI->vector->datas + vectorI->vector->size - 1;
+}
+
+Bool vectorI_has_data(VectorIterator* vectorI)
+{
+	return (vectorI->current >= vectorI->vector->datas &&
+		vectorI->current < vectorI->vector->datas + vectorI->vector->size);
+}
+
+void* _vectorI_get(VectorIterator* vectorI)
+{
+	return *(vectorI->current);
+}
+
+void _vectorI_set(VectorIterator* vectorI, void* data)
+{
+	*(vectorI->current) = data;
+}
+
+void vectorI_move_next(VectorIterator* vectorI)
+{
+	vectorI->current++;
+}
+
+void vectorI_move_prev(VectorIterator* vectorI)
+{
+	vectorI->current--;
+}
+
+void vectorI_destroy(VectorIterator* vectorI)
+{
+	safe_free(vectorI);
+}
diff --git a/src/Vector.h b/src/Vector.h
new file mode 100644
index 0000000..d3fe04c
--- /dev/null
+++ b/src/Vector.h
@@ -0,0 +1,269 @@
+/**
+ * @file Vector.h
+ */
+
+#ifndef CGDS_VECTOR_H
+#define CGDS_VECTOR_H
+
+#include <stdlib.h>
+#include <string.h>
+#include "cgds/safe_alloc.h"
+#include "cgds/types.h"
+
+//*************
+// Vector logic
+//*************
+
+/**
+ * @brief Generic resizable array.
+ */
+typedef struct Vector {
+	void** datas; ///< Data array of fixed length (reallocated if needed).
+	size_t dataSize; ///< Size in bytes of a vector element.
+	UInt size; ///< Count elements in the vector.
+	UInt capacity; ///< Current maximal capacity; always larger than size.
+} Vector;
+
+/**
+ * @brief Initialize an empty vector.
+ */
+void _vector_init(
+	Vector* vector, ///< "this" pointer.
+	size_t dataSize ///< Size in bytes of a vector element.
+);
+
+/**
+ * @brief Return an allocated and initialized vector.
+ */
+Vector* _vector_new(
+	size_t dataSize ///< Size in bytes of a vector element.
+);
+
+/**
+ * @brief Return an allocated and initialized vector.
+ * @param type Type of a vector element (int, char*, ...).
+ * 
+ * Usage: Vector* vector_new(<Type> type)
+ */
+#define vector_new(type) \
+	_vector_new(sizeof(type))
+
+/**
+ * @brief Copy constructor (works well if items do not have allocated sub-pointers).
+ */
+Vector* vector_copy(
+	Vector* vector ///< "this" pointer.
+);
+
+/**
+ * @brief Check if the vector is empty.
+ */
+Bool vector_empty(
+	Vector* vector ///< "this" pointer.
+);
+
+/**
+ * @brief Return current size.
+ */
+UInt vector_size(
+	Vector* vector ///< "this" pointer.
+);
+
+/**
+ * @brief Reallocate internal array.
+ */
+void _vector_realloc(
+	Vector* vector, ///< "this" pointer.
+	UInt newCapacity ///< New capacity of the vector (in number of elements).
+);
+
+/**
+ * @brief Add data at the end.
+ */
+void _vector_push(
+	Vector* vector, ///< "this" pointer.
+	void* data ///< Data to be added.
+);
+
+/**
+ * @brief Add data at the end.
+ * @param vector "this" pointer.
+ * @param data Data to be added.
+ * 
+ * Usage: void vector_push(Vector* vector, void data)
+ */
+#define vector_push(vector, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_vector_push(vector,&tmp); \
+}
+
+/**
+ * @brief Remove the last pushed element.
+ */
+void vector_pop(
+	Vector* vector ///< "this" pointer.
+);
+
+/**
+ * @brief Get the element at given index.
+ */
+void* _vector_get(
+	Vector* vector, ///< "this" pointer.
+	UInt index ///< Index of the element to retrieve.
+);
+
+/**
+ * @brief Get the element at given index.
+ * @param vector "this" pointer.
+ * @param index Index of the element to retrieve.
+ * @param data 'out' variable to contain the result.
+ * 
+ * Usage: void vector_get(Vector* vector, size_t index, void data)
+ */
+#define vector_get(vector, index, data) \
+{ \
+	void* pData = _vector_get(vector,index); \
+	data = *((typeof(&data))pData); \
+}
+
+/**
+ * @brief Set the element at given index.
+ */
+void _vector_set(
+	Vector* vector, ///< "this" pointer.
+	UInt index, ///< Index of the element to be modified.
+	void* data ///< Pointer to new data at given index.
+);
+
+/**
+ * @brief Set the element at given index.
+ * @param vector "this" pointer.
+ * @param index Index of the element to be modified.
+ * @param data New data at given index.
+ * 
+ * Usage: void vector_set(Vector* vector, size_t index, void data)
+ */
+#define vector_set(vector, index, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_vector_set(vector,index,&tmp); \
+}
+
+/**
+ * @brief Clear the entire vector.
+ */
+void vector_clear(
+	Vector* vector ///< "this" pointer.
+);
+
+/**
+ * @brief Destroy the vector: clear it, and free 'vector' pointer.
+ */
+void vector_destroy(
+	Vector* vector ///< "this" pointer.
+);
+
+//***************
+// Iterator logic
+//***************
+
+/**
+ * @brief Iterator on a generic vector.
+ */
+typedef struct VectorIterator {
+	Vector* vector; ///< Vector to be iterated.
+	void** current; ///< Current vector element.
+} VectorIterator;
+
+/**
+ * @brief Obtain an iterator object, starting at vector beginning (index 0).
+ */
+VectorIterator* vector_get_iterator(
+	Vector* vector ///< Pointer to the vector to iterate over.
+);
+
+/**
+ * @brief (Re)set current position inside vector to beginning (0).
+ */
+void vectorI_reset_begin(
+	VectorIterator* vectorI ///< "this" pointer.
+);
+
+/**
+ * @brief (Re)set current position inside vector to end (vector->size-1).
+ */
+void vectorI_reset_end(
+	VectorIterator* vectorI ///< "this" pointer.
+);
+
+/**
+ * @brief Tell if there is some data at the current index.
+ */
+Bool vectorI_has_data(
+	VectorIterator* vectorI ///< "this" pointer.
+);
+
+/**
+ * @brief Get data contained at the current index.
+ */
+void* _vectorI_get(
+	VectorIterator* vectorI ///< "this" pointer.
+);
+
+/**
+ * @brief Get data contained at the current index.
+ * @param vectorI "this" pointer.
+ * @param data 'out' variable to contain the result.
+ * 
+ * Usage: void vectorI_get(VectorIterator* vectorI, void data);
+ */
+#define vectorI_get(vectorI, data) \
+{ \
+	void* pData = _vectorI_get(vectorI); \
+	data = *((typeof(&data))pData); \
+}
+
+/**
+ * @brief Set the element at current index.
+ */
+void _vectorI_set(
+	VectorIterator* vectorI, ///< "this" pointer.
+	void* data ///< Data to be assigned.
+);
+
+/**
+ * @brief Set the element at current index.
+ * @param vectorI "this" pointer.
+ * @param data Data to be assigned.
+ * 
+ * Usage: void vectorI_set(VectorIterator* vectorI, void data)
+ */
+#define vectorI_set(vectorI, data) \
+{ \
+	typeof((data)) tmp = data; \
+	_vectorI_set(vectorI,&tmp); \
+}
+
+/**
+ * @brief Move current iterator position forward (toward last index).
+ */
+void vectorI_move_next(
+	VectorIterator* vectorI ///< "this" pointer.
+);
+
+/**
+ * @brief Move current iterator position backward (toward first index).
+ */
+void vectorI_move_prev(
+	VectorIterator* vectorI ///< "this" pointer.
+);
+
+/**
+ * @brief Free memory allocated for the iterator.
+ */
+void vectorI_destroy(
+	VectorIterator* vectorI ///< "this" pointer.
+);
+
+#endif
diff --git a/src/cds.h b/src/cds.h
new file mode 100644
index 0000000..89e6e79
--- /dev/null
+++ b/src/cds.h
@@ -0,0 +1,13 @@
+#ifndef LIBCGDS_H
+#define LIBCGDS_H
+
+#include <cgds/BufferTop.h>
+#include <cgds/Heap.h>
+#include <cgds/List.h>
+#include <cgds/PriorityQueue.h>
+#include <cgds/Queue.h>
+#include <cgds/Stack.h>
+#include <cgds/Tree.h>
+#include <cgds/Vector.h>
+
+#endif
diff --git a/src/safe_alloc.c b/src/safe_alloc.c
new file mode 100644
index 0000000..9d1de7e
--- /dev/null
+++ b/src/safe_alloc.c
@@ -0,0 +1,44 @@
+/**
+ * @file safe_alloc.c
+ */
+
+#include "cgds/safe_alloc.h"
+
+void* safe_malloc(size_t size)
+{
+	void* res = malloc(size);
+	if (res == NULL)
+	{
+		fprintf(stderr, "Error: unable to allocate memory\n");
+		exit(EXIT_FAILURE);
+	}
+	return res;
+}
+
+void* safe_calloc(size_t count, size_t size)
+{
+	void* res = calloc(count, size);
+	if (res == NULL)
+	{
+		fprintf(stderr, "Error: unable to allocate memory\n");
+		exit(EXIT_FAILURE);
+	}
+	return res;
+}
+
+void* safe_realloc(void* ptr, size_t size)
+{
+	void* res = realloc(ptr, size);
+	if (res == NULL)
+	{
+		fprintf(stderr, "Error: unable to reallocate memory\n");
+		exit(EXIT_FAILURE);
+	}
+	return res;
+}
+
+void safe_free(void* ptr)
+{
+	if (ptr != NULL) 
+		free(ptr);
+}
diff --git a/src/safe_alloc.h b/src/safe_alloc.h
new file mode 100644
index 0000000..6771cc8
--- /dev/null
+++ b/src/safe_alloc.h
@@ -0,0 +1,45 @@
+/**
+ * @file safe_alloc.h
+ * @brief Safe memory management.
+ */
+
+#ifndef CGDS_SAFE_ALLOC_H
+#define CGDS_SAFE_ALLOC_H
+
+#include <stdlib.h>
+#include <stdio.h>
+
+/**
+ * @brief Wrapper around stdlib malloc function.
+ * @return A pointer to the newly allocated area; exit program if fail.
+ */
+void* safe_malloc(
+	size_t size ///< Size of the block to allocate, in bytes.
+);
+
+/**
+ * @brief Wrapper around stdlib calloc function.
+ * @return A pointer to the newly allocated area; exit program if fail.
+ */
+void* safe_calloc(
+	size_t count, ///< Number of elements to allocate.
+	size_t size ///< Size of the element to allocate, in bytes.
+);
+
+/**
+ * @brief Wrapper around stdlib realloc function.
+ * @return A pointer to the newly allocated area; exit program if fail.
+ */
+void* safe_realloc(
+	void* ptr, ///< Pointer on the area to be relocated.
+	size_t size ///< Size of the block to reallocate, in bytes.
+);
+
+/**
+ * @brief Wrapper around stdlib free function.
+ */
+void safe_free(
+	void* ptr ///< Pointer on the area to be destroyed.
+);
+
+#endif
diff --git a/src/types.h b/src/types.h
new file mode 100644
index 0000000..99b6d2c
--- /dev/null
+++ b/src/types.h
@@ -0,0 +1,51 @@
+/**
+ * @file types.h
+ * @brief A few useful data types.
+ */
+
+#ifndef CGDS_TYPES_H
+#define CGDS_TYPES_H
+
+#include <stdlib.h>
+#include <stdint.h>
+
+/**
+ * @brief Signed integer type.
+ */
+typedef int64_t Int;
+
+/**
+ * @brief Unsigned integer type.
+ */
+typedef uint64_t UInt;
+
+/**
+ * @brief Data type for a real number.
+ */
+typedef double Real;
+
+/**
+ * @brief Boolean type (prefixed with C_ to avoid some conflicts).
+ */
+typedef enum {
+	C_FALSE = 0, ///< False is mapped to 0
+	C_TRUE = 1 ///< True is mapped to 1
+} Bool;
+
+/**
+ * @brief Enumeration for the type of buffer or heap.
+ */
+typedef enum {
+	MIN_T = 0, ///< Minimum element first.
+	MAX_T = 1 ///< Maximum element first.
+} OrderType;
+
+/**
+ * @brief Generic item-value type; 'value' may correspond e.g. to distance.
+ */
+typedef struct ItemValue {
+	void* item; ///< Pointer to an item of any type.
+	Real value; ///< Value associated with the item.
+} ItemValue;
+
+#endif
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644
index 0000000..5d3fa11
--- /dev/null
+++ b/test/.gitignore
@@ -0,0 +1,2 @@
+obj/
+Makefile
diff --git a/test/Makefile.base b/test/Makefile.base
new file mode 100644
index 0000000..125781f
--- /dev/null
+++ b/test/Makefile.base
@@ -0,0 +1,13 @@
+CC = gcc
+CFLAGS = -g -std=gnu99
+LDFLAGS = -L../src/obj -lcgds
+INCLUDES = -I.. -I../src
+TARGET = testcgds
+
+all: obj/$(TARGET)
+
+clean:
+	rm -f obj/*.o
+	rm -f obj/$(TARGET)
+
+.PHONY: all clean
diff --git a/test/helpers.h b/test/helpers.h
new file mode 100644
index 0000000..49dec3b
--- /dev/null
+++ b/test/helpers.h
@@ -0,0 +1,15 @@
+#ifndef HELPERS_H
+#define HELPERS_H
+
+// types (POD) to be used as items inside our data structures
+typedef struct {
+    int a;
+    double b;
+} StructTest1;
+
+typedef struct {
+    float a;
+    StructTest1* b;
+} StructTest2;
+
+#endif
diff --git a/test/lut.h b/test/lut.h
new file mode 100644
index 0000000..75d21fb
--- /dev/null
+++ b/test/lut.h
@@ -0,0 +1,36 @@
+#define lu_assert_msg(expr, ...) \
+	if (!(expr)) { \
+		fprintf(stdout, "Failure in file %s at line %i\n", __FILE__, __LINE__); \
+		fprintf(stdout, ## __VA_ARGS__); \
+		return; \
+	}
+
+#define lu_assert(expr) \
+	lu_assert_msg(expr, "");
+
+/* OP may be any comparion operator. */
+
+#define _lu_assert_int(X, OP, Y) do { \
+	int _lu_x = (X); \
+	int _lu_y = (Y); \
+	lu_assert_msg(_lu_x OP _lu_y, "Assertion '"#X#OP#Y"' failed: "#X"==%i, "#Y"==%i\n", _lu_x, _lu_y); \
+} while (0)
+#define lu_assert_int_eq(X, Y) _lu_assert_int(X, ==, Y) 
+#define lu_assert_int_ne(X, Y) _lu_assert_int(X, !=, Y) 
+#define lu_assert_int_lt(X, Y) _lu_assert_int(X, <, Y)
+#define lu_assert_int_le(X, Y) _lu_assert_int(X, <=, Y)
+#define lu_assert_int_gt(X, Y) _lu_assert_int(X, >, Y)
+#define lu_assert_int_ge(X, Y) _lu_assert_int(X, >=, Y)
+
+#define _lu_assert_dbl(X, OP, Y) do { \
+	double _lu_x = (X); \
+	double _lu_y = (Y); \
+	lu_assert_msg(_lu_x OP _lu_y, "Assertion '"#X#OP#Y"' failed: "#X"==%g, "#Y"==%g", _lu_x, _lu_y); \
+} while (0)
+#define lu_assert_dbl_eq(X, Y) _lu_assert_dbl(X, ==, Y) 
+#define lu_assert_dbl_ne(X, Y) _lu_assert_dbl(X, !=, Y) 
+#define lu_assert_dbl_lt(X, Y) _lu_assert_dbl(X, <, Y)
+#define lu_assert_dbl_le(X, Y) _lu_assert_dbl(X, <=, Y)
+#define lu_assert_dbl_gt(X, Y) _lu_assert_dbl(X, >, Y)
+#define lu_assert_dbl_ge(X, Y) _lu_assert_dbl(X, >=, Y)
+
diff --git a/test/main.c b/test/main.c
new file mode 100644
index 0000000..7c08f3f
--- /dev/null
+++ b/test/main.c
@@ -0,0 +1,62 @@
+#include <stdlib.h>
+
+int main(int argc, char** argv)
+{
+	//file ./t.Stack.c :
+	t_stack_clear();
+	t_stack_size();
+	t_stack_push_pop_basic();
+	t_stack_push_pop_evolved();
+	t_stack_copy();
+
+	//file ./t.Heap.c :
+	t_heap_clear();
+	t_heap_size();
+	t_heap_push_pop_basic();
+	t_heap_push_pop_evolved();
+	t_heap_copy();
+
+	//file ./t.Tree.c :
+	t_tree_clear();
+	t_tree_size();
+	t_tree_add_remove();
+	t_tree_iterate();
+	t_tree_copy();
+
+	//file ./t.PriorityQueue.c :
+	t_priorityqueue_clear();
+	t_priorityqueue_size();
+	t_priorityqueue_push_pop_basic();
+	t_priorityqueue_push_pop_evolved();
+	t_priorityqueue_copy();
+
+	//file ./t.List.c :
+	t_list_clear();
+	t_list_size();
+	t_list_push_pop_basic();
+	t_list_push_pop_evolved();
+	t_list_copy();
+
+	//file ./t.Vector.c :
+	t_vector_clear();
+	t_vector_size();
+	t_vector_push_pop_basic();
+	t_vector_push_pop_evolved();
+	t_vector_copy();
+
+	//file ./t.Queue.c :
+	t_queue_clear();
+	t_queue_size();
+	t_queue_push_pop_basic();
+	t_queue_push_pop_evolved();
+	t_queue_copy();
+
+	//file ./t.BufferTop.c :
+	t_buffertop_clear();
+	t_buffertop_size();
+	t_buffertop_push_pop_basic();
+	t_buffertop_push_pop_evolved();
+	t_buffertop_copy();
+
+	return 0;
+}
diff --git a/test/makeMain.sh b/test/makeMain.sh
new file mode 100644
index 0000000..9583704
--- /dev/null
+++ b/test/makeMain.sh
@@ -0,0 +1,20 @@
+#/bin/bash
+#TODO: dispatch in several files and run in parallel ?!
+
+#initialize main.c
+printf '#include <stdlib.h>\n' > main.c
+printf '\n' >> main.c
+printf 'int main(int argc, char** argv)\n' >> main.c
+printf '{\n' >> main.c
+
+#add functions
+for file in `find . -type f -name \*.c ! -name main.c`; do
+	printf "\t//file $file :\n" >> main.c
+	functions=`grep "//FTEST" $file | sed 's/void \(.\+\) \/\/FTEST/\t\1;/g'`
+	printf "$functions" >> main.c
+	printf "\n\n" >> main.c
+done
+
+#finalize main.c
+printf "\treturn 0;\n" >> main.c
+printf '}\n' >> main.c
diff --git a/test/t.BufferTop.c b/test/t.BufferTop.c
new file mode 100644
index 0000000..f022d13
--- /dev/null
+++ b/test/t.BufferTop.c
@@ -0,0 +1,160 @@
+#include <stdlib.h>
+#include "cgds/BufferTop.h"
+#include "test/helpers.h"
+#include "test/lut.h"
+
+void t_buffertop_clear() //FTEST
+{
+	BufferTop* bt = buffertop_new(int, 10, MIN_T, 2);
+
+	// NOTE: items with same values are supported; 
+	// since it is unused in this test, we arbitrarily choose 0.0
+	buffertop_tryadd(bt, 0, 0.0);
+	buffertop_tryadd(bt, 0, 0.0);
+	buffertop_tryadd(bt, 0, 0.0);
+
+	buffertop_clear(bt);
+	lu_assert(buffertop_empty(bt));
+
+	buffertop_destroy(bt);
+}
+
+void t_buffertop_size() //FTEST
+{
+	BufferTop* bt = buffertop_new(double, 10, MAX_T, 3);
+
+	buffertop_tryadd(bt, 0.0, 0.0);
+	buffertop_tryadd(bt, 0.0, 0.0);
+	buffertop_tryadd(bt, 0.0, 0.0);
+	lu_assert_int_eq(buffertop_size(bt), 3);
+
+	buffertop_tryadd(bt, 0.0, 0.0);
+	buffertop_tryadd(bt, 0.0, 0.0);
+	lu_assert_int_eq(buffertop_size(bt), 5);
+
+	buffertop_tryadd(bt, 0.0, 0.0);
+	buffertop_tryadd(bt, 0.0, 0.0);
+	buffertop_tryadd(bt, 0.0, 0.0);
+	lu_assert_int_eq(buffertop_size(bt), 8);
+	buffertop_destroy(bt);
+
+	// Now try to add beyond capacity, with reorganizing
+	bt = buffertop_new(double, 3, MAX_T, 2);
+	buffertop_tryadd(bt, 0.0, 0.0);
+	buffertop_tryadd(bt, 0.0, 1.0);
+	buffertop_tryadd(bt, 0.0, 2.0);
+	buffertop_tryadd(bt, 0.0, 3.0);
+	buffertop_tryadd(bt, 0.0, 4.0);
+	buffertop_tryadd(bt, 0.0, 5.0);
+	buffertop_tryadd(bt, 0.0, 6.0);
+	buffertop_tryadd(bt, 0.0, 7.0);
+	lu_assert_int_eq(buffertop_size(bt), 3);
+
+	buffertop_clear(bt);
+	lu_assert(buffertop_empty(bt));
+	buffertop_destroy(bt);
+}
+
+void t_buffertop_push_pop_basic() //FTEST
+{
+	BufferTop* bt = buffertop_new(int, 5, MIN_T, 3);
+
+	buffertop_tryadd(bt, 1, 2.0);
+	buffertop_tryadd(bt, 2, 6.0);
+	buffertop_tryadd(bt, 3, 4.0);
+	buffertop_tryadd(bt, 4, 8.0);
+	buffertop_tryadd(bt, 5, 3.0);
+	buffertop_tryadd(bt, 6, 1.0);
+	buffertop_tryadd(bt, 7, 5.0);
+	buffertop_tryadd(bt, 8, 7.0);
+
+	int a;
+	buffertop_first(bt, a);
+	lu_assert_int_eq(a, 7); //7 -> 5.0
+	buffertop_pop(bt);
+	buffertop_first(bt, a);
+	lu_assert_int_eq(a, 3); //3 -> 4.0
+	buffertop_pop(bt);
+	buffertop_first(bt, a);
+	lu_assert_int_eq(a, 5); //5 -> 3.0
+	buffertop_pop(bt);
+	buffertop_first(bt, a);
+	lu_assert_int_eq(a, 1); //1 -> 2.0
+	buffertop_pop(bt);
+	buffertop_first(bt, a);
+	lu_assert_int_eq(a, 6); //6 has "highest" priority (1.0, MIN_T)
+	buffertop_pop(bt);
+
+	lu_assert(buffertop_empty(bt));
+	buffertop_destroy(bt);
+}
+
+void t_buffertop_push_pop_evolved() //FTEST
+{
+	int n = 10;
+
+	BufferTop* bt = buffertop_new(StructTest1, 5, MAX_T, 2);
+	StructTest1* st1 = (StructTest1*) safe_malloc(n * sizeof (StructTest1));
+	for (int i = n - 1; i >= 0; i--)
+	{
+		st1[i].a = i;
+		st1[i].b = (double) rand() / RAND_MAX;
+		buffertop_tryadd(bt, *(st1 + i), i); //item i has value i
+	}
+	for (int i = n - buffertop_size(bt); i < n; i++)
+	{
+		StructTest1 st1Cell;
+		buffertop_first(bt, st1Cell);
+		lu_assert_int_eq(st1Cell.a, i);
+		buffertop_pop(bt);
+	}
+	safe_free(st1);
+	buffertop_destroy(bt);
+
+	bt = buffertop_new(StructTest2*, 15, MAX_T, 4);
+	StructTest2* st2 = (StructTest2*) safe_malloc(n * sizeof (StructTest2));
+	for (int i = n - 1; i >= 0; i--)
+	{
+		st2[i].a = (float) rand() / RAND_MAX;
+		st2[i].b = (StructTest1*) safe_malloc(sizeof (StructTest1));
+		st2[i].b->a = i;
+		st2[i].b->b = (double) rand() / RAND_MAX;
+		// item i has value i+1 if i is even, i-1 if i is odd
+		// that is to say, values are 1 0 3 2 5 4 ...
+		buffertop_tryadd(bt, st2 + i, i % 2 == 0 ? i + 1 : i - 1);
+	}
+	for (int i = 0; i < n; i++)
+	{
+		StructTest2* st2Cell;
+		buffertop_first(bt, st2Cell);
+		// NOTE: i |--> i%2==0 ? i+1 : i-1 is an involution
+		lu_assert_int_eq(st2Cell->b->a, i % 2 == 0 ? i + 1 : i - 1);
+		buffertop_pop(bt);
+		safe_free(st2Cell->b);
+	}
+	safe_free(st2);
+	buffertop_destroy(bt);
+}
+
+void t_buffertop_copy() //FTEST
+{
+	int n = 10;
+
+	BufferTop* bt = buffertop_new(int, n, MIN_T, 3);
+	for (int i = 0; i < n; i++)
+		buffertop_tryadd(bt, rand() % 42, (double) rand() / RAND_MAX);
+	BufferTop* btc = buffertop_copy(bt);
+
+	lu_assert_int_eq(buffertop_size(bt), buffertop_size(btc));
+	int a, b;
+	for (int i = 0; i < n; i++)
+	{
+		buffertop_first(bt, a);
+		buffertop_first(btc, b);
+		lu_assert_int_eq(a, b);
+		buffertop_pop(bt);
+		buffertop_pop(btc);
+	}
+	buffertop_destroy(bt);
+	buffertop_destroy(btc);
+}
diff --git a/test/t.Heap.c b/test/t.Heap.c
new file mode 100644
index 0000000..41c0805
--- /dev/null
+++ b/test/t.Heap.c
@@ -0,0 +1,172 @@
+#include <stdlib.h>
+#include "cgds/Heap.h"
+#include "test/helpers.h"
+#include "test/lut.h"
+
+void t_heap_clear() //FTEST
+{
+	Heap* h = heap_new(int, MIN_T, 2);
+
+	// NOTE: items with same priorities are supported; 
+	// since it is unused in this test, we arbitrarily choose 0.0
+	heap_insert(h, 0, 0.0);
+	heap_insert(h, 0, 0.0);
+	heap_insert(h, 0, 0.0);
+
+	heap_clear(h);
+	lu_assert(heap_empty(h));
+
+	heap_destroy(h);
+}
+
+void t_heap_size() //FTEST
+{
+	Heap* h = heap_new(double, MAX_T, 3);
+
+	heap_insert(h, 0.0, 0.0);
+	heap_insert(h, 0.0, 0.0);
+	heap_insert(h, 0.0, 0.0);
+	lu_assert_int_eq(heap_size(h), 3);
+
+	heap_insert(h, 0.0, 0.0);
+	heap_insert(h, 0.0, 0.0);
+	lu_assert_int_eq(heap_size(h), 5);
+
+	heap_insert(h, 0.0, 0.0);
+	heap_insert(h, 0.0, 0.0);
+	heap_insert(h, 0.0, 0.0);
+	lu_assert_int_eq(heap_size(h), 8);
+
+	heap_destroy(h);
+}
+
+void t_heap_push_pop_basic() //FTEST
+{
+	Heap* h = heap_new(int, MIN_T, 3);
+
+	heap_insert(h, 1, 1.0);
+	heap_insert(h, 2, 3.0);
+	heap_insert(h, 3, 2.0);
+	heap_insert(h, 4, 4.0);
+	heap_insert(h, 5, 0.0);
+
+	int a;
+	heap_top(h, a);
+	lu_assert_int_eq(a, 5); //5 has "highest" priority (0.0, MIN_T)
+	heap_pop(h);
+	heap_top(h, a);
+	lu_assert_int_eq(a, 1); //1 -> 1.0
+	heap_pop(h);
+	heap_top(h, a);
+	lu_assert_int_eq(a, 3); //3 -> 2.0
+	heap_pop(h);
+	heap_top(h, a);
+	lu_assert_int_eq(a, 2); //2 -> 3.0
+	heap_pop(h);
+	heap_top(h, a);
+	lu_assert_int_eq(a, 4); //4 -> 4.0
+	heap_pop(h);
+	lu_assert(heap_empty(h));
+
+	h->hType = MAX_T; //HACK... (why not?)
+	heap_insert(h, 1, 1.0);
+	heap_insert(h, 2, 3.0);
+	heap_insert(h, 3, 2.0);
+	heap_insert(h, 4, 4.0);
+	heap_insert(h, 5, 7.0);
+	heap_insert(h, 6, 5.0);
+	heap_insert(h, 7, 6.0);
+	heap_remove(h, 4);
+	heap_remove(h, 2);
+	heap_modify(h, 3, 4.0);
+	heap_modify(h, 7, 3.0);
+
+	heap_top(h, a);
+	lu_assert_int_eq(a, 5); //5 has highest priority (7.0, MAX_T)
+	heap_pop(h);
+	heap_top(h, a);
+	lu_assert_int_eq(a, 6); //6 -> 5.0
+	heap_pop(h);
+	heap_top(h, a);
+	lu_assert_int_eq(a, 3); //3 -> 4.0
+	heap_pop(h);
+	heap_top(h, a);
+	lu_assert_int_eq(a, 7); //7 -> 3.0
+	heap_pop(h);
+	heap_top(h, a);
+	lu_assert_int_eq(a, 1); //1 -> 1.0
+	heap_pop(h);
+	lu_assert(heap_empty(h));
+
+	heap_destroy(h);
+}
+
+void t_heap_push_pop_evolved() //FTEST
+{
+	int n = 10;
+
+	Heap* h = heap_new(StructTest1, MAX_T, 2);
+	StructTest1* st1 = (StructTest1*) safe_malloc(n * sizeof (StructTest1));
+	for (int i = n - 1; i >= 0; i--)
+	{
+		st1[i].a = i;
+		st1[i].b = (double) rand() / RAND_MAX;
+		heap_insert(h, *(st1 + i), i); //item i has value i
+	}
+	for (int i = n - 1; i >= 0; i--)
+	{
+		StructTest1 st1Cell;
+		heap_top(h, st1Cell);
+		lu_assert_int_eq(st1Cell.a, i);
+		heap_pop(h);
+	}
+	safe_free(st1);
+	heap_destroy(h);
+
+	h = heap_new(StructTest2*, MAX_T, 4);
+	StructTest2* st2 = (StructTest2*) safe_malloc(n * sizeof (StructTest2));
+	for (int i = n - 1; i >= 0; i--)
+	{
+		st2[i].a = (float) rand() / RAND_MAX;
+		st2[i].b = (StructTest1*) safe_malloc(sizeof (StructTest1));
+		st2[i].b->a = i;
+		st2[i].b->b = (double) rand() / RAND_MAX;
+		// item i has value i+1 if i is even, i-1 if i is odd
+		// that is to say, values are 1 0 3 2 5 4 ...
+		heap_insert(h, st2 + i, i % 2 == 0 ? i + 1 : i - 1);
+	}
+	for (int i = n - 1; i >= 0; i--)
+	{
+		StructTest2* st2Cell;
+		heap_top(h, st2Cell);
+		// NOTE: i |--> i%2==0 ? i+1 : i-1 is an involution
+		lu_assert_int_eq(st2Cell->b->a, i % 2 == 0 ? i + 1 : i - 1);
+		heap_pop(h);
+		safe_free(st2Cell->b);
+	}
+	safe_free(st2);
+	heap_destroy(h);
+}
+
+void t_heap_copy() //FTEST
+{
+	int n = 10;
+
+	Heap* h = heap_new(int, MIN_T, 2);
+	for (int i = 0; i < n; i++)
+		heap_insert(h, rand() % 42, (double) rand() / RAND_MAX);
+	Heap* hc = heap_copy(h);
+
+	lu_assert_int_eq(heap_size(h), heap_size(hc));
+	int a, b;
+	for (int i = 0; i < n; i++)
+	{
+		heap_top(h, a);
+		heap_top(hc, b);
+		lu_assert_int_eq(a, b);
+		heap_pop(h);
+		heap_pop(hc);
+	}
+	heap_destroy(h);
+	heap_destroy(hc);
+}
diff --git a/test/t.List.c b/test/t.List.c
new file mode 100644
index 0000000..b5da4da
--- /dev/null
+++ b/test/t.List.c
@@ -0,0 +1,160 @@
+#include <stdlib.h>
+#include "cgds/List.h"
+#include "test/helpers.h"
+#include "test/lut.h"
+
+void t_list_clear() //FTEST
+{
+	List* L = list_new(int);
+
+	list_insert_front(L, 0);
+	list_insert_back(L, 0);
+	list_insert_after(L, L->head, 0);
+
+	list_clear(L);
+	lu_assert(list_empty(L));
+
+	list_destroy(L);
+}
+
+void t_list_size() //FTEST
+{
+	List* L = list_new(double);
+
+	list_insert_front(L, 0.0);
+	list_insert_back(L, 0.0);
+	list_insert_front(L, 0.0);
+	lu_assert_int_eq(list_size(L), 3);
+
+	list_insert_back(L, 0.0);
+	list_insert_before(L, L->tail, 0.0);
+	lu_assert_int_eq(list_size(L), 5);
+
+	list_insert_after(L, L->head->next, 0.0);
+	list_insert_before(L, L->tail->prev, 0.0);
+	list_insert_after(L, L->head, 0.0);
+	lu_assert_int_eq(list_size(L), 8);
+
+	list_set(L, L->head->next, 42);
+	list_remove_front(L);
+	int a;
+	list_get(L->head, a);
+	lu_assert_int_eq(a, 42);
+	list_remove(L, L->head->next);
+	lu_assert_int_eq(list_size(L), 6);
+	list_set(L, L->tail, 32);
+	list_remove(L, L->tail->prev);
+	list_get(L->tail, a);
+	lu_assert_int_eq(a, 32);
+	lu_assert_int_eq(list_size(L), 5);
+
+	list_destroy(L);
+}
+
+void t_list_push_pop_basic() //FTEST
+{
+	int n = 10;
+
+	List* L = list_new(double);
+	for (int i = 0; i < n; i++) list_insert_back(L, (double) i);
+	// iterate and check values
+	ListIterator* li = list_get_iterator(L);
+	double ckValue = 0.0;
+	while (listI_has_data(li))
+	{
+		double d;
+		listI_get(li, d);
+		lu_assert_dbl_eq(d, ckValue);
+		ckValue += 1.0;
+		listI_move_next(li);
+	}
+
+	// same, from end to beginning
+	ckValue = n - 1;
+	listI_reset_tail(li);
+	while (listI_has_data(li))
+	{
+		double d;
+		listI_get(li, d);
+		lu_assert_dbl_eq(d, ckValue);
+		ckValue -= 1.0;
+		listI_move_prev(li);
+	}
+	list_destroy(L);
+	listI_destroy(li);
+}
+
+void t_list_push_pop_evolved() //FTEST
+{
+	int n = 10;
+
+	List* L = list_new(StructTest1);
+	StructTest1* st1 = (StructTest1*) malloc(n * sizeof (StructTest1));
+	for (int i = 0; i < n; i++)
+	{
+		st1[i].a = rand() % 42;
+		st1[i].b = (double) rand() / RAND_MAX;
+		list_insert_back(L, *(st1 + i));
+	}
+	ListCell* lc = L->head;
+	for (int i = 0; i < n; i++)
+	{
+		//another way to access elements
+		StructTest1 st1Cell;
+		list_get(lc, st1Cell);
+		lu_assert_int_eq(st1Cell.a, st1[i].a);
+		lu_assert_dbl_eq(st1Cell.b, st1[i].b);
+		lc = lc->next;
+	}
+	safe_free(st1);
+	list_destroy(L);
+
+	L = list_new(StructTest2*);
+	StructTest2* st2 = (StructTest2*) malloc(n * sizeof (StructTest2));
+	for (int i = 0; i < n; i++)
+	{
+		st2[i].a = (float) rand() / RAND_MAX;
+		st2[i].b = (StructTest1*) malloc(sizeof (StructTest1));
+		st2[i].b->a = rand() % 42;
+		st2[i].b->b = (double) rand() / RAND_MAX;
+		list_insert_back(L, st2 + i);
+	}
+	lc = L->head;
+	for (int i = 0; i < n; i++)
+	{
+		StructTest2* st2Cell;
+		list_get(lc, st2Cell);
+		lu_assert_dbl_eq(st2Cell->a, st2[i].a);
+		lu_assert_int_eq(st2Cell->b->a, st2[i].b->a);
+		lu_assert_dbl_eq(st2Cell->b->b, st2[i].b->b);
+		safe_free(st2Cell->b);
+		lc = lc->next;
+	}
+	safe_free(st2);
+	list_destroy(L);
+}
+
+void t_list_copy() //FTEST
+{
+	int n = 10;
+
+	List* L = list_new(int);
+	for (int i = 0; i < n; i++)
+		list_insert_front(L, rand() % 42);
+	List* Lc = list_copy(L);
+
+	lu_assert_int_eq(L->size, Lc->size);
+	ListCell* lCell = L->head;
+	ListCell* lcCell = Lc->head;
+	int a, b;
+	for (int i = 0; i < n; i++)
+	{
+		list_get(lCell, a);
+		list_get(lcCell, b);
+		lu_assert_int_eq(a, b);
+		lCell = lCell->next;
+		lcCell = lcCell->next;
+	}
+	list_destroy(L);
+	list_destroy(Lc);
+}
diff --git a/test/t.PriorityQueue.c b/test/t.PriorityQueue.c
new file mode 100644
index 0000000..e4f2a75
--- /dev/null
+++ b/test/t.PriorityQueue.c
@@ -0,0 +1,172 @@
+#include <stdlib.h>
+#include "cgds/PriorityQueue.h"
+#include "test/helpers.h"
+#include "test/lut.h"
+
+void t_priorityqueue_clear() //FTEST
+{
+	PriorityQueue* pq = priorityqueue_new(int, MIN_T, 2);
+
+	// NOTE: items with same priorities are supported; 
+	// since it is unused in this test, we arbitrarily choose 0.0
+	priorityqueue_insert(pq, 0, 0.0);
+	priorityqueue_insert(pq, 0, 0.0);
+	priorityqueue_insert(pq, 0, 0.0);
+
+	priorityqueue_clear(pq);
+	lu_assert(priorityqueue_empty(pq));
+
+	priorityqueue_destroy(pq);
+}
+
+void t_priorityqueue_size() //FTEST
+{
+	PriorityQueue* pq = priorityqueue_new(double, MAX_T, 3);
+
+	priorityqueue_insert(pq, 0.0, 0.0);
+	priorityqueue_insert(pq, 0.0, 0.0);
+	priorityqueue_insert(pq, 0.0, 0.0);
+	lu_assert_int_eq(priorityqueue_size(pq), 3);
+
+	priorityqueue_insert(pq, 0.0, 0.0);
+	priorityqueue_insert(pq, 0.0, 0.0);
+	lu_assert_int_eq(priorityqueue_size(pq), 5);
+
+	priorityqueue_insert(pq, 0.0, 0.0);
+	priorityqueue_insert(pq, 0.0, 0.0);
+	priorityqueue_insert(pq, 0.0, 0.0);
+	lu_assert_int_eq(priorityqueue_size(pq), 8);
+
+	priorityqueue_destroy(pq);
+}
+
+void t_priorityqueue_push_pop_basic() //FTEST
+{
+	PriorityQueue* pq = priorityqueue_new(int, MIN_T, 3);
+
+	priorityqueue_insert(pq, 1, 1.0);
+	priorityqueue_insert(pq, 2, 3.0);
+	priorityqueue_insert(pq, 3, 2.0);
+	priorityqueue_insert(pq, 4, 4.0);
+	priorityqueue_insert(pq, 5, 0.0);
+
+	int a;
+	priorityqueue_peek(pq, a);
+	lu_assert_int_eq(a, 5); //5 has "highest" priority (0.0, MIN_T)
+	priorityqueue_pop(pq);
+	priorityqueue_peek(pq, a);
+	lu_assert_int_eq(a, 1); //1 -> 1.0
+	priorityqueue_pop(pq);
+	priorityqueue_peek(pq, a);
+	lu_assert_int_eq(a, 3); //3 -> 2.0
+	priorityqueue_pop(pq);
+	priorityqueue_peek(pq, a);
+	lu_assert_int_eq(a, 2); //2 -> 3.0
+	priorityqueue_pop(pq);
+	priorityqueue_peek(pq, a);
+	lu_assert_int_eq(a, 4); //4 -> 4.0
+	priorityqueue_pop(pq);
+	lu_assert(priorityqueue_empty(pq));
+
+	pq->heap->hType = MAX_T; //HACK... (why not?)
+	priorityqueue_insert(pq, 1, 1.0);
+	priorityqueue_insert(pq, 2, 3.0);
+	priorityqueue_insert(pq, 3, 2.0);
+	priorityqueue_insert(pq, 4, 4.0);
+	priorityqueue_insert(pq, 5, 0.0);
+	priorityqueue_insert(pq, 6, 0.0);
+	priorityqueue_insert(pq, 7, 6.0);
+	priorityqueue_remove(pq, 6);
+	priorityqueue_remove(pq, 7);
+	priorityqueue_set(pq, 3, 5.0);
+	priorityqueue_set(pq, 5, 2.0);
+
+	priorityqueue_peek(pq, a);
+	lu_assert_int_eq(a, 3); //3 has highest priority (5.0, MAX_T)
+	priorityqueue_pop(pq);
+	priorityqueue_peek(pq, a);
+	lu_assert_int_eq(a, 4); //4 -> 4.0
+	priorityqueue_pop(pq);
+	priorityqueue_peek(pq, a);
+	lu_assert_int_eq(a, 2); //2 -> 3.0
+	priorityqueue_pop(pq);
+	priorityqueue_peek(pq, a);
+	lu_assert_int_eq(a, 5); //5 -> 2.0
+	priorityqueue_pop(pq);
+	priorityqueue_peek(pq, a);
+	lu_assert_int_eq(a, 1); // 1 -> 1.0
+	priorityqueue_pop(pq);
+
+	lu_assert(priorityqueue_empty(pq));
+	priorityqueue_destroy(pq);
+}
+
+void t_priorityqueue_push_pop_evolved() //FTEST
+{
+	int n = 10;
+
+	PriorityQueue* pq = priorityqueue_new(StructTest1, MAX_T, 2);
+	StructTest1* st1 = (StructTest1*) safe_malloc(n * sizeof (StructTest1));
+	for (int i = n - 1; i >= 0; i--)
+	{
+		st1[i].a = i;
+		st1[i].b = (double) rand() / RAND_MAX;
+		priorityqueue_insert(pq, *(st1 + i), i); //item i has priority i
+	}
+	for (int i = n - 1; i >= 0; i--)
+	{
+		StructTest1 st1Cell;
+		priorityqueue_peek(pq, st1Cell);
+		lu_assert_int_eq(st1Cell.a, i);
+		priorityqueue_pop(pq);
+	}
+	safe_free(st1);
+	priorityqueue_destroy(pq);
+
+	pq = priorityqueue_new(StructTest2*, MAX_T, 4);
+	StructTest2* st2 = (StructTest2*) safe_malloc(n * sizeof (StructTest2));
+	for (int i = n - 1; i >= 0; i--)
+	{
+		st2[i].a = (float) rand() / RAND_MAX;
+		st2[i].b = (StructTest1*) safe_malloc(sizeof (StructTest1));
+		st2[i].b->a = i;
+		st2[i].b->b = (double) rand() / RAND_MAX;
+		// item i has priority i+1 if i is even, i-1 if i is odd
+		// that is to say, priorities are 1 0 3 2 5 4 ...
+		priorityqueue_insert(pq, st2 + i, i % 2 == 0 ? i + 1 : i - 1);
+	}
+	for (int i = n - 1; i >= 0; i--)
+	{
+		StructTest2* st2Cell;
+		priorityqueue_peek(pq, st2Cell);
+		// NOTE: i |--> i%2==0 ? i+1 : i-1 is an involution
+		lu_assert_int_eq(st2Cell->b->a, i % 2 == 0 ? i + 1 : i - 1);
+		priorityqueue_pop(pq);
+		safe_free(st2Cell->b);
+	}
+	safe_free(st2);
+	priorityqueue_destroy(pq);
+}
+
+void t_priorityqueue_copy() //FTEST
+{
+	int n = 10;
+
+	PriorityQueue* pq = priorityqueue_new(int, MIN_T, 3);
+	for (int i = 0; i < n; i++)
+		priorityqueue_insert(pq, rand() % 42, (double) rand() / RAND_MAX);
+	PriorityQueue* pqc = priorityqueue_copy(pq);
+
+	lu_assert_int_eq(priorityqueue_size(pq), priorityqueue_size(pqc));
+	int a, b;
+	for (int i = 0; i < n; i++)
+	{
+		priorityqueue_peek(pq, a);
+		priorityqueue_peek(pqc, b);
+		lu_assert_int_eq(a, b);
+		priorityqueue_pop(pq);
+		priorityqueue_pop(pqc);
+	}
+	priorityqueue_destroy(pq);
+	priorityqueue_destroy(pqc);
+}
diff --git a/test/t.Queue.c b/test/t.Queue.c
new file mode 100644
index 0000000..6141dd0
--- /dev/null
+++ b/test/t.Queue.c
@@ -0,0 +1,130 @@
+#include <stdlib.h>
+#include "cgds/Queue.h"
+#include "test/helpers.h"
+#include "test/lut.h"
+
+void t_queue_clear() //FTEST
+{
+	Queue* q = queue_new(int);
+
+	queue_push(q, 0);
+	queue_push(q, 0);
+	queue_push(q, 0);
+
+	queue_clear(q);
+	lu_assert(queue_empty(q));
+
+	queue_destroy(q);
+}
+
+void t_queue_size() //FTEST
+{
+	Queue* q = queue_new(int);
+
+	queue_push(q, 0);
+	queue_push(q, 0);
+	queue_push(q, 0);
+	lu_assert_int_eq(queue_size(q), 3);
+
+	queue_push(q, 0);
+	queue_push(q, 0);
+	lu_assert_int_eq(queue_size(q), 5);
+
+	queue_push(q, 0);
+	queue_push(q, 0);
+	queue_push(q, 0);
+	lu_assert_int_eq(queue_size(q), 8);
+
+	queue_destroy(q);
+}
+
+void t_queue_push_pop_basic() //FTEST
+{
+	int n = 10;
+
+	Queue* q = queue_new(double);
+	for (int i = 0; i < n; i++) queue_push(q, (double) i);
+	// iterate and check values
+	double ckValue = 0.0;
+	while (!queue_empty(q))
+	{
+		double d;
+		queue_peek(q, d);
+		lu_assert_dbl_eq(d, ckValue);
+		ckValue += 1.0;
+		queue_pop(q);
+	}
+
+	lu_assert(queue_empty(q));
+	queue_destroy(q);
+}
+
+void t_queue_push_pop_evolved() //FTEST
+{
+	int n = 10;
+
+	Queue* q = queue_new(StructTest1);
+	StructTest1* st1 = (StructTest1*) safe_malloc(n * sizeof (StructTest1));
+	for (int i = 0; i < n; i++)
+	{
+		st1[i].a = rand() % 42;
+		st1[i].b = (double) rand() / RAND_MAX;
+		queue_push(q, *(st1 + i));
+	}
+	for (int i = 0; i < n; i++)
+	{
+		StructTest1 st1Cell;
+		queue_peek(q, st1Cell);
+		lu_assert_int_eq(st1Cell.a, st1[i].a);
+		lu_assert_dbl_eq(st1Cell.b, st1[i].b);
+		queue_pop(q);
+	}
+	safe_free(st1);
+	queue_destroy(q);
+
+	q = queue_new(StructTest2*);
+	StructTest2* st2 = (StructTest2*) safe_malloc(n * sizeof (StructTest2));
+	for (int i = 0; i < n; i++)
+	{
+		st2[i].a = (float) rand() / RAND_MAX;
+		st2[i].b = (StructTest1*) safe_malloc(sizeof (StructTest1));
+		st2[i].b->a = rand() % 42;
+		st2[i].b->b = (double) rand() / RAND_MAX;
+		queue_push(q, st2 + i);
+	}
+	for (int i = 0; i < n; i++)
+	{
+		StructTest2* st2Cell;
+		queue_peek(q, st2Cell);
+		lu_assert_dbl_eq(st2Cell->a, st2[i].a);
+		lu_assert_int_eq(st2Cell->b->a, st2[i].b->a);
+		lu_assert_dbl_eq(st2Cell->b->b, st2[i].b->b);
+		queue_pop(q);
+		safe_free(st2Cell->b);
+	}
+	safe_free(st2);
+	queue_destroy(q);
+}
+
+void t_queue_copy() //FTEST
+{
+	int n = 10;
+
+	Queue* q = queue_new(int);
+	for (int i = 0; i < n; i++)
+		queue_push(q, rand() % 42);
+	Queue* qc = queue_copy(q);
+
+	lu_assert_int_eq(q->size, qc->size);
+	int a, b;
+	for (int i = 0; i < n; i++)
+	{
+		queue_peek(q, a);
+		queue_peek(qc, b);
+		lu_assert_int_eq(a, b);
+		queue_pop(q);
+		queue_pop(qc);
+	}
+	queue_destroy(q);
+	queue_destroy(qc);
+}
diff --git a/test/t.Stack.c b/test/t.Stack.c
new file mode 100644
index 0000000..364c344
--- /dev/null
+++ b/test/t.Stack.c
@@ -0,0 +1,131 @@
+#include <stdlib.h>
+#include "cgds/Stack.h"
+#include "test/helpers.h"
+#include "test/lut.h"
+
+void t_stack_clear() //FTEST
+{
+	Stack* s = stack_new(int);
+
+	stack_push(s, 0);
+	stack_push(s, 0);
+	stack_push(s, 0);
+
+	stack_clear(s);
+	lu_assert(stack_empty(s));
+
+	stack_destroy(s);
+}
+
+void t_stack_size() //FTEST
+{
+	Stack* s = stack_new(int);
+
+	stack_push(s, 0);
+	stack_push(s, 0);
+	stack_push(s, 0);
+	lu_assert_int_eq(stack_size(s), 3);
+
+	stack_push(s, 0);
+	stack_push(s, 0);
+	lu_assert_int_eq(stack_size(s), 5);
+
+	stack_push(s, 0);
+	stack_push(s, 0);
+	stack_push(s, 0);
+	lu_assert_int_eq(stack_size(s), 8);
+
+	stack_destroy(s);
+}
+
+void t_stack_push_pop_basic() //FTEST
+{
+
+	int n = 10;
+
+	Stack* s = stack_new(double);
+	for (int i = 0; i < n; i++) stack_push(s, (double) i);
+	// iterate and check values
+	double ckValue = n - 1;
+	while (!stack_empty(s))
+	{
+		double d;
+		stack_top(s, d);
+		lu_assert_dbl_eq(d, ckValue);
+		ckValue -= 1.0;
+		stack_pop(s);
+	}
+
+	lu_assert(stack_empty(s));
+	stack_destroy(s);
+}
+
+void t_stack_push_pop_evolved() //FTEST
+{
+	Stack* s = stack_new(StructTest1);
+
+	int n = 10;
+	StructTest1* st1 = (StructTest1*) malloc(n * sizeof (StructTest1));
+	for (int i = n - 1; i >= 0; i--)
+	{
+		st1[i].a = rand() % 42;
+		st1[i].b = (double) rand() / RAND_MAX;
+		stack_push(s, *(st1 + i));
+	}
+	for (int i = 0; i < n; i++)
+	{
+		StructTest1 st1Cell;
+		stack_top(s, st1Cell);
+		lu_assert_int_eq(st1Cell.a, st1[i].a);
+		lu_assert_dbl_eq(st1Cell.b, st1[i].b);
+		stack_pop(s);
+	}
+	safe_free(st1);
+	stack_destroy(s);
+
+	s = stack_new(StructTest2*);
+	StructTest2* st2 = (StructTest2*) malloc(n * sizeof (StructTest2));
+	for (int i = n - 1; i >= 0; i--)
+	{
+		st2[i].a = (float) rand() / RAND_MAX;
+		st2[i].b = (StructTest1*) malloc(sizeof (StructTest1));
+		st2[i].b->a = rand() % 42;
+		st2[i].b->b = (double) rand() / RAND_MAX;
+		stack_push(s, st2 + i);
+	}
+	for (int i = 0; i < n; i++)
+	{
+		StructTest2* st2Cell;
+		stack_top(s, st2Cell);
+		lu_assert_dbl_eq(st2Cell->a, st2[i].a);
+		lu_assert_int_eq(st2Cell->b->a, st2[i].b->a);
+		lu_assert_dbl_eq(st2Cell->b->b, st2[i].b->b);
+		stack_pop(s);
+		safe_free(st2Cell->b);
+	}
+	safe_free(st2);
+	stack_destroy(s);
+}
+
+void t_stack_copy() //FTEST
+{
+	int n = 10;
+
+	Stack* s = stack_new(int);
+	for (int i = 0; i < n; i++)
+		stack_push(s, rand() % 42);
+	Stack* sc = stack_copy(s);
+
+	lu_assert_int_eq(s->size, sc->size);
+	int a, b;
+	for (int i = 0; i < n; i++)
+	{
+		stack_top(s, a);
+		stack_top(sc, b);
+		lu_assert_int_eq(a, b);
+		stack_pop(s);
+		stack_pop(sc);
+	}
+	stack_destroy(s);
+	stack_destroy(sc);
+}
diff --git a/test/t.Tree.c b/test/t.Tree.c
new file mode 100644
index 0000000..481508a
--- /dev/null
+++ b/test/t.Tree.c
@@ -0,0 +1,140 @@
+#include <stdlib.h>
+#include "cgds/Tree.h"
+#include "test/helpers.h"
+#include "test/lut.h"
+
+void t_tree_clear() //FTEST
+{
+	Tree* t = tree_new(int);
+
+	tree_set_root(t, 0);
+	tree_add_child(t, t->root, 1);
+	tree_add_child(t, t->root, 2);
+	tree_add_child(t, t->root, 3);
+	tree_add_child(t, t->root->firstChild, 1);
+	tree_add_child(t, t->root->firstChild, 2);
+	tree_add_child(t, t->root->firstChild->next, 1);
+	tree_add_child(t, t->root->firstChild->next, 2);
+	tree_add_child(t, t->root->firstChild->next, 3);
+	tree_add_child(t, t->root->firstChild->next, 4);
+
+	tree_clear(t);
+	lu_assert(tree_empty(t));
+
+	tree_destroy(t);
+}
+
+void t_tree_size() //FTEST
+{
+	Tree* t = tree_new(int);
+
+	tree_set_root(t, 0);
+	tree_add_child(t, t->root, 1);
+	tree_add_child(t, t->root, 2);
+	tree_add_child(t, t->root, 3);
+	lu_assert_int_eq(tree_size(t), 4);
+
+	tree_add_child(t, t->root->firstChild, 1);
+	tree_add_child(t, t->root->firstChild, 2);
+	lu_assert_int_eq(tree_size(t), 6);
+
+	tree_add_child(t, t->root->firstChild->next, 1);
+	tree_add_child(t, t->root->firstChild->next, 2);
+	tree_add_child(t, t->root->firstChild->next, 3);
+	tree_add_child(t, t->root->firstChild->next, 4);
+	lu_assert_int_eq(tree_size(t), 10);
+
+	tree_destroy(t);
+}
+
+void t_tree_add_remove() //FTEST
+{
+	Tree* t = tree_new(int);
+
+	tree_set_root(t, 0);
+	tree_add_child(t, t->root, 1);
+	tree_add_child(t, t->root, 2);
+	tree_add_child(t, t->root, 3);
+	tree_add_child(t, t->root->firstChild, 1);
+	tree_add_child(t, t->root->firstChild, 2);
+	tree_add_child(t, t->root->firstChild->next, 1);
+	tree_add_child(t, t->root->firstChild->next, 2);
+	tree_add_child(t, t->root->firstChild->next, 3);
+	tree_add_child(t, t->root->firstChild->next, 4);
+	tree_add_child(t, t->root->lastChild, 1);
+	tree_add_child(t, t->root->lastChild, 2);
+	tree_add_child(t, t->root->lastChild, 3);
+	lu_assert_int_eq(tree_size(t), 13);
+
+	tree_remove(t, t->root->lastChild);
+	lu_assert_int_eq(tree_size(t), 9);
+	tree_rm_childs(t, t->root->firstChild);
+	lu_assert_int_eq(tree_size(t), 7);
+
+	tree_destroy(t);
+}
+
+void t_tree_iterate() //FTEST
+{
+	Tree* t = tree_new(int);
+
+	tree_set_root(t, 0);
+	tree_add_child(t, t->root, 1);
+	tree_add_child(t, t->root, 2);
+	tree_add_child(t, t->root, 3);
+	tree_add_child(t, t->root->firstChild, 4);
+	tree_add_child(t, t->root->firstChild, 5);
+	tree_add_child(t, t->root->firstChild->next, 6);
+	tree_add_child(t, t->root->firstChild->next, 7);
+	tree_add_child(t, t->root->firstChild->next, 8);
+	tree_add_child(t, t->root->firstChild->next, 9);
+
+	TreeIterator* ti = tree_get_iterator(t, IN_BREADTH);
+	int a;
+	for (int i = 0; i < 10; i++)
+	{
+		lu_assert(treeI_has_data(ti));
+		treeI_get(ti, a);
+		lu_assert_int_eq(a, i);
+		treeI_move_next(ti);
+	}
+
+	treeI_destroy(ti);
+	tree_destroy(t);
+}
+
+void t_tree_copy() //FTEST
+{
+	Tree* t = tree_new(int);
+
+	tree_set_root(t, 0);
+	tree_add_child(t, t->root, 1);
+	tree_add_child(t, t->root, 2);
+	tree_add_child(t, t->root, 3);
+	tree_add_child(t, t->root->firstChild, 1);
+	tree_add_child(t, t->root->firstChild, 2);
+	tree_add_child(t, t->root->firstChild->next, 1);
+	tree_add_child(t, t->root->firstChild->next, 2);
+	tree_add_child(t, t->root->firstChild->next, 3);
+	tree_add_child(t, t->root->firstChild->next, 4);
+
+	Tree* tc = tree_copy(t);
+	lu_assert_int_eq(t->size, tc->size);
+
+	TreeIterator* ti = tree_get_iterator(t, IN_DEPTH);
+	TreeIterator* tci = tree_get_iterator(tc, IN_DEPTH);
+	int a, b;
+	while (treeI_has_data(ti))
+	{
+		treeI_get(ti, a);
+		treeI_get(tci, b);
+		lu_assert_int_eq(a, b);
+		treeI_move_next(ti);
+		treeI_move_next(tci);
+	}
+	treeI_destroy(ti);
+	treeI_destroy(tci);
+
+	tree_destroy(t);
+	tree_destroy(tc);
+}
diff --git a/test/t.Vector.c b/test/t.Vector.c
new file mode 100644
index 0000000..aa88c3a
--- /dev/null
+++ b/test/t.Vector.c
@@ -0,0 +1,148 @@
+#include <stdlib.h>
+#include "cgds/Vector.h"
+#include "test/helpers.h"
+#include "test/lut.h"
+
+void t_vector_clear() //FTEST
+{
+	Vector* v = vector_new(int);
+	lu_assert(vector_empty(v));
+
+	vector_push(v, 0);
+	vector_push(v, 0);
+	vector_push(v, 0);
+
+	vector_destroy(v);
+	v = vector_new(int);
+
+	vector_push(v, 0);
+	vector_push(v, 0);
+	vector_push(v, 0);
+
+	vector_clear(v);
+	lu_assert(vector_empty(v));
+
+	vector_destroy(v);
+}
+
+void t_vector_size() //FTEST
+{
+	Vector* v = vector_new(int);
+	lu_assert(vector_empty(v));
+
+	vector_push(v, 0);
+	vector_push(v, 0);
+	vector_push(v, 0);
+	lu_assert_int_eq(vector_size(v), 3);
+
+	vector_push(v, 0);
+	vector_push(v, 0);
+	lu_assert_int_eq(vector_size(v), 5);
+
+	vector_push(v, 0);
+	vector_push(v, 0);
+	vector_push(v, 0);
+	lu_assert_int_eq(vector_size(v), 8);
+
+	vector_destroy(v);
+}
+
+void t_vector_push_pop_basic() //FTEST
+{
+	int n = 10;
+
+	Vector* v = vector_new(double);
+	for (int i = 0; i < n; i++) vector_push(v, (double) i);
+	// iterate and check values
+	VectorIterator* vi = vector_get_iterator(v);
+	double ckValue = 0.0;
+	while (vectorI_has_data(vi))
+	{
+		double d;
+		vectorI_get(vi, d);
+		lu_assert_dbl_eq(d, ckValue);
+		ckValue += 1.0;
+		vectorI_move_next(vi);
+	}
+
+	// same, from end to beginning
+	ckValue = n - 1;
+	vectorI_reset_end(vi);
+	while (vectorI_has_data(vi))
+	{
+		double d;
+		vectorI_get(vi, d);
+		lu_assert_dbl_eq(d, ckValue);
+		ckValue -= 1.0;
+		vectorI_move_prev(vi);
+	}
+	vector_destroy(v);
+	vectorI_destroy(vi);
+}
+
+void t_vector_push_pop_evolved() //FTEST
+{
+	int n = 10;
+
+	Vector* v = vector_new(StructTest1);
+	StructTest1* st1 = (StructTest1*) malloc(n * sizeof (StructTest1));
+	for (int i = 0; i < n; i++)
+	{
+		st1[i].a = rand() % 42;
+		st1[i].b = (double) rand() / RAND_MAX;
+		vector_push(v, *(st1 + i));
+	}
+	for (int i = 0; i < n; i++)
+	{
+		//another way to access elements
+		StructTest1 st1Cell;
+		vector_get(v, i, st1Cell);
+		lu_assert_int_eq(st1Cell.a, st1[i].a);
+		lu_assert_dbl_eq(st1Cell.b, st1[i].b);
+	}
+	safe_free(st1);
+	vector_destroy(v);
+
+	v = vector_new(StructTest2*);
+	StructTest2* st2 = (StructTest2*) malloc(n * sizeof (StructTest2));
+	for (int i = 0; i < n; i++)
+	{
+		st2[i].a = (float) rand() / RAND_MAX;
+		st2[i].b = (StructTest1*) malloc(sizeof (StructTest1));
+		st2[i].b->a = rand() % 42;
+		st2[i].b->b = (double) rand() / RAND_MAX;
+		vector_push(v, st2 + i);
+	}
+	for (int i = 0; i < n; i++)
+	{
+		StructTest2* st2Cell;
+		vector_get(v, i, st2Cell);
+		lu_assert_dbl_eq(st2Cell->a, st2[i].a);
+		lu_assert_int_eq(st2Cell->b->a, st2[i].b->a);
+		lu_assert_dbl_eq(st2Cell->b->b, st2[i].b->b);
+		safe_free(st2Cell->b);
+	}
+	safe_free(st2);
+	vector_destroy(v);
+}
+
+void t_vector_copy() //FTEST
+{
+	int n = 10;
+
+	Vector* v = vector_new(int);
+	for (int i = 0; i < n; i++)
+		vector_push(v, rand() % 42);
+	Vector* vc = vector_copy(v);
+
+	lu_assert_int_eq(v->size, vc->size);
+	int a, b;
+	for (int i = 0; i < n; i++)
+	{
+		vector_get(v, i, a);
+		vector_get(vc, i, b);
+		lu_assert_int_eq(a, b);
+	}
+	vector_destroy(v);
+	vector_destroy(vc);
+}
-- 
2.44.0