Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
June 2007
- 4 participants
- 12 discussions
milena 990: Clean up Doxygen's configuration and add support for Vcs.
by Roland Levillain 29 Jun '07
by Roland Levillain 29 Jun '07
29 Jun '07
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Clean up Doxygen's configuration and add support for Vcs.
* doc/Doxyfile.in: Wrap long lines.
(INPUT_ENCODING): Set to ISO-8859-1.
* test/: Rename as...
* tests/: ...this.
* vcs/milena.rb: New file.
doc/Doxyfile.in | 119 ++++++++++++++++++++++++++++++--------------------------
vcs/milena.rb | 8 +--
2 files changed, 68 insertions(+), 59 deletions(-)
Index: vcs/milena.rb
--- vcs/milena.rb (revision 0)
+++ vcs/milena.rb (working copy)
@@ -5,12 +5,12 @@
protocol_version '0.1'
- def olena_commit! ( *args )
- common_commit!("990: <%= title %>", *args) do |subject|
+ def milena_commit! ( *args )
+ common_commit!("milena 990: <%= title %>", *args) do |subject|
mail!(:to => %w[olena-patches(a)lrde.epita.fr], :subject => subject)
end
end
- alias_command :olnci, :olena_commit
- default_commit :olena_commit
+ alias_command :mlnci, :milena_commit
+ default_commit :milena_commit
end # class Vcs
Index: doc/Doxyfile.in
--- doc/Doxyfile.in (revision 989)
+++ doc/Doxyfile.in (working copy)
@@ -14,11 +14,12 @@
# 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.
+# 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
@@ -68,10 +69,11 @@
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.
+# 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
@@ -187,19 +189,20 @@
OPTIMIZE_OUTPUT_FOR_C = NO
-# 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.
+# 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
-# 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 make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
+# 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 make the inheritance and collaboration diagrams that involve
+# STL classes more complete and accurate.
BUILTIN_STL_SUPPORT = YES
@@ -387,19 +390,20 @@
SHOW_USED_FILES = YES
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
+# If the sources in your project are distributed over multiple
+# directories then setting the SHOW_DIRECTORIES tag to YES will show
+# the directory hierarchy in the documentation. The default is NO.
SHOW_DIRECTORIES = 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.
+# 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 =
@@ -458,20 +462,22 @@
# 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.
+# 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 = @top_srcdir@/milena \
@top_builddir@/milena
-# 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.
+# 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
+INPUT_ENCODING = ISO-8859-1
# 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
@@ -511,10 +517,11 @@
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
+# 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 =
@@ -573,10 +580,10 @@
# 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.
+# 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
@@ -1036,10 +1043,11 @@
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.
+# 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.
EXPAND_AS_DEFINED =
@@ -1107,11 +1115,12 @@
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.
+# 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 =
1
0
https://svn.lrde.epita.fr/svn/scool/branches/main
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add support for Vcs in the development branch.
* vcs/scool.rb: New file.
0 files changed
Property changes on: .
___________________________________________________________________
Name: mailto
- transformers-patches(a)lrde.epita.fr
+ transformers-patches(a)lrde.epita.fr, olena-patches(a)lrde.epita.fr
1
0
https://svn.lrde.epita.fr/svn/scool/trunk
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* vcs/scool.rb: Tag SCOOL patches as such.
scool.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: vcs/scool.rb
--- vcs/scool.rb (revision 46)
+++ vcs/scool.rb (working copy)
@@ -6,7 +6,7 @@
protocol_version '0.1'
def scool_commit! ( *args )
- common_commit!("47: <%= title %>", *args) do |subject|
+ common_commit!("scool 47: <%= title %>", *args) do |subject|
mail!(:to => %w[transformers-patches(a)lrde.epita.fr
olena-patches(a)lrde.epita.fr]
:subject => subject)
1
0
https://svn.lrde.epita.fr/svn/scool/trunk
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Send patches to olena-patches too.
* vcs/scool.rb: Add olena-patches(a)lrde.epita.fr to the list of
recipients.
scool.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: vcs/scool.rb
--- vcs/scool.rb (revision 45)
+++ vcs/scool.rb (working copy)
@@ -7,7 +7,9 @@
def scool_commit! ( *args )
common_commit!("46: <%= title %>", *args) do |subject|
- mail!(:to => %w[transformers-patches(a)lrde.epita.fr], :subject => subject)
+ mail!(:to => %w[transformers-patches(a)lrde.epita.fr
+ olena-patches(a)lrde.epita.fr]
+ :subject => subject)
end
end
alias_command :sclci, :scool_commit
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add support for Doxygen in Milena.
* configure.ac (milena/Makefile, milena/doc/Makefile):
Configure them.
* Makefile.am (SUBDIRS): Add milena.
* milena/Makefile.am: New.
* milena/doc/Makefile.am, milena/doc/Doxyfile.in:
New files (copied from LRDE TC's project).
configure.ac | 2
milena/Makefile.am | 7
milena/doc/Doxyfile.in | 1262 +++++++++++++++++++++++++++++++++++++++++++++++++
milena/doc/Makefile.am | 27 +
4 files changed, 1298 insertions(+)
Index: configure.ac
--- configure.ac (revision 987)
+++ configure.ac (working copy)
@@ -85,6 +85,8 @@
static/samples/Makefile
static/samples/mini-oln/Makefile
static/samples/mini-oln/concept-c++/Makefile
+ milena/Makefile
+ milena/doc/Makefile
olena/Makefile
olena/oln/Makefile
olena/img/Makefile
Index: milena/doc/Doxyfile.in
--- milena/doc/Doxyfile.in (revision 0)
+++ milena/doc/Doxyfile.in (revision 0)
@@ -0,0 +1,1262 @@
+# Doxyfile 1.5.2 -*- Makefile -*-
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# 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 a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = "Milena (@PACKAGE_NAME@)"
+
+# 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 = "@PACKAGE_VERSION@ @ID@"
+
+# 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, Finnish, French, German, Greek, Hungarian,
+# Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
+# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
+# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
+
+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 = YES
+
+# 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 = YES
+
+# 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 = YES
+
+# 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.
+
+STRIP_FROM_PATH = @top_srcdir@/milena \
+ @top_builddir@/milena
+
+# 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 is your file systems
+# 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 the Qt-style comments (thus requiring an
+# explicit @brief command for a brief description.
+
+JAVADOC_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 DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = 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 = 8
+
+# 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 =
+
+# 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 = NO
+
+# 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
+
+# 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 make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# 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
+
+#---------------------------------------------------------------------------
+# 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 and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# 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 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 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_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
+
+# 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 sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define 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 defines 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
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = 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 =
+
+#---------------------------------------------------------------------------
+# 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 = YES
+
+# 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
+
+# This WARN_NO_PARAMDOC option can be abled 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 = @top_srcdir@/milena \
+ @top_builddir@/milena
+
+# 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++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
+
+FILE_PATTERNS = *.cc \
+ *.hh \
+ *.hxx \
+ *.hcc
+
+# 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 = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# 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.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = YES
+
+# 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.
+
+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, INPUT_FILTER
+# is applied to all files.
+
+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
+
+#---------------------------------------------------------------------------
+# 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 and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# 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 documentstion.
+
+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.
+
+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 the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# 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 compressed 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 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
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag 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 (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = YES
+
+# 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
+
+#---------------------------------------------------------------------------
+# 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 = NO
+
+# 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.
+
+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, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# 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 =
+
+# 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 = YES
+
+# 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
+
+#---------------------------------------------------------------------------
+# 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 stylesheet 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 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
+# in the INCLUDE_PATH (see below) will be search if 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.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and 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.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. 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. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# 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
+
+# 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 is superseded by the HAVE_DOT option below. This is only a
+# fallback. 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 = YES
+
+# 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
+# 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 set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = YES
+
+# 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 tags 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 graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES 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 png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# 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 MAX_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 will always
+# show the root nodes and its direct children regardless of this setting.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, which results in a white background.
+# 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
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
Index: milena/doc/Makefile.am
--- milena/doc/Makefile.am (revision 0)
+++ milena/doc/Makefile.am (revision 0)
@@ -0,0 +1,27 @@
+DOXYGEN = doxygen
+
+.PHONY: doc html
+
+doc: html
+
+html-local: Doxyfile
+ $(DOXYGEN)
+
+edit = sed -e "s|@ID@|$$Id|" \
+ -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
+ -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
+ -e 's,@top_builddir\@,$(top_builddir),g' \
+ -e 's,@top_srcdir\@,$(top_srcdir),g'
+
+EXTRA_DIST = Doxyfile.in
+CLEANFILES = Doxyfile
+# Sed is used to generate Doxyfile from Doxyfile.in instead of
+# configure, because the former is way faster than the latter.
+# Moreover, this file is updated whenever ChangeLog is touched: using
+# sed instead of configure saves us a lot of time.
+Doxyfile: $(top_srcdir)/ChangeLog $(srcdir)/Doxyfile.in
+ Id=`grep '^\$$Id' $(top_srcdir)/ChangeLog`; \
+ $(edit) $(srcdir)/Doxyfile.in >Doxyfile
+
+clean-local:
+ rm -rf html latex
Index: milena/Makefile.am
--- milena/Makefile.am (revision 0)
+++ milena/Makefile.am (revision 0)
@@ -0,0 +1,7 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+SUBDIRS = doc
+
+.PHONY: doc
+doc:
+ $(MAKE) -C doc doc
1
0
Roland Levillain wrote:
> Thierry Geraud <thierry.geraud(a)lrde.epita.fr> writes:
>
>> https://svn.lrde.epita.fr/svn/oln/trunk
>>
>>
>> Index: ChangeLog
>> from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
>>
>> Introducing mini-olena (milena).
>
> Excellent !
on verra bien...
> Je propose les changements d'organisation suivants, pour coller avec
> le reste du dépôt :
> ...
> Je peux m'en charger.
go go go
> ...
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Update milena.
* olena/oln/morpho/Rd/union_find.hh: Update.
* milena/test/main.cc: Use Rd.
* milena/morpho/Rd.hh: New.
* milena/level/fill.hh: Add assertions.
* milena/level/compare.hh: New.
* milena/level/paste.hh: New.
* milena/core/macros.hh (mln_ch_value): New.
* milena/core/concept/image.hh: Update.
* milena/core/image2d.hh: Update.
milena/core/concept/image.hh | 8 +
milena/core/image2d.hh | 6 +
milena/core/macros.hh | 4
milena/level/compare.hh | 63 +++++++++++++
milena/level/fill.hh | 20 ++++
milena/level/paste.hh | 38 +++++++
milena/morpho/Rd.hh | 181 ++++++++++++++++++++++++++++++++++++++
milena/test/main.cc | 83 +++++++++--------
olena/oln/morpho/Rd/union_find.hh | 51 +++++-----
9 files changed, 393 insertions(+), 61 deletions(-)
Index: olena/oln/morpho/Rd/union_find.hh
--- olena/oln/morpho/Rd/union_find.hh (revision 986)
+++ olena/oln/morpho/Rd/union_find.hh (working copy)
@@ -29,6 +29,7 @@
# define OLN_MORPHO_RD_UNION_FIND_HH
# include <oln/morpho/Rd/utils.hh>
+# include <oln/core/internal/max_value.hh>
namespace oln
@@ -45,6 +46,7 @@
struct union_find_t
{
typedef oln_point(I) point;
+ typedef oln_value(I) value;
// in:
I f, g;
@@ -55,8 +57,8 @@
// aux:
std::vector<point> S;
- I data;
- oln_plain_value(I, bool) is_proc;
+ // was: I data;
+ oln_plain_value(I, bool) isproc;
oln_plain_value(I, point) parent;
union_find_t(const I& f, const I& g, const N& nbh)
@@ -64,14 +66,15 @@
{
prepare(o, with, f);
prepare(parent, with, f);
- prepare(is_proc, with, f);
- prepare(data, with, f);
+ prepare(isproc, with, f);
+ // was: prepare(data, with, f);
// init
std::cout << "0 ";
- level::fill(inplace(is_proc), false);
+ level::fill(inplace(isproc), false);
S = histo_reverse_sort(g);
+ level::paste(f, inplace(o)); // new: replace make_set(p) { data(p) = f(p) }
// first pass
@@ -83,35 +86,40 @@
make_set(p);
oln_niter(N) n(nbh, p);
for_all(n)
- if (f.has(n) and is_proc(n))
+ {
+ if (f.has(n))
+ assert(isproc(n) = is_proc(n, p));
+ if (f.has(n) and isproc(n))
do_union(n, p);
- is_proc(p) = true;
+ }
+ isproc(p) = true;
}
// second pass
std::cout << "2 ";
- level::fill(inplace(is_proc), false);
for (int i = S.size() - 1; i >= 0; --i)
{
point p = S[i];
- assert(is_proc(p) = false);
if (parent(p) = p)
- o(p) = data(p) = 255 ? g(p) : data(p);
+ if (o(p) = oln_max(value))
+ o(p) = g(p);
else
- {
- assert(is_proc(parent(p)) = true);
o(p) = o(parent(p));
}
- is_proc(p) = true;
+
}
+ bool is_proc(const point& n, const point& p) const
+ {
+ return g(n) > g(p) or (g(n) = g(p) and n < p);
}
void make_set(const point& p)
{
parent(p) = p;
- data(p) = f(p);
+ // was: data(p) = f(p);
+ // now: in "initialization"
}
point find_root(const point& x)
@@ -122,24 +130,21 @@
return parent(x) = find_root(parent(x));
}
- bool equiv(const point& r, const point& p)
- {
- return g(r) = g(p) or g(p) >= data(r);
- }
-
void do_union(const point& n, const point& p)
{
point r = find_root(n);
if (r != p)
{
- if (equiv(r, p))
+ // NEW: o replaces data
+
+ if (g(r) = g(p) or g(p) >= o(r)) // equiv test
{
parent(r) = p;
- if (data(r) > data(p))
- data(p) = data(r); // increasing criterion
+ if (o(r) > o(p))
+ o(p) = o(r); // increasing criterion
}
else
- data(p) = 255;
+ o(p) = oln_max(value);
}
}
Index: milena/test/main.cc
--- milena/test/main.cc (revision 986)
+++ milena/test/main.cc (working copy)
@@ -10,11 +10,15 @@
#include <core/neighb2d.hh>
#include <morpho/erosion.hh>
+#include <morpho/Rd.hh>
-int cos_sin(const mln::point2d& p)
+typedef unsigned char int_u8;
+
+
+int_u8 cos_sin(const mln::point2d& p)
{
- return int(255 * std::cos(float(p.row())) * std::sin(float(p.col())));
+ return (int_u8)(255 * std::cos(float(p.row())) * std::sin(float(p.col())));
}
@@ -22,43 +26,46 @@
{
using namespace mln;
- box2d b = mk_box2d(/* row = */ 1, 3,
- /* col = */ 4, 6);
- std::cout << b << std::endl;
-
- bool w[] - { 0, 1, 0,
- 0, 1, 0,
- 1, 0, 0 };
- window2d win = mk_window2d(w);
- std::cout << win << std::endl;
- std::cout << c8() << std::endl;
-
- /*
- {
- image2d<int> ima(b);
- level::fill(ima, 51);
- debug::println(ima);
-
- std::cout << win << std::endl;
-
- morpho::erosion(ima, win);
-
- rectangle2d rec(1, 2);
- std::cout << rec << std::endl;
+ const unsigned size = 1000;
+ image2d<int_u8> f(size, size);
+ morpho::Rd(f, f, c8());
}
- */
-
-
- {
- image2d<int> ima(b);
- level::fill(ima, cos_sin);
- debug::println(ima);
- std::cout << std::endl;
- image2d<int> ima2 = morpho::erosion(ima, win);
- debug::println(ima2);
- }
-}
+// box2d b = mk_box2d(/* row = */ 1, 3,
+// /* col = */ 4, 6);
+// std::cout << b << std::endl;
+
+// bool w[] +// { 0, 1, 0,
+// 0, 1, 0,
+// 1, 0, 0 };
+// window2d win = mk_window2d(w);
+// std::cout << win << std::endl;
+// std::cout << c8() << std::endl;
+
+// {
+// image2d<int> ima(b);
+// level::fill(ima, 51);
+// debug::println(ima);
+
+// std::cout << win << std::endl;
+
+// morpho::erosion(ima, win);
+
+// rectangle2d rec(1, 2);
+// std::cout << rec << std::endl;
+// }
+
+
+// {
+// image2d<int> ima(b);
+// level::fill(ima, cos_sin);
+// debug::println(ima);
+
+// std::cout << std::endl;
+
+// image2d<int> ima2 = morpho::erosion(ima, win);
+// debug::println(ima2);
+// }
Index: milena/morpho/Rd.hh
--- milena/morpho/Rd.hh (revision 0)
+++ milena/morpho/Rd.hh (revision 0)
@@ -0,0 +1,181 @@
+#ifndef MLN_MORPHO_RD_HH
+# define MLN_MORPHO_RD_HH
+
+# include <vector>
+
+# include <core/concept/image.hh>
+# include <core/concept/neighborhood.hh>
+
+# include <value/props.hh>
+
+# include <level/fill.hh>
+# include <level/compare.hh>
+
+
+
+namespace mln
+{
+
+ namespace morpho
+ {
+
+ template <typename I, typename N>
+ I Rd(const Image<I>& f, const Image<I>& g, const Neighborhood<N>& nbh);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ template <typename I>
+ std::vector<unsigned> compute_histo(const I& ima)
+ {
+ std::vector<unsigned> h(256, 0);
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ ++h[ima(p)];
+ return h;
+ }
+
+ template <typename I>
+ std::vector<mln_point(I)> histo_reverse_sort(const I& ima)
+ {
+ std::vector<unsigned> h = compute_histo(ima);
+ // preparing output data
+ std::vector<int> loc(256);
+ loc[255] = 0;
+ for (int l = 254; l >= 0; --l)
+ loc[l] = loc[l+1] + h[l+1];
+ std::vector<mln_point(I)> vec(ima.domain().npoints());
+ // storing output data
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ vec[loc[ima(p)]++] = p;
+ return vec;
+ }
+
+
+ template <typename I, typename N>
+ struct Rd
+ {
+ typedef mln_point(I) point;
+ typedef mln_value(I) value;
+
+ // in:
+ const I& f;
+ const I& g;
+ const N& nbh;
+
+ // out:
+ I o;
+
+ // aux:
+ mln_ch_value(I, bool) is_proc;
+ mln_ch_value(I, point) parent;
+ std::vector<point> S;
+
+ Rd(const I& f, const I& g, const N& nbh)
+ : f(f), g(g), nbh(nbh),
+ o(f.domain()),
+ is_proc(f.domain()),
+ parent(f.domain())
+ {
+ // init
+ level::fill(o, f);
+ S = histo_reverse_sort(g);
+ level::fill(is_proc, false); // FIXME: rm
+
+ // first pass
+ for (unsigned i = 0; i < S.size(); ++i)
+ {
+ point p = S[i];
+
+ make_set(p);
+ mln_niter(N) n(nbh, p);
+ for_all(n)
+ {
+ if (f.has(n))
+ assert(is_proc(n) = is_proc__(n, p));
+ if (f.has(n) and is_proc(n))
+ do_union(n, p);
+ }
+ is_proc(p) = true;
+ }
+
+ // second pass
+ for (int i = S.size() - 1; i >= 0; --i)
+ {
+ point p = S[i];
+ if (parent(p) = p)
+ if (o(p) = mln_max(value))
+ o(p) = g(p);
+ else
+ o(p) = o(parent(p));
+ is_proc(p) = true;
+ }
+
+ }
+
+ bool is_proc__(const point& n, const point& p) const
+ {
+ return g(n) > g(p) or (g(n) = g(p) and n < p);
+ }
+
+ void make_set(const point& p)
+ {
+ parent(p) = p;
+ }
+
+ point find_root(const point& x)
+ {
+ if (parent(x) = x)
+ return x;
+ else
+ return parent(x) = find_root(parent(x));
+ }
+
+ bool equiv(const point& r, const point& p)
+ {
+ return g(r) = g(p) or g(p) >= o(r);
+ }
+
+ void do_union(const point& n, const point& p)
+ {
+ point r = find_root(n);
+ if (r != p)
+ {
+ if (equiv(r, p))
+ {
+ parent(r) = p;
+ if (o(r) > o(p))
+ o(p) = o(r); // increasing criterion
+ }
+ else
+ o(p) = mln_max(value);
+ }
+ }
+
+ };
+
+ } // end of namespace mln::morpho::impl
+
+
+ // facade
+
+ template <typename I, typename N>
+ I Rd(const Image<I>& f, const Image<I>& g, const Neighborhood<N>& nbh)
+ {
+ assert(f <= g);
+ impl::Rd<I,N> run(exact(f), exact(g), exact(nbh));
+ return run.o;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::morpho
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MORPHO_RD_HH
Index: milena/level/fill.hh
--- milena/level/fill.hh (revision 986)
+++ milena/level/fill.hh (working copy)
@@ -22,6 +22,10 @@
void fill(Image<I>& ima_,
const mln_value(I) array[]);
+ template <typename I, typename J>
+ void fill(Image<I>& ima_,
+ const Image<J>& data);
+
# ifndef MLN_INCLUDE_ONLY
@@ -30,6 +34,7 @@
const mln_value(I)& value)
{
I& ima = exact(ima_);
+ assert(ima.has_data());
mln_piter(I) p(ima.domain());
for_all(p)
ima(p) = value;
@@ -40,6 +45,7 @@
mln_value(I) (*f)(const mln_point(I)& p))
{
I& ima = exact(ima_);
+ assert(ima.has_data());
mln_piter(I) p(ima.domain());
for_all(p)
ima(p) = f(p);
@@ -50,12 +56,26 @@
const mln_value(I) array[])
{
I& ima = exact(ima_);
+ assert(ima.has_data());
mln_piter(I) p(ima.domain());
unsigned i = 0;
for_all(p)
ima(p) = array[i++];
}
+ template <typename I, typename J>
+ void fill(Image<I>& ima_,
+ const Image<J>& data_)
+ {
+ I& ima = exact(ima_);
+ const J& data = exact(data_);
+ assert(ima.has_data() and data.has_data());
+
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ ima(p) = data(p);
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::level
Index: milena/level/compare.hh
--- milena/level/compare.hh (revision 0)
+++ milena/level/compare.hh (revision 0)
@@ -0,0 +1,63 @@
+#ifndef MLN_LEVEL_COMPARE_HH
+# define MLN_LEVEL_COMPARE_HH
+
+# include <core/concept/image.hh>
+
+
+namespace mln
+{
+
+ template <typename L, typename R>
+ bool operator = (const Image<L>& lhs, const Image<R>& rhs);
+
+ template <typename L, typename R>
+ bool operator < (const Image<L>& lhs, const Image<R>& rhs);
+
+ template <typename L, typename R> // required!
+ bool operator <= (const Image<L>& lhs, const Image<R>& rhs);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename L, typename R>
+ bool operator = (const Image<L>& lhs_, const Image<R>& rhs_)
+ {
+ const L& lhs = exact(lhs_);
+ const R& rhs = exact(rhs_);
+ mln_piter(L) p(lhs.domain());
+ for_all(p)
+ if (not (lhs(p) = rhs(p)))
+ return false;
+ return true;
+ }
+
+ template <typename L, typename R>
+ bool operator < (const Image<L>& lhs_, const Image<R>& rhs_)
+ {
+ const L& lhs = exact(lhs_);
+ const R& rhs = exact(rhs_);
+ mln_piter(L) p(lhs.domain());
+ for_all(p)
+ if (not (lhs(p) < rhs(p)))
+ return false;
+ return true;
+ }
+
+ template <typename L, typename R> // required!
+ bool operator <= (const Image<L>& lhs_, const Image<R>& rhs_)
+ {
+ const L& lhs = exact(lhs_);
+ const R& rhs = exact(rhs_);
+ mln_piter(L) p(lhs.domain());
+ for_all(p)
+ if (not (lhs(p) <= rhs(p)))
+ return false;
+ return true;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LEVEL_COMPARE_HH
Index: milena/level/paste.hh
--- milena/level/paste.hh (revision 0)
+++ milena/level/paste.hh (revision 0)
@@ -0,0 +1,38 @@
+#ifndef MLN_LEVEL_PASTE_HH
+# define MLN_LEVEL_PASTE_HH
+
+# include <core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace level
+ {
+
+ template <typename I, typename J>
+ void paste(const Image<I>& data, Image<J>& destination);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename J>
+ void paste(const Image<I>& data_, Image<J>& destination_)
+ {
+ const I& data = exact(data_);
+ I& destination = exact(destination_);
+ assert(ima.has_data() and destination.has_data());
+
+ mln_piter(I) p(data.domain());
+ for_all(p)
+ destination(p) = data(p);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::level
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LEVEL_PASTE_HH
Index: milena/core/macros.hh
--- milena/core/macros.hh (revision 986)
+++ milena/core/macros.hh (working copy)
@@ -25,4 +25,8 @@
# define mln_rvalue(T) typename T::rvalue
# define mln_lvalue(T) typename T::lvalue
+
+# define mln_ch_value(I, T) typename I::template change_value<T>::ret
+
+
#endif // ! MLN_CORE_MACROS_HH
Index: milena/core/concept/image.hh
--- milena/core/concept/image.hh (revision 986)
+++ milena/core/concept/image.hh (working copy)
@@ -25,6 +25,12 @@
rvalue operator()(const psite& p) const;
lvalue operator()(const psite& p);
+ template <typename T>
+ struct change_value
+ {
+ typedef ret;
+ };
+
// provided by internal::image_base_:
@@ -71,6 +77,8 @@
typedef mln_rvalue(E) rvalue;
typedef mln_lvalue(E) lvalue;
+ typedef mln_ch_value(E, value) change;
+
bool (E::*m3)() const = & E::has_data;
m3 = 0;
bool (E::*m4)(const psite& p) const = & E::owns_;
Index: milena/core/image2d.hh
--- milena/core/image2d.hh (revision 986)
+++ milena/core/image2d.hh (working copy)
@@ -15,6 +15,12 @@
typedef const T& rvalue;
typedef T& lvalue;
+ template <typename U>
+ struct change_value
+ {
+ typedef image2d<U> ret;
+ };
+
image2d();
image2d(int nrows, int ncols);
image2d(const box2d& b);
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Introducing mini-olena (milena).
* milena: New.
* milena/test: New.
* milena/test/main.cc: New.
* milena/convert: New.
* milena/morpho: New.
* milena/debug: New.
* milena/debug/println.hh: New.
* milena/level: New.
* milena/level/fill.hh: New.
* milena/core: New.
* milena/core/dpoint2d.hh: New.
* milena/core/window2d.cc: New.
* milena/core/macros.hh: New.
* milena/core/dpoints_qiter.hh: New.
* milena/core/window2d_qiter.cc: New.
* milena/core/box.hh: New.
* milena/core/point.hh: New.
* milena/core/rectangle2d.hh: New.
* milena/core/box_piter.hh: New.
* milena/core/dpoint.hh: New.
* milena/core/concept: New.
* milena/core/concept/image.hh: New.
* milena/core/concept/genpoint.hh: New.
* milena/core/concept/piter.hh: New.
* milena/core/concept/point_set.hh: New.
* milena/core/concept/psite.hh: New.
* milena/core/concept/object.hh: New.
* milena/core/concept/window.hh: New.
* milena/core/concept/box.hh: New.
* milena/core/concept/iterator.hh: New.
* milena/core/concept/point.hh: New.
* milena/core/concept/dpoint.hh: New.
* milena/core/window2d.hh: New.
* milena/core/ops.hh: New.
* milena/core/exact.hh: New.
* milena/core/window.hh: New.
* milena/core/image2d.hh: New.
* milena/core/vec.hh: New.
* milena/core/internal: New.
* milena/core/internal/coord_impl.hh: New.
* milena/core/internal/image_adaptor.hh: New.
* milena/core/internal/image_base.hh: New.
* milena/core/internal/set_of.hh: New.
* milena/core/box2d.hh: New.
* milena/core/point2d.hh: New.
* milena/core/safe_image.hh: New.
* milena/mlc: New.
* milena/mlc/equal.hh: New.
* milena/mlc/same_point.hh: New.
* milena/value: New.
* milena/README: New.
README | 14 ++
core/box.hh | 68 +++++++++++++
core/box2d.hh | 31 ++++++
core/box_piter.hh | 156 ++++++++++++++++++++++++++++++
core/concept/box.hh | 48 +++++++++
core/concept/dpoint.hh | 99 +++++++++++++++++++
core/concept/genpoint.hh | 136 ++++++++++++++++++++++++++
core/concept/image.hh | 92 ++++++++++++++++++
core/concept/iterator.hh | 58 +++++++++++
core/concept/object.hh | 37 +++++++
core/concept/piter.hh | 45 ++++++++
core/concept/point.hh | 65 ++++++++++++
core/concept/point_set.hh | 55 ++++++++++
core/concept/psite.hh | 38 +++++++
core/concept/window.hh | 50 +++++++++
core/dpoint.hh | 74 ++++++++++++++
core/dpoint2d.hh | 26 +++++
core/dpoints_qiter.hh | 123 ++++++++++++++++++++++++
core/exact.hh | 100 +++++++++++++++++++
core/image2d.hh | 147 +++++++++++++++++++++++++++++
core/internal/coord_impl.hh | 207 +++++++++++++++++++++++++++++++++++++++++
core/internal/image_adaptor.hh | 87 +++++++++++++++++
core/internal/image_base.hh | 68 +++++++++++++
core/internal/set_of.hh | 108 +++++++++++++++++++++
core/macros.hh | 28 +++++
core/ops.hh | 56 +++++++++++
core/point.hh | 74 ++++++++++++++
core/point2d.hh | 26 +++++
core/rectangle2d.hh | 82 ++++++++++++++++
core/safe_image.hh | 70 +++++++++++++
core/vec.hh | 35 ++++++
core/window.hh | 76 +++++++++++++++
core/window2d.cc | 65 ++++++++++++
core/window2d.hh | 39 +++++++
core/window2d_qiter.cc | 125 ++++++++++++++++++++++++
debug/println.hh | 61 ++++++++++++
level/fill.hh | 35 ++++++
mlc/equal.hh | 30 +++++
mlc/same_point.hh | 24 ++++
test/main.cc | 32 ++++++
40 files changed, 2790 insertions(+)
Index: milena/test/main.cc
--- milena/test/main.cc (revision 0)
+++ milena/test/main.cc (revision 0)
@@ -0,0 +1,32 @@
+#include <core/image2d.hh>
+#include <level/fill.hh>
+#include <debug/println.hh>
+
+#include <core/window2d.hh>
+#include <core/rectangle2d.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ box2d b = mk_box2d(/* row = */ 1, 2,
+ /* col = */ 3, 5);
+ std::cout << b << std::endl;
+
+ image2d<int> ima(b);
+ level::fill(ima, 51);
+ debug::println(ima);
+
+ bool w[] + { 0, 1, 0,
+ 0, 1, 0,
+ 1, 0, 0 };
+ window2d win = mk_window2d(w);
+ std::cout << win << std::endl;
+
+ debug::println(ima, win);
+
+ rectangle2d rec(1, 2);
+ std::cout << rec << std::endl;
+}
Index: milena/debug/println.hh
--- milena/debug/println.hh (revision 0)
+++ milena/debug/println.hh (revision 0)
@@ -0,0 +1,61 @@
+#ifndef MLN_DEBUG_PRINTLN_HH
+# define MLN_DEBUG_PRINTLN_HH
+
+# include <core/concept/image.hh>
+# include <core/concept/window.hh>
+
+
+namespace mln
+{
+
+ namespace debug
+ {
+
+ template <typename I>
+ void println(const Image<I>& input_);
+
+ template <typename I, typename W>
+ void println(const Image<I>& input_,
+ const Window<W>& win_);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ void println(const Image<I>& input_)
+ {
+ const I& input = exact(input_);
+ oln_piter(I) p(input.domain());
+ for_all(p)
+ std::cout << input(p) << ' ';
+ std::cout << std::endl;
+ }
+
+
+ template <typename I, typename W>
+ void println(const Image<I>& input_,
+ const Window<W>& win_)
+ {
+ const I& input = exact(input_);
+ const W& win = exact(win_);
+
+ oln_piter(I) p(input.domain());
+ oln_qiter(W) q(win, p);
+ for_all(p)
+ {
+ std::cout << input(p) << ':';
+ for_all(q)
+ if (input.owns_(q))
+ std::cout << input(q) << ' ';
+ std::cout << std::endl;
+ }
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::debug
+
+} // end of namespace mln
+
+
+#endif // ! MLN_DEBUG_PRINTLN_HH
Index: milena/level/fill.hh
--- milena/level/fill.hh (revision 0)
+++ milena/level/fill.hh (revision 0)
@@ -0,0 +1,35 @@
+#ifndef MLN_LEVEL_FILL_HH
+# define MLN_LEVEL_FILL_HH
+
+# include <core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace level
+ {
+
+ template <typename I>
+ void fill(Image<I>& ima_, const oln_value(I)& value);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I>
+ void fill(Image<I>& ima_, const oln_value(I)& value)
+ {
+ I& ima = exact(ima_);
+ oln_piter(I) p(ima.domain());
+ for_all(p)
+ ima(p) = value;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::level
+
+} // end of namespace mln
+
+
+#endif // ! MLN_LEVEL_FILL_HH
Index: milena/core/dpoint2d.hh
--- milena/core/dpoint2d.hh (revision 0)
+++ milena/core/dpoint2d.hh (revision 0)
@@ -0,0 +1,26 @@
+#ifndef MLN_CORE_DPOINT2D_HH
+# define MLN_CORE_DPOINT2D_HH
+
+# include <core/dpoint.hh>
+
+
+namespace mln
+{
+
+ typedef dpoint_<2,int> dpoint2d;
+
+ dpoint2d mk_dpoint2d(int row, int col)
+ {
+ dpoint2d tmp;
+ tmp[0] = row;
+ tmp[1] = col;
+ return tmp;
+ }
+
+} // end of namespace mln
+
+
+# include <core/point2d.hh>
+
+
+#endif // ! MLN_CORE_DPOINT2D_HH
Index: milena/core/window2d.cc
--- milena/core/window2d.cc (revision 0)
+++ milena/core/window2d.cc (revision 0)
@@ -0,0 +1,65 @@
+# include <core/window2d.hh>
+# include <core/window2d_qiter.hh>
+# include <core/piter.hh>
+
+
+namespace mln
+{
+
+ window2d::window2d()
+ {
+ }
+
+ window2d::window2d(unsigned nrows, unsigned ncols,
+ const bool values[])
+ {
+ assert(nrows != 0 and ncols != 0);
+ assert(nrows % 2 = 1 and ncols % 2 = 1);
+ int drow = int(nrows) / 2, dcol = int(ncols) / 2;
+ unsigned i = 0;
+ for (int row = - drow; row <= drow; ++row)
+ for (int col = - dcol; col <= dcol; ++col)
+ if (values[i++])
+ insert(dpoint2d(row, col));
+ }
+
+ bool
+ window2d::is_empty() const
+ {
+ // typedef internal::set_of_<dpoint2d> impl;
+ return this->impl::is_empty();
+ }
+
+ bool
+ window2d::is_centered() const
+ {
+ static dpoint2d O(0, 0);
+ return this->has(O);
+ }
+
+ bool
+ window2d::is_symmetric() const
+ {
+ // FIXME: nyi
+ return false;
+ }
+
+ mln::piter
+ window2d::fwd_qiter(const GenPoint& p) const
+ {
+ return new window2d_fwd_qiter(*this, p);
+ }
+
+ mln::piter
+ window2d::bkd_qiter(const GenPoint& p) const
+ {
+ return new window2d_bkd_qiter(*this, p);
+ }
+
+ window2d&
+ window2d::clone() const
+ {
+ return *new window2d(*this);
+ }
+
+} // end of namespace mln
Index: milena/core/macros.hh
--- milena/core/macros.hh (revision 0)
+++ milena/core/macros.hh (revision 0)
@@ -0,0 +1,28 @@
+#ifndef MLN_CORE_MACROS_HH
+# define MLN_CORE_MACROS_HH
+
+
+# define oln_point(T) typename T::point
+# define oln_dpoint(T) typename T::dpoint
+# define oln_psite(T) typename T::psite
+# define oln_pset(T) typename T::pset
+# define oln_box(T) typename T::box
+# define oln_coord(T) typename T::coord
+
+# define oln_piter(T) typename T::piter
+# define oln_fwd_piter(T) typename T::fwd_piter
+# define oln_bkd_piter(T) typename T::bkd_piter
+
+# define oln_qiter(T) typename T::qiter
+# define oln_fwd_qiter(T) typename T::fwd_qiter
+# define oln_bkd_qiter(T) typename T::bkd_qiter
+
+# define oln_niter(T) typename T::niter
+# define oln_fwd_niter(T) typename T::fwd_niter
+# define oln_bkd_niter(T) typename T::bkd_niter
+
+# define oln_value(T) typename T::value
+# define oln_rvalue(T) typename T::rvalue
+# define oln_lvalue(T) typename T::lvalue
+
+#endif // ! MLN_CORE_MACROS_HH
Index: milena/core/dpoints_qiter.hh
--- milena/core/dpoints_qiter.hh (revision 0)
+++ milena/core/dpoints_qiter.hh (revision 0)
@@ -0,0 +1,123 @@
+#ifndef MLN_CORE_DPOINTS_QITER_HH
+# define MLN_CORE_DPOINTS_QITER_HH
+
+# include <core/concept/piter.hh>
+# include <core/concept/genpoint.hh>
+
+
+namespace mln
+{
+
+ template <typename D>
+ class dpoints_fwd_qiter : public Piter< dpoints_fwd_qiter<D> >
+ {
+ public:
+
+ enum { dim = D::dim };
+
+ typedef D dpoint;
+ typedef oln_point(D) point;
+ typedef point psite;
+ typedef oln_coord(D) coord;
+
+ template <typename Dps, typename Pref>
+ dpoints_fwd_qiter(const Dps& dps,
+ const GenPoint<Pref>& p_ref);
+
+ operator point() const;
+ const point* pointer() const;
+
+ bool is_valid() const;
+ void invalidate();
+ void start();
+ void next_();
+
+ coord operator[](unsigned i) const;
+
+ private:
+ const std::vector<D>& dps_;
+ const point& p_ref_;
+
+ unsigned i_;
+ point p_;
+ void update_p_();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename D>
+ template <typename Dps, typename Pref>
+ dpoints_fwd_qiter<D>::dpoints_fwd_qiter(const Dps& dps,
+ const GenPoint<Pref>& p_ref)
+ : dps_(exact(dps).vec()),
+ p_ref_(* force_exact<Pref>(p_ref).pointer())
+ {
+ invalidate();
+ }
+
+ template <typename D>
+ dpoints_fwd_qiter<D>::operator point() const
+ {
+ assert(is_valid());
+ return p_;
+ }
+
+ template <typename D>
+ const oln_point(D)*
+ dpoints_fwd_qiter<D>::pointer() const
+ {
+ return & p_;
+ }
+
+ template <typename D>
+ bool
+ dpoints_fwd_qiter<D>::is_valid() const
+ {
+ return i_ != dps_.size();
+ }
+
+ template <typename D>
+ void
+ dpoints_fwd_qiter<D>::invalidate()
+ {
+ i_ = dps_.size();
+ }
+
+ template <typename D>
+ void
+ dpoints_fwd_qiter<D>::start()
+ {
+ i_ = 0;
+ update_p_();
+ }
+
+ template <typename D>
+ void
+ dpoints_fwd_qiter<D>::next_()
+ {
+ ++i_;
+ update_p_();
+ }
+
+ template <typename D>
+ void
+ dpoints_fwd_qiter<D>::update_p_()
+ {
+ if (is_valid())
+ p_ = p_ref_ + dps_[i_];
+ }
+
+ template <typename D>
+ oln_coord(D)
+ dpoints_fwd_qiter<D>::operator[](unsigned i) const
+ {
+ return p_[i];
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_DPOINTS_QITER_HH
Index: milena/core/window2d_qiter.cc
--- milena/core/window2d_qiter.cc (revision 0)
+++ milena/core/window2d_qiter.cc (revision 0)
@@ -0,0 +1,125 @@
+# include <core/window2d_qiter.hh>
+# include <core/window2d.hh>
+
+
+namespace mln
+{
+
+ // fwd
+
+ window2d_fwd_qiter::window2d_fwd_qiter(const Window& w,
+ const GenPoint& p)
+ : w_(dynamic_cast<const window2d&>(w)),
+ p_ref_(dynamic_cast<const point2d&>(p.pointee()))
+ {
+ // FIXME: test!
+ invalidate();
+ }
+
+ bool
+ window2d_fwd_qiter::is_valid() const
+ {
+ return i_ != w_.nelements();
+ }
+
+ void
+ window2d_fwd_qiter::invalidate()
+ {
+ i_ = w_.nelements();
+ }
+
+ void
+ window2d_fwd_qiter::start()
+ {
+ i_ = 0;
+ update_p_();
+ }
+
+ const point2d&
+ window2d_fwd_qiter::psite() const
+ {
+ return p_;
+ }
+
+ window2d_fwd_qiter&
+ window2d_fwd_qiter::clone() const
+ {
+ return *new window2d_fwd_qiter(*this);
+ }
+
+ void
+ window2d_fwd_qiter::next_()
+ {
+ ++i_;
+ update_p_();
+ }
+
+ void
+ window2d_fwd_qiter::update_p_()
+ {
+ if (is_valid())
+ p_ = static_cast<const point2d&>(p_ref_.point()) + w_.element(i_);
+ }
+
+
+
+
+
+ // bkd
+
+ window2d_bkd_qiter::window2d_bkd_qiter(const Window& w,
+ const GenPoint& p)
+ : w_(dynamic_cast<const window2d&>(w)),
+ p_ref_(dynamic_cast<const point2d&>(p.pointee()))
+ {
+ // FIXME: test!
+ invalidate();
+ }
+
+ bool
+ window2d_bkd_qiter::is_valid() const
+ {
+ return i_ != w_.nelements();
+ }
+
+ void
+ window2d_bkd_qiter::invalidate()
+ {
+ i_ = w_.nelements();
+ }
+
+ void
+ window2d_bkd_qiter::start()
+ {
+ i_ = 0;
+ update_p_();
+ }
+
+ const point2d&
+ window2d_bkd_qiter::psite() const
+ {
+ return p_;
+ }
+
+ window2d_bkd_qiter&
+ window2d_bkd_qiter::clone() const
+ {
+ return *new window2d_bkd_qiter(*this);
+ }
+
+ void
+ window2d_bkd_qiter::next_()
+ {
+ ++i_;
+ update_p_();
+ }
+
+ void
+ window2d_bkd_qiter::update_p_()
+ {
+ if (is_valid())
+ p_ = static_cast<const point2d&>(p_ref_.point()) + w_.element(i_);
+ }
+
+
+} // end of namespace mln
Index: milena/core/box.hh
--- milena/core/box.hh (revision 0)
+++ milena/core/box.hh (revision 0)
@@ -0,0 +1,68 @@
+#ifndef MLN_CORE_BOX_HH
+# define MLN_CORE_BOX_HH
+
+# include <core/concept/box.hh>
+# include <core/point.hh>
+
+
+namespace mln
+{
+
+ // fwd decl
+ template <typename P> struct box_fwd_piter_;
+ template <typename P> struct box_bkd_piter_;
+
+
+ template <typename P>
+ struct box_ : public Box< box_<P> >
+ {
+ typedef P psite;
+ typedef P point;
+
+ typedef box_fwd_piter_<P> fwd_piter;
+ typedef box_bkd_piter_<P> bkd_piter;
+ typedef fwd_piter piter;
+
+ P pmin() const { return pmin_; }
+ P& pmin() { return pmin_; }
+
+ P pmax() const { return pmax_; }
+ P& pmax() { return pmax_; }
+
+ box_()
+ {
+ }
+
+ box_(const point& pmin, const point& pmax)
+ : pmin_(pmin),
+ pmax_(pmax)
+ {
+ }
+
+ bool has(const P& p) const
+ {
+ for (unsigned i = 0; i < P::dim; ++i)
+ if (p[i] < pmin_[i] or p[i] > pmax_[i])
+ return false;
+ return true;
+ }
+
+ protected:
+ P pmin_, pmax_;
+ };
+
+
+ template <typename P>
+ std::ostream& operator<<(std::ostream& ostr, const box_<P>& b)
+ {
+ return ostr << "[" << b.pmin() << ".." << b.pmax() << ']';
+ }
+
+
+} // end of namespace mln
+
+
+# include <core/box_piter.hh>
+
+
+#endif // ! MLN_CORE_BOX_HH
Index: milena/core/point.hh
--- milena/core/point.hh (revision 0)
+++ milena/core/point.hh (revision 0)
@@ -0,0 +1,74 @@
+#ifndef MLN_CORE_POINT_HH
+# define MLN_CORE_POINT_HH
+
+# include <core/concept/point.hh>
+# include <core/internal/coord_impl.hh>
+
+
+namespace mln
+{
+
+ // fwd decl
+ template <unsigned n, typename C> struct dpoint_;
+
+
+ template <unsigned n, typename C>
+ struct point_ : public Point< point_<n,C> >,
+ public internal::mutable_coord_impl_< n, C, point_<n,C> >
+ {
+ enum { dim = n };
+ typedef C coord;
+ typedef dpoint_<n,C> dpoint;
+
+ C operator[](unsigned i) const;
+ C& operator[](unsigned i);
+
+ point_();
+ point_(C c);
+ void set_all(C c);
+
+ protected:
+ C coord_[n];
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned n, typename C>
+ C point_<n,C>::operator[](unsigned i) const
+ {
+ assert(i < n);
+ return coord_[i];
+ }
+
+ template <unsigned n, typename C>
+ C& point_<n,C>::operator[](unsigned i)
+ {
+ assert(i < n);
+ return coord_[i];
+ }
+
+ template <unsigned n, typename C>
+ point_<n,C>::point_()
+ {
+ }
+
+ template <unsigned n, typename C>
+ point_<n,C>::point_(C c)
+ {
+ set_all(c);
+ }
+
+ template <unsigned n, typename C>
+ void point_<n,C>::set_all(C c)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ coord_[i] = c;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_POINT_HH
Index: milena/core/rectangle2d.hh
--- milena/core/rectangle2d.hh (revision 0)
+++ milena/core/rectangle2d.hh (revision 0)
@@ -0,0 +1,82 @@
+#ifndef MLN_CORE_RECTANGLE2D_HH
+# define MLN_CORE_RECTANGLE2D_HH
+
+# include <core/concept/window.hh>
+# include <core/internal/set_of.hh>
+# include <core/dpoint2d.hh>
+# include <core/dpoints_qiter.hh>
+
+
+namespace mln
+{
+
+ struct rectangle2d : public Window< rectangle2d >,
+ public internal::set_of_<dpoint2d>
+ {
+ typedef dpoints_fwd_qiter<dpoint2d> fwd_qiter;
+ typedef dpoints_bkd_qiter<dpoint2d> bkd_qiter;
+ typedef fwd_qiter qiter;
+
+ rectangle2d(unsigned half_height, unsigned half_width);
+
+ bool is_centered() const;
+ bool is_symmetric() const;
+
+ unsigned height() const;
+ unsigned width() const;
+
+ protected:
+ unsigned half_height_, half_width_;
+ };
+
+ std::ostream& operator<<(std::ostream& ostr,
+ const rectangle2d& win);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ rectangle2d::rectangle2d(unsigned half_height, unsigned half_width)
+ : half_height_(half_height),
+ half_width_(half_width)
+ {
+ assert(half_height != 0 and half_width != 0);
+ const int drow = half_height, dcol = half_width;
+ for (int row = - drow; row <= drow; ++row)
+ for (int col = - dcol; col <= dcol; ++col)
+ insert(mk_dpoint2d(row, col));
+ }
+
+ bool rectangle2d::is_centered() const
+ {
+ return true;
+ }
+
+ bool rectangle2d::is_symmetric() const
+ {
+ return true;
+ }
+
+ unsigned rectangle2d::height() const
+ {
+ return 2 * half_height_ + 1;
+ }
+
+ unsigned rectangle2d::width() const
+ {
+ return 2 * half_width_ + 1;
+ }
+
+ std::ostream& operator<<(std::ostream& ostr,
+ const rectangle2d& win)
+ {
+ ostr << "[width=" << win.width() << ", height=" << win.height() << ']';
+ return ostr;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+
+#endif // ! MLN_CORE_RECTANGLE2D_HH
Index: milena/core/box_piter.hh
--- milena/core/box_piter.hh (revision 0)
+++ milena/core/box_piter.hh (revision 0)
@@ -0,0 +1,156 @@
+#ifndef MLN_CORE_BOX_PITER_HH
+# define MLN_CORE_BOX_PITER_HH
+
+# include <core/concept/piter.hh>
+# include <core/concept/box.hh>
+
+
+namespace mln
+{
+
+ template <typename P>
+ class box_fwd_piter_ : public Piter< box_fwd_piter_<P> >
+ {
+ public:
+
+ enum { dim = P::dim };
+
+ typedef P psite;
+ typedef P point;
+ typedef oln_coord(P) coord;
+ typedef oln_dpoint(P) dpoint;
+
+ box_fwd_piter_(const box_<P>& b)
+ : b_(b)
+ {
+ nop_ = b_.pmax();
+ ++nop_[0];
+ invalidate();
+ }
+
+ operator P() const
+ {
+ return p_;
+ }
+
+ const P* pointer() const
+ {
+ return & p_;
+ }
+
+ coord operator[](unsigned i) const
+ {
+ assert(i < dim);
+ return p_[i];
+ }
+
+ bool is_valid() const
+ {
+ return p_ != nop_;
+ }
+
+ void invalidate()
+ {
+ p_ = nop_;
+ }
+
+ void start()
+ {
+ p_ = b_.pmin();
+ }
+
+ void next_()
+ {
+ for (int i = dim - 1; i >= 0; --i)
+ if (p_[i] = b_.pmax()[i])
+ p_[i] = b_.pmin()[i];
+ else
+ {
+ ++p_[i];
+ break;
+ }
+ if (p_ = b_.pmin())
+ p_ = nop_;
+ }
+
+ private:
+ const box_<P>& b_;
+ P p_, nop_;
+ };
+
+
+
+ template <typename P>
+ class box_bkd_piter_ : public Piter< box_bkd_piter_<P> >
+ {
+ public:
+
+ enum { dim = P::dim };
+
+ typedef P psite;
+ typedef P point;
+ typedef oln_coord(P) coord;
+
+ box_bkd_piter_(const box_<P>& b)
+ : b_(b)
+ {
+ nop_ = b_.pmin();
+ --nop_[0];
+ invalidate();
+ }
+
+ operator P() const
+ {
+ return p_;
+ }
+
+ const P* pointer() const
+ {
+ return & p_;
+ }
+
+ coord operator[](unsigned i) const
+ {
+ assert(i < dim);
+ return p_[i];
+ }
+
+ bool is_valid() const
+ {
+ return p_ != nop_;
+ }
+
+ void invalidate()
+ {
+ p_ = nop_;
+ }
+
+ void start()
+ {
+ p_ = b_.pmax();
+ }
+
+ void next_()
+ {
+ for (int i = dim - 1; i >= 0; --i)
+ if (p_[i] = b_.pmin()[i])
+ p_[i] = b_.pmax()[i];
+ else
+ {
+ --p_[i];
+ break;
+ }
+ if (p_ = b_.pmax())
+ p_ = nop_;
+ }
+
+ private:
+ const box_<P>& b_;
+ P p_, nop_;
+ };
+
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_BOX_PITER_HH
Index: milena/core/dpoint.hh
--- milena/core/dpoint.hh (revision 0)
+++ milena/core/dpoint.hh (revision 0)
@@ -0,0 +1,74 @@
+#ifndef MLN_CORE_DPOINT_HH
+# define MLN_CORE_DPOINT_HH
+
+# include <core/concept/dpoint.hh>
+# include <core/internal/coord_impl.hh>
+
+
+namespace mln
+{
+
+ // fwd decl
+ template <unsigned n, typename C> struct point_;
+
+
+ template <unsigned n, typename C>
+ struct dpoint_ : public Dpoint< dpoint_<n,C> >,
+ public internal::mutable_coord_impl_< n, C, dpoint_<n,C> >
+ {
+ enum { dim = n };
+ typedef C coord;
+ typedef point_<n,C> point;
+
+ C operator[](unsigned i) const;
+ C& operator[](unsigned i);
+
+ dpoint_();
+ dpoint_(C c);
+ void set_all(C c);
+
+ protected:
+ C coord_[n];
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned n, typename C>
+ C dpoint_<n,C>::operator[](unsigned i) const
+ {
+ assert(i < n);
+ return coord_[i];
+ }
+
+ template <unsigned n, typename C>
+ C& dpoint_<n,C>::operator[](unsigned i)
+ {
+ assert(i < n);
+ return coord_[i];
+ }
+
+ template <unsigned n, typename C>
+ dpoint_<n,C>::dpoint_()
+ {
+ }
+
+ template <unsigned n, typename C>
+ dpoint_<n,C>::dpoint_(C c)
+ {
+ set_all(c);
+ }
+
+ template <unsigned n, typename C>
+ void dpoint_<n,C>::set_all(C c)
+ {
+ for (unsigned i = 0; i < n; ++i)
+ coord_[i] = c;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_DPOINT_HH
Index: milena/core/concept/image.hh
--- milena/core/concept/image.hh (revision 0)
+++ milena/core/concept/image.hh (revision 0)
@@ -0,0 +1,92 @@
+#ifndef MLN_CORE_CONCEPT_IMAGE_HH
+# define MLN_CORE_CONCEPT_IMAGE_HH
+
+# include <core/concept/point_set.hh>
+
+
+namespace mln
+{
+
+ template <typename E>
+ struct Image : public Object<E>
+ {
+ /*
+ // to be provided in concrete image classes:
+
+ typedef value;
+ typedef rvalue;
+ typedef lvalue;
+
+ bool has_data() const;
+
+ bool owns_(const psite& p) const; // default is like "has(p)"
+ const pset& domain() const;
+
+ rvalue operator()(const psite& p) const;
+ lvalue operator()(const psite& p);
+
+
+ // provided by internal::image_base_:
+
+ typedef pset;
+ typedef point;
+ typedef psite;
+
+ typedef piter;
+ typedef fwd_piter;
+ typedef bkd_piter;
+
+ bool has(const psite& p) const;
+ const box_<point>& bbox() const;
+ */
+
+ protected:
+ Image();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ Image<E>::Image()
+ {
+ // provided by internal::image_base_:
+
+ typedef oln_pset(E) pset;
+ typedef oln_point(E) point;
+ typedef oln_psite(E) psite;
+
+ typedef oln_piter(E) piter;
+ typedef oln_fwd_piter(E) fwd_piter;
+ typedef oln_bkd_piter(E) bkd_piter;
+
+ bool (E::*m1)(const psite& p) const = & E::has;
+ m1 = 0;
+ const box_<point>& (E::*m2)() const = & E::bbox;
+ m2 = 0;
+
+ // to be provided in concrete image classes:
+
+ typedef oln_value(E) value;
+ typedef oln_rvalue(E) rvalue;
+ typedef oln_lvalue(E) lvalue;
+
+ bool (E::*m3)() const = & E::has_data;
+ m3 = 0;
+ bool (E::*m4)(const psite& p) const = & E::owns_;
+ m4 = 0;
+ const pset& (E::*m5)() const = & E::domain;
+ m5 = 0;
+
+ rvalue (E::*m6)(const psite& p) const = & E::operator();
+ m6 = 0;
+ lvalue (E::*m7)(const psite& p) = & E::operator();
+ m7 = 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_IMAGE_HH
Index: milena/core/concept/genpoint.hh
--- milena/core/concept/genpoint.hh (revision 0)
+++ milena/core/concept/genpoint.hh (revision 0)
@@ -0,0 +1,136 @@
+#ifndef MLN_CORE_CONCEPT_GENPOINT_HH
+# define MLN_CORE_CONCEPT_GENPOINT_HH
+
+# include <core/concept/object.hh>
+# include <core/macros.hh>
+# include <mlc/equal.hh>
+# include <mlc/same_point.hh>
+
+
+namespace mln
+{
+
+ template <typename E>
+ struct GenPoint // stand-alone class!
+ {
+ /*
+ typedef point;
+ typedef dpoint;
+ typedef coord;
+ typedef topo; // FIXME
+
+ either Point
+ or operator point() const;
+
+ const point* pointer() const;
+ coord operator[](unsigned i) const;
+ */
+
+ protected:
+ GenPoint();
+ };
+
+
+ template <typename Pl, typename Pr>
+ bool operator=(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
+
+ template <typename Pl, typename Pr>
+ bool operator<(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
+
+ template <typename Pl, typename Pr>
+ oln_dpoint(Pl)
+ operator-(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs);
+
+ template <typename P>
+ oln_point(P)
+ operator+(const GenPoint<P>& lhs, const oln_dpoint(P)& rhs);
+
+ template <typename P>
+ std::ostream& operator<<(std::ostream& ostr, const GenPoint<P>& p);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ GenPoint<E>::GenPoint()
+ {
+ typedef oln_point(E) point;
+ typedef oln_dpoint(E) dpoint;
+ typedef oln_coord(E) coord;
+ const point* (E::*m1)() const = & E::pointer;
+ m1 = 0;
+ coord (E::*m2)(unsigned i) const = & E::operator[];
+ m2 = 0;
+ }
+
+ template <typename Pl, typename Pr>
+ bool operator=(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs)
+ {
+ const Pl& lhs_ = force_exact<Pl>(lhs);
+ const Pr& rhs_ = force_exact<Pr>(rhs);
+ mlc::same_point<Pl, Pr>::check();
+ for (unsigned i = 0; i < Pl::dim; ++i)
+ if (lhs_[i] != rhs_[i])
+ return false;
+ return true;
+ }
+
+ template <typename Pl, typename Pr>
+ bool operator<(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs)
+ {
+ mlc::same_point<Pl, Pr>::check();
+ const Pl& lhs_ = force_exact<Pl>(lhs);
+ const Pr& rhs_ = force_exact<Pr>(rhs);
+ for (unsigned i = 0; i < Pl::dim; ++i)
+ {
+ if (lhs_[i] = rhs_[i])
+ continue;
+ return lhs_[i] < rhs_[i];
+ }
+ return false;
+ }
+
+
+ template <typename Pl, typename Pr>
+ oln_dpoint(Pl)
+ operator-(const GenPoint<Pl>& lhs, const GenPoint<Pr>& rhs)
+ {
+ const Pl& lhs_ = force_exact<Pl>(lhs);
+ const Pr& rhs_ = force_exact<Pr>(rhs);
+ oln_dpoint(Pl) tmp;
+ for (unsigned i = 0; i < Pl::dim; ++i)
+ tmp[i] = lhs_[i] - rhs_[i];
+ return tmp;
+ }
+
+
+ template <typename P>
+ oln_point(P)
+ operator+(const GenPoint<P>& lhs, const oln_dpoint(P)& rhs)
+ {
+ const P& lhs_ = force_exact<P>(lhs);
+ oln_point(P) tmp;
+ for (unsigned i = 0; i < P::dim; ++i)
+ tmp[i] = lhs_[i] + rhs[i];
+ return tmp;
+ }
+
+ template <typename P>
+ std::ostream& operator<<(std::ostream& ostr, const GenPoint<P>& p)
+ {
+ const P& p_ = force_exact<P>(p);
+ ostr << '(';
+ for (unsigned i = 0; i < P::dim; ++i)
+ {
+ ostr << p_[i]
+ << (i = P::dim - 1 ? ')' : ',');
+ }
+ return ostr;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_GENPOINT_HH
Index: milena/core/concept/piter.hh
--- milena/core/concept/piter.hh (revision 0)
+++ milena/core/concept/piter.hh (revision 0)
@@ -0,0 +1,45 @@
+#ifndef MLN_CORE_CONCEPT_PITER_HH
+# define MLN_CORE_CONCEPT_PITER_HH
+
+# include <core/concept/iterator.hh>
+# include <core/concept/genpoint.hh>
+
+
+namespace mln
+{
+
+ template <typename E>
+ struct Piter : public Iterator<E>,
+ public GenPoint<E>
+ {
+ /*
+ typedef psite;
+ typedef point;
+
+ operator psite() const;
+ operator point() const;
+ const point* pointer() const;
+ */
+
+ protected:
+ Piter();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ Piter<E>::Piter()
+ {
+ typedef oln_psite(E) psite;
+ typedef oln_point(E) point;
+ const point* (E::*m)() const = & E::pointer;
+ m = 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_PITER_HH
Index: milena/core/concept/point_set.hh
--- milena/core/concept/point_set.hh (revision 0)
+++ milena/core/concept/point_set.hh (revision 0)
@@ -0,0 +1,55 @@
+#ifndef MLN_CORE_CONCEPT_POINT_SET_HH
+# define MLN_CORE_CONCEPT_POINT_SET_HH
+
+# include <core/concept/point.hh>
+# include <core/concept/piter.hh>
+
+
+namespace mln
+{
+
+ template <typename E>
+ struct Point_Set : public Object<E>
+ {
+ /*
+ typedef point;
+ typedef psite;
+ typedef piter;
+ typedef fwd_piter;
+ typedef bkd_piter;
+
+ bool has(const psite& p) const;
+ const box_<point>& bbox() const;
+ */
+
+ protected:
+ Point_Set();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // fwd decl
+ template <typename P> struct box_;
+
+ template <typename E>
+ Point_Set<E>::Point_Set()
+ {
+ typedef oln_point(E) point;
+ typedef oln_psite(E) psite;
+ typedef oln_piter(E) piter;
+ typedef oln_fwd_piter(E) fwd_piter;
+ typedef oln_bkd_piter(E) bkd_piter;
+
+ bool (E::*m1)(const psite& p) const = & E::has;
+ m1 = 0;
+ const box_<point>& (E::*m2)() const = & E::bbox;
+ m2 = 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_POINT_SET_HH
Index: milena/core/concept/psite.hh
--- milena/core/concept/psite.hh (revision 0)
+++ milena/core/concept/psite.hh (revision 0)
@@ -0,0 +1,38 @@
+#ifndef MLN_CORE_CONCEPT_PSITE_HH
+# define MLN_CORE_CONCEPT_PSITE_HH
+
+# include <core/concept/genpoint.hh>
+
+
+namespace mln
+{
+
+ template <typename E>
+ struct Psite : public Object<E>,
+ public GenPoint<E>
+ {
+ /*
+ const point* pointer() const
+ {
+ return & (exact(this)->operator point());
+ }
+ */
+
+ protected:
+ Psite();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ Psite<E>::Psite()
+ {
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_PSITE_HH
Index: milena/core/concept/object.hh
--- milena/core/concept/object.hh (revision 0)
+++ milena/core/concept/object.hh (revision 0)
@@ -0,0 +1,37 @@
+#ifndef MLN_CORE_CONCEPT_OBJECT_HH
+# define MLN_CORE_CONCEPT_OBJECT_HH
+
+# include <cassert>
+# include <iostream>
+
+# include <core/macros.hh>
+
+
+namespace mln
+{
+
+ template <typename E>
+ struct Object
+ {
+ protected:
+ Object();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ Object<E>::Object()
+ {
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+# include <core/exact.hh>
+# include <core/ops.hh>
+
+
+#endif // ! MLN_CORE_CONCEPT_OBJECT_HH
Index: milena/core/concept/window.hh
--- milena/core/concept/window.hh (revision 0)
+++ milena/core/concept/window.hh (revision 0)
@@ -0,0 +1,50 @@
+#ifndef MLN_CORE_CONCEPT_WINDOW_HH
+# define MLN_CORE_CONCEPT_WINDOW_HH
+
+# include <core/concept/object.hh>
+
+
+namespace mln
+{
+
+ template <typename E>
+ struct Window : public Object<E>
+ {
+ /*
+ typedef qiter;
+ typedef fwd_qiter;
+ typedef bkd_qiter;
+
+ bool is_empty() const;
+ bool is_centered() const;
+ bool is_symmetric() const;
+ */
+
+ protected:
+ Window();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ Window<E>::Window()
+ {
+ typedef oln_qiter(E) qiter;
+ typedef oln_fwd_qiter(E) fwd_qiter;
+ typedef oln_bkd_qiter(E) bkd_qiter;
+
+ bool (E::*m1)() const = & E::is_empty;
+ m1 = 0;
+ bool (E::*m2)() const = & E::is_centered;
+ m2 = 0;
+ bool (E::*m3)() const = & E::is_symmetric;
+ m3 = 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_WINDOW_HH
Index: milena/core/concept/box.hh
--- milena/core/concept/box.hh (revision 0)
+++ milena/core/concept/box.hh (revision 0)
@@ -0,0 +1,48 @@
+#ifndef MLN_CORE_CONCEPT_BOX_HH
+# define MLN_CORE_CONCEPT_BOX_HH
+
+# include <core/concept/point_set.hh>
+
+
+namespace mln
+{
+
+ template <typename E>
+ struct Box : public Point_Set<E>
+ {
+ /*
+ const point& pmin() const;
+ const point& pmax() const;
+ */
+
+ const E& bbox() const; // final
+
+ protected:
+ Box();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ const E& Box<E>::bbox() const
+ {
+ return exact(*this);
+ }
+
+ template <typename E>
+ Box<E>::Box()
+ {
+ typedef oln_point(E) point;
+ point (E::*m1)() const = & E::pmin;
+ m1 = 0;
+ point (E::*m2)() const = & E::pmax;
+ m2 = 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_BOX_HH
Index: milena/core/concept/iterator.hh
--- milena/core/concept/iterator.hh (revision 0)
+++ milena/core/concept/iterator.hh (revision 0)
@@ -0,0 +1,58 @@
+#ifndef MLN_CORE_CONCEPT_ITERATOR_HH
+# define MLN_CORE_CONCEPT_ITERATOR_HH
+
+# include <core/concept/object.hh>
+
+
+# define for_all(x) for(x.start(); x.is_valid(); x.next())
+
+
+namespace mln
+{
+
+ template <typename E>
+ struct Iterator : public Object<E>
+ {
+ /*
+ bool is_valid() const;
+ void invalidate();
+ void start();
+ void next_();
+ */
+
+ void next(); // final
+
+ protected:
+ Iterator();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ void Iterator<E>::next() // final
+ {
+ assert(exact(this)->is_valid());
+ exact(this)->next_();
+ }
+
+ template <typename E>
+ Iterator<E>::Iterator()
+ {
+ bool (E::*m1)() const = & E::is_valid;
+ m1 = 0;
+ void (E::*m2)() = & E::invalidate;
+ m2 = 0;
+ void (E::*m3)() = & E::start;
+ m3 = 0;
+ void (E::*m4)() = & E::next_;
+ m4 = 0;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_ITERATOR_HH
Index: milena/core/concept/point.hh
--- milena/core/concept/point.hh (revision 0)
+++ milena/core/concept/point.hh (revision 0)
@@ -0,0 +1,65 @@
+#ifndef MLN_CORE_CONCEPT_POINT_HH
+# define MLN_CORE_CONCEPT_POINT_HH
+
+# include <core/concept/psite.hh>
+
+
+namespace mln
+{
+
+ template <typename P>
+ struct Point : public Psite<P>
+ {
+ // final
+ typedef P point;
+ const P* pointer() const;
+
+ protected:
+ Point();
+ };
+
+
+ template <typename P>
+ P& operator+=(Point<P>& lhs, const oln_dpoint(P)& rhs);
+
+ template <typename P>
+ P& operator-=(Point<P>& lhs, const oln_dpoint(P)& rhs);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename P>
+ Point<P>::Point()
+ {
+ }
+
+ template <typename P>
+ const P* Point<P>::pointer() const
+ {
+ return exact(this);
+ }
+
+ template <typename P>
+ P& operator+=(Point<P>& lhs, const oln_dpoint(P)& rhs)
+ {
+ for (unsigned i = 0; i < P::dim; ++i)
+ exact(lhs)[i] += rhs[i];
+ return lhs;
+ }
+
+ template <typename P>
+ P& operator-=(Point<P>& lhs, const oln_dpoint(P)& rhs)
+ {
+ for (unsigned i = 0; i < P::dim; ++i)
+ exact(lhs)[i] -= rhs[i];
+ return lhs;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+
+#endif // ! MLN_CORE_CONCEPT_POINT_HH
Index: milena/core/concept/dpoint.hh
--- milena/core/concept/dpoint.hh (revision 0)
+++ milena/core/concept/dpoint.hh (revision 0)
@@ -0,0 +1,99 @@
+#ifndef MLN_CORE_CONCEPT_DPOINT_HH
+# define MLN_CORE_CONCEPT_DPOINT_HH
+
+# include <core/concept/object.hh>
+
+
+namespace mln
+{
+
+
+ template <typename E>
+ struct Dpoint : public Object<E>
+ {
+ /*
+ typedef point;
+ typedef coord;
+ enum { dim };
+ coord operator[](unsigned i) const;
+ */
+
+ protected:
+ Dpoint();
+ };
+
+
+ template <typename D>
+ D operator-(const Dpoint<D>& dp);
+
+ template <typename Dl, typename Dr>
+ bool operator=(const Dpoint<Dl>& lhs, const Dpoint<Dr>& rhs);
+
+ template <typename Dl, typename Dr>
+ bool operator<(const Dpoint<Dl>& lhs, const Dpoint<Dr>& rhs);
+
+ template <typename D>
+ std::ostream& operator<<(std::ostream& ostr, const Dpoint<D>& dp);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ Dpoint<E>::Dpoint()
+ {
+ typedef oln_point(E) point;
+ typedef oln_coord(E) coord;
+ enum { dim = E::dim };
+ coord (E::*m)(unsigned i) const = & E::operator[];
+ m = 0;
+ }
+
+ template <typename D>
+ D operator-(const Dpoint<D>& dp)
+ {
+ D tmp;
+ for (unsigned i = 0; i < D::dim; ++i)
+ tmp[i] = - exact(dp)[i];
+ return tmp;
+ }
+
+ template <typename Dl, typename Dr>
+ bool operator=(const Dpoint<Dl>& lhs, const Dpoint<Dr>& rhs)
+ {
+ for (unsigned i = 0; i < Dl::dim; ++i)
+ if (exact(lhs)[i] != exact(rhs)[i])
+ return false;
+ return true;
+ }
+
+ template <typename Dl, typename Dr>
+ bool operator<(const Dpoint<Dl>& lhs, const Dpoint<Dr>& rhs)
+ {
+ for (unsigned i = 0; i < Dl::dim; ++i)
+ {
+ if (exact(lhs)[i] = exact(rhs)[i])
+ continue;
+ return exact(lhs)[i] < exact(rhs)[i];
+ }
+ return false;
+ }
+
+ template <typename D>
+ std::ostream& operator<<(std::ostream& ostr, const Dpoint<D>& dp)
+ {
+ ostr << '(';
+ for (unsigned i = 0; i < D::dim; ++i)
+ {
+ ostr << exact(dp)[i]
+ << (i = D::dim - 1 ? ')' : ',');
+ }
+ return ostr;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_DPOINT_HH
Index: milena/core/window2d.hh
--- milena/core/window2d.hh (revision 0)
+++ milena/core/window2d.hh (revision 0)
@@ -0,0 +1,39 @@
+#ifndef MLN_CORE_WINDOW2D_HH
+# define MLN_CORE_WINDOW2D_HH
+
+# include <cmath>
+# include <core/window.hh>
+# include <core/dpoint2d.hh>
+
+
+namespace mln
+{
+
+ typedef window_<dpoint2d> window2d;
+
+ template <unsigned M>
+ window2d mk_window2d(const bool (&values)[M]);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <unsigned M>
+ window2d mk_window2d(const bool (&values)[M])
+ {
+ int h = unsigned(std::sqrt(float(M))) / 2;
+ assert((2 * h + 1) * (2 * h + 1) = M);
+ window2d tmp;
+ unsigned i = 0;
+ for (int row = - h; row <= h; ++row)
+ for (int col = - h; col <= h; ++col)
+ if (values[i++])
+ tmp.insert(mk_dpoint2d(row, col));
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_WINDOW2D_HH
Index: milena/core/ops.hh
--- milena/core/ops.hh (revision 0)
+++ milena/core/ops.hh (revision 0)
@@ -0,0 +1,56 @@
+#ifndef MLN_CORE_OPS_HH
+# define MLN_CORE_OPS_HH
+
+# include <core/concept/object.hh>
+# include <core/exact.hh>
+
+
+namespace mln
+{
+
+ template <typename O1, typename O2>
+ bool operator!=(const Object<O1>& lhs, const Object<O2>& rhs);
+
+ template <typename O1, typename O2>
+ bool operator>(const Object<O1>& lhs, const Object<O2>& rhs);
+
+ template <typename O1, typename O2>
+ bool operator>=(const Object<O1>& lhs, const Object<O2>& rhs);
+
+ template <typename O1, typename O2>
+ bool operator<=(const Object<O1>& lhs, const Object<O2>& rhs);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename O1, typename O2>
+ bool operator!=(const Object<O1>& lhs, const Object<O2>& rhs)
+ {
+ return not (exact(lhs) = exact(rhs));
+ }
+
+ template <typename O1, typename O2>
+ bool operator>(const Object<O1>& lhs, const Object<O2>& rhs)
+ {
+ return exact(rhs) < exact(lhs);
+ }
+
+ template <typename O1, typename O2>
+ bool operator>=(const Object<O1>& lhs, const Object<O2>& rhs)
+ {
+ return exact(rhs) <= exact(lhs);
+ }
+
+ template <typename O1, typename O2>
+ bool operator<=(const Object<O1>& lhs, const Object<O2>& rhs)
+ {
+ // if partial ordering, this operator should be re-defined!
+ return not exact(rhs) < exact(lhs);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_OPS_HH
Index: milena/core/exact.hh
--- milena/core/exact.hh (revision 0)
+++ milena/core/exact.hh (revision 0)
@@ -0,0 +1,100 @@
+#ifndef MLN_CORE_EXACT_HH
+# define MLN_CORE_EXACT_HH
+
+# include <core/concept/object.hh>
+
+
+namespace mln
+{
+
+ // exact
+
+ template <typename E>
+ E* exact(Object<E>* ptr);
+
+ template <typename E>
+ const E* exact(const Object<E>* ptr);
+
+ template <typename E>
+ E& exact(Object<E>& ref);
+
+ template <typename E>
+ const E& exact(const Object<E>& ref);
+
+
+ // force_exact
+
+ template <typename E, typename O>
+ E* force_exact(O* ptr);
+
+ template <typename E, typename O>
+ const E* force_exact(const O* ptr);
+
+ template <typename E, typename O>
+ E& force_exact(O& ref);
+
+ template <typename E, typename O>
+ const E& force_exact(const O& ref);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // exact
+
+ template <typename E>
+ E* exact(Object<E>* ptr)
+ {
+ return (E*)(void*)ptr;
+ }
+
+ template <typename E>
+ const E* exact(const Object<E>* ptr)
+ {
+ return (const E*)(const void*)ptr;
+ }
+
+ template <typename E>
+ E& exact(Object<E>& ref)
+ {
+ return *(E*)(void*)(&ref);
+ }
+
+ template <typename E>
+ const E& exact(const Object<E>& ref)
+ {
+ return *(const E*)(const void*)(&ref);
+ }
+
+ // force_exact
+
+ template <typename E, typename O>
+ E* force_exact(O* ptr)
+ {
+ return (E*)(void*)ptr;
+ }
+
+ template <typename E, typename O>
+ const E* force_exact(const O* ptr)
+ {
+ return (const E*)(const void*)ptr;
+ }
+
+ template <typename E, typename O>
+ E& force_exact(O& ref)
+ {
+ return *(E*)(void*)(&ref);
+ }
+
+ template <typename E, typename O>
+ const E& force_exact(const O& ref)
+ {
+ return *(const E*)(const void*)(&ref);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_EXACT_HH
Index: milena/core/window.hh
--- milena/core/window.hh (revision 0)
+++ milena/core/window.hh (revision 0)
@@ -0,0 +1,76 @@
+#ifndef MLN_CORE_WINDOW_HH
+# define MLN_CORE_WINDOW_HH
+
+# include <core/concept/window.hh>
+# include <core/internal/set_of.hh>
+# include <core/dpoint.hh>
+
+
+namespace mln
+{
+
+ // fwd decls
+ template <typename D> class dpoints_fwd_qiter;
+ template <typename D> class dpoints_bkd_qiter;
+
+
+ template <typename D>
+ struct window_ : public Window< window_<D> >,
+ public internal::set_of_<D>
+ {
+ typedef dpoints_fwd_qiter<D> fwd_qiter;
+ typedef dpoints_bkd_qiter<D> bkd_qiter;
+ typedef fwd_qiter qiter;
+
+ window_();
+
+ bool is_centered() const;
+ bool is_symmetric() const;
+ };
+
+ template <typename D>
+ std::ostream& operator<<(std::ostream& ostr,
+ const window_<D>& win);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename D>
+ window_<D>::window_()
+ {
+ }
+
+ template <typename D>
+ bool window_<D>::is_centered() const
+ {
+ static const D origin(0);
+ return this->has(origin);
+ }
+
+ template <typename D>
+ bool window_<D>::is_symmetric() const
+ {
+ assert(0); // FIXME: nyi!
+ return false;
+ }
+
+ template <typename D>
+ std::ostream& operator<<(std::ostream& ostr,
+ const window_<D>& win)
+ {
+ ostr << '[';
+ for (unsigned i = 0; i < win.nelements(); ++i)
+ ostr << win.element(i)
+ << (i = win.nelements() - 1 ? ']' : ',');
+ return ostr;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+# include <core/dpoints_qiter.hh>
+
+
+#endif // ! MLN_CORE_WINDOW_HH
Index: milena/core/image2d.hh
--- milena/core/image2d.hh (revision 0)
+++ milena/core/image2d.hh (revision 0)
@@ -0,0 +1,147 @@
+#ifndef MLN_CORE_IMAGE2D_HH
+# define MLN_CORE_IMAGE2D_HH
+
+# include <core/internal/image_base.hh>
+# include <core/box2d.hh>
+
+
+namespace mln
+{
+
+ template <typename T>
+ struct image2d : public internal::image_base_< box2d, image2d<T> >
+ {
+ typedef T value;
+ typedef const T& rvalue;
+ typedef T& lvalue;
+
+ image2d();
+ image2d(int nrows, int ncols);
+ image2d(const box2d& b);
+
+ bool has_data() const;
+ const box2d& domain() const;
+
+ const T& operator()(const point2d& p) const;
+ T& operator()(const point2d& p);
+
+ ~image2d();
+
+ private:
+
+ box2d b_;
+ T* buffer_;
+ T** array_;
+
+ void allocate_();
+ void deallocate_();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // ctors
+
+ template <typename T>
+ image2d<T>::image2d()
+ {
+ buffer_ = 0;
+ array_ = 0;
+ }
+
+ template <typename T>
+ image2d<T>::image2d(int nrows, int ncols)
+ {
+ b_ = mk_box2d(nrows, ncols);
+ allocate_();
+ }
+
+ template <typename T>
+ image2d<T>::image2d(const box2d& b)
+ : b_(b)
+ {
+ allocate_();
+ }
+
+ // methods
+
+ template <typename T>
+ bool
+ image2d<T>::has_data() const
+ {
+ return buffer_ != 0 and array_ != 0;
+ }
+
+ template <typename T>
+ const box2d&
+ image2d<T>::domain() const
+ {
+ return b_;
+ }
+
+ template <typename T>
+ const T&
+ image2d<T>::operator()(const point2d& p) const
+ {
+ assert(this->has_data() and this->owns_(p));
+ return array_[p.row()][p.col()];
+ }
+
+ template <typename T>
+ T&
+ image2d<T>::operator()(const point2d& p)
+ {
+ assert(this->has_data() and this->owns_(p));
+ return array_[p.row()][p.col()];
+ }
+
+ template <typename T>
+ image2d<T>::~image2d()
+ {
+ deallocate_();
+ }
+
+ // private
+
+ template <typename T>
+ void
+ image2d<T>::allocate_()
+ {
+ unsigned
+ nrows = 1 + b_.pmax().row() - b_.pmin().row(),
+ ncols = 1 + b_.pmax().col() - b_.pmin().col(),
+ len = nrows * ncols;
+ buffer_ = new T[len];
+ array_ = new T*[nrows];
+ T* buf = buffer_ - b_.pmin().col();
+ for (unsigned i = 0; i < nrows; ++i)
+ {
+ array_[i] = buf;
+ buf += ncols;
+ }
+ array_ -= b_.pmin().row();
+ }
+
+ template <typename T>
+ void
+ image2d<T>::deallocate_()
+ {
+ if (buffer_)
+ {
+ delete[] buffer_;
+ buffer_ = 0;
+ }
+ if (array_)
+ {
+ array_ += b_.pmin().row();
+ delete[] array_;
+ array_ = 0;
+ }
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_IMAGE2D_HH
Index: milena/core/vec.hh
--- milena/core/vec.hh (revision 0)
+++ milena/core/vec.hh (revision 0)
@@ -0,0 +1,35 @@
+#ifndef MLN_CORE_VEC_HH
+# define MLN_CORE_VEC_HH
+
+# include <core/concept/object.hh>
+
+
+namespace mln
+{
+
+ template <unsigned n, typename T>
+ struct vec : public Object< vec<n,T> >
+ {
+ enum { dim = n };
+ typedef T coord;
+
+ T& operator[](unsigned i)
+ {
+ assert(i < n);
+ return coord_[i];
+ }
+
+ T operator[](unsigned i) const
+ {
+ assert(i < n);
+ return coord_[i];
+ }
+
+ protected:
+ T coord_[n];
+ };
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_VEC_HH
Index: milena/core/internal/coord_impl.hh
--- milena/core/internal/coord_impl.hh (revision 0)
+++ milena/core/internal/coord_impl.hh (revision 0)
@@ -0,0 +1,207 @@
+#ifndef MLN_CORE_INTERNAL_COORD_IMPL_HH
+# define MLN_CORE_INTERNAL_COORD_IMPL_HH
+
+# include <core/concept/object.hh>
+
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+ // coord_impl
+
+ template <unsigned n, typename C, typename E>
+ struct coord_impl_;
+
+ template <typename C, typename E>
+ struct coord_impl_<1, C, E>
+ {
+ C ind() const;
+ };
+
+ template <typename C, typename E>
+ struct coord_impl_<2, C, E>
+ {
+ C row() const;
+ C col() const;
+ };
+
+ template <typename C, typename E>
+ struct coord_impl_<3, C, E>
+ {
+ C sli() const;
+ C row() const;
+ C col() const;
+ };
+
+
+ // mutable_coord_impl
+
+ template <unsigned n, typename C, typename E>
+ struct mutable_coord_impl_;
+
+ template <typename C, typename E>
+ struct mutable_coord_impl_<1, C, E>
+ {
+ C ind() const;
+ C& ind();
+ };
+
+ template <typename C, typename E>
+ struct mutable_coord_impl_<2, C, E>
+ {
+ C row() const;
+ C& row();
+ C col() const;
+ C& col();
+ };
+
+ template <typename C, typename E>
+ struct mutable_coord_impl_<3, C, E>
+ {
+ C sli() const;
+ C& sli();
+ C row() const;
+ C& row();
+ C col() const;
+ C& col();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // coord_impl
+
+ // 1
+
+ template <typename C, typename E>
+ C coord_impl_<1, C, E>::ind() const
+ {
+ return force_exact<E>(*this)[0];
+ }
+
+ // 2
+
+ template <typename C, typename E>
+ C coord_impl_<2, C, E>::row() const
+ {
+ return force_exact<E>(*this)[0];
+ }
+
+ template <typename C, typename E>
+ C coord_impl_<2, C, E>::col() const
+ {
+ return force_exact<E>(*this)[1];
+ }
+
+ // 3
+
+ template <typename C, typename E>
+ C coord_impl_<3, C, E>::sli() const
+ {
+ return force_exact<E>(*this)[0];
+ }
+
+ template <typename C, typename E>
+ C coord_impl_<3, C, E>::row() const
+ {
+ return force_exact<E>(*this)[1];
+ }
+
+ template <typename C, typename E>
+ C coord_impl_<3, C, E>::col() const
+ {
+ return force_exact<E>(*this)[2];
+ }
+
+
+ // mutable_coord_impl
+
+ // 1
+
+ template <typename C, typename E>
+ C mutable_coord_impl_<1, C, E>::ind() const
+ {
+ return force_exact<E>(*this)[0];
+ }
+
+ template <typename C, typename E>
+ C& mutable_coord_impl_<1, C, E>::ind()
+ {
+ return force_exact<E>(*this)[0];
+ }
+
+ // 2
+
+ template <typename C, typename E>
+ C mutable_coord_impl_<2, C, E>::row() const
+ {
+ return force_exact<E>(*this)[0];
+ }
+
+ template <typename C, typename E>
+ C& mutable_coord_impl_<2, C, E>::row()
+ {
+ return force_exact<E>(*this)[0];
+ }
+
+ template <typename C, typename E>
+ C mutable_coord_impl_<2, C, E>::col() const
+ {
+ return force_exact<E>(*this)[1];
+ }
+
+ template <typename C, typename E>
+ C& mutable_coord_impl_<2, C, E>::col()
+ {
+ return force_exact<E>(*this)[1];
+ }
+
+ // 3
+
+ template <typename C, typename E>
+ C mutable_coord_impl_<3, C, E>::sli() const
+ {
+ return force_exact<E>(*this)[0];
+ }
+
+ template <typename C, typename E>
+ C& mutable_coord_impl_<3, C, E>::sli()
+ {
+ return force_exact<E>(*this)[0];
+ }
+
+ template <typename C, typename E>
+ C mutable_coord_impl_<3, C, E>::row() const
+ {
+ return force_exact<E>(*this)[1];
+ }
+
+ template <typename C, typename E>
+ C& mutable_coord_impl_<3, C, E>::row()
+ {
+ return force_exact<E>(*this)[1];
+ }
+
+ template <typename C, typename E>
+ C mutable_coord_impl_<3, C, E>::col() const
+ {
+ return force_exact<E>(*this)[2];
+ }
+
+ template <typename C, typename E>
+ C& mutable_coord_impl_<3, C, E>::col()
+ {
+ return force_exact<E>(*this)[2];
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_INTERNAL_COORD_IMPL_HH
Index: milena/core/internal/image_adaptor.hh
--- milena/core/internal/image_adaptor.hh (revision 0)
+++ milena/core/internal/image_adaptor.hh (revision 0)
@@ -0,0 +1,87 @@
+#ifndef MLN_CORE_INTERNAL_IMAGE_ADAPTOR_HH
+# define MLN_CORE_INTERNAL_IMAGE_ADAPTOR_HH
+
+# include <core/internal/image_base.hh>
+
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+ template <typename I, typename E>
+ struct image_adaptor_ : public internal::image_base_< oln_pset(I), E >
+ {
+ typedef oln_psite(I) psite;
+ typedef oln_pset(I) pset;
+
+ typedef oln_value(I) value;
+ typedef oln_rvalue(I) rvalue;
+ typedef oln_lvalue(I) lvalue;
+
+ bool has_data() const;
+
+ bool owns_(const psite& p) const;
+ const pset& domain() const;
+
+ rvalue operator()(const psite& p) const;
+ lvalue operator()(const psite& p);
+
+ protected:
+ I& adaptee_;
+ image_adaptor_(Image<I>& adaptee);
+ };
+
+ // FIXME: image_const_adaptor_
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename I, typename E>
+ bool image_adaptor_<I,E>::has_data() const
+ {
+ return adaptee_.has_data();
+ }
+
+ template <typename I, typename E>
+ bool image_adaptor_<I,E>::owns_(const psite& p) const
+ {
+ return adaptee_.owns_(p);
+ }
+
+ template <typename I, typename E>
+ const oln_pset(I)&
+ image_adaptor_<I,E>::domain() const
+ {
+ return adaptee_.domain();
+ }
+
+ template <typename I, typename E>
+ oln_rvalue(I)
+ image_adaptor_<I,E>::operator()(const psite& p) const
+ {
+ return adaptee_(p);
+ }
+
+ template <typename I, typename E>
+ oln_lvalue(I)
+ image_adaptor_<I,E>::operator()(const psite& p)
+ {
+ return adaptee_(p);
+ }
+
+ template <typename I, typename E>
+ image_adaptor_<I,E>::image_adaptor_(Image<I>& adaptee)
+ : adaptee_(exact(adaptee))
+ {
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_INTERNAL_IMAGE_ADAPTOR_HH
Index: milena/core/internal/image_base.hh
--- milena/core/internal/image_base.hh (revision 0)
+++ milena/core/internal/image_base.hh (revision 0)
@@ -0,0 +1,68 @@
+#ifndef MLN_CORE_INTERNAL_IMAGE_BASE_HH
+# define MLN_CORE_INTERNAL_IMAGE_BASE_HH
+
+# include <core/concept/image.hh>
+
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+ template <typename S, typename E>
+ struct image_base_ : public Image<E>
+ {
+ typedef S pset;
+ typedef oln_psite(S) psite;
+ typedef oln_point(S) point;
+
+ typedef oln_fwd_piter(S) fwd_piter;
+ typedef oln_bkd_piter(S) bkd_piter;
+ typedef fwd_piter piter;
+
+ bool has(const psite& p) const;
+ bool owns_(const psite& p) const; // default
+ const box_<point>& bbox() const;
+
+ protected:
+ image_base_();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename S, typename E>
+ bool
+ image_base_<S,E>::has(const psite& p) const
+ {
+ return exact(this)->domain().has(p);
+ }
+
+ template <typename S, typename E>
+ bool
+ image_base_<S,E>::owns_(const psite& p) const // default
+ {
+ return this->has(p);
+ }
+
+ template <typename S, typename E>
+ const box_<oln_point(S)>&
+ image_base_<S,E>::bbox() const
+ {
+ return exact(this)->domain().bbox();
+ }
+
+ template <typename S, typename E>
+ image_base_<S,E>::image_base_()
+ {
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_INTERNAL_IMAGE_BASE_HH
Index: milena/core/internal/set_of.hh
--- milena/core/internal/set_of.hh (revision 0)
+++ milena/core/internal/set_of.hh (revision 0)
@@ -0,0 +1,108 @@
+#ifndef MLN_CORE_INTERNAL_SET_OF_HH
+# define MLN_CORE_INTERNAL_SET_OF_HH
+
+# include <vector>
+# include <set>
+# include <iterator>
+
+
+namespace mln
+{
+
+ namespace internal
+ {
+
+ template <typename E>
+ class set_of_
+ {
+ public:
+
+ void insert(const E& elt);
+ const E& element(unsigned i) const;
+ unsigned nelements() const;
+ bool has(const E& elt) const;
+ bool is_empty() const;
+ void clear();
+
+ const std::vector<E>& vec() const;
+
+ protected:
+ std::vector<E> v_;
+
+ private:
+ std::set<E> s_;
+ void update_();
+
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ void
+ set_of_<E>::insert(const E& elt)
+ {
+ s_.insert(elt);
+ update_();
+ }
+
+ template <typename E>
+ const E&
+ set_of_<E>::element(unsigned i) const
+ {
+ assert(i < v_.size());
+ return v_[i];
+ }
+
+ template <typename E>
+ unsigned
+ set_of_<E>::nelements() const
+ {
+ return v_.size();
+ }
+
+ template <typename E>
+ bool
+ set_of_<E>::has(const E& elt) const
+ {
+ return s_.find(elt) != s_.end();
+ }
+
+ template <typename E>
+ bool
+ set_of_<E>::is_empty() const
+ {
+ return v_.size() = 0;
+ }
+
+ template <typename E>
+ void
+ set_of_<E>::clear()
+ {
+ v_.clear();
+ s_.clear();
+ }
+
+ template <typename E>
+ const std::vector<E>&
+ set_of_<E>::vec() const
+ {
+ return v_;
+ }
+
+ template <typename E>
+ void
+ set_of_<E>::update_()
+ {
+ v_.clear();
+ std::copy(s_.begin(), s_.end(), std::back_inserter(v_));
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::internal
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_INTERNAL_SET_OF_HH
Index: milena/core/box2d.hh
--- milena/core/box2d.hh (revision 0)
+++ milena/core/box2d.hh (revision 0)
@@ -0,0 +1,31 @@
+#ifndef MLN_CORE_BOX2D_HH
+# define MLN_CORE_BOX2D_HH
+
+# include <core/box.hh>
+# include <core/point2d.hh>
+
+
+namespace mln
+{
+
+ typedef box_<point2d> box2d;
+
+ box2d mk_box2d(unsigned nrows, unsigned ncols)
+ {
+ box2d tmp(mk_point2d(0, 0),
+ mk_point2d(nrows - 1, ncols - 1));
+ return tmp;
+ }
+
+ box2d mk_box2d(int min_row, int max_row,
+ int min_col, int max_col)
+ {
+ box2d tmp(mk_point2d(min_row, min_col),
+ mk_point2d(max_row, max_col));
+ return tmp;
+ }
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_BOX2D_HH
Index: milena/core/point2d.hh
--- milena/core/point2d.hh (revision 0)
+++ milena/core/point2d.hh (revision 0)
@@ -0,0 +1,26 @@
+#ifndef MLN_CORE_POINT2D_HH
+# define MLN_CORE_POINT2D_HH
+
+# include <core/point.hh>
+
+
+namespace mln
+{
+
+ typedef point_<2,int> point2d;
+
+ point2d mk_point2d(int row, int col)
+ {
+ point2d tmp;
+ tmp[0] = row;
+ tmp[1] = col;
+ return tmp;
+ }
+
+} // end of namespace mln
+
+
+# include <core/dpoint2d.hh>
+
+
+#endif // ! MLN_CORE_POINT2D_HH
Index: milena/core/safe_image.hh
--- milena/core/safe_image.hh (revision 0)
+++ milena/core/safe_image.hh (revision 0)
@@ -0,0 +1,70 @@
+#ifndef MLN_CORE_SAFE_IMAGE_HH
+# define MLN_CORE_SAFE_IMAGE_HH
+
+# include <core/internal/image_adaptor.hh>
+
+
+namespace mln
+{
+
+
+ template <typename I>
+ struct safe_image : public internal::image_adaptor_< I, safe_image<I> >
+ {
+ typedef internal::image_adaptor_< I, safe_image<I> > super;
+
+ safe_image(Image<I>& ima);
+
+ oln_rvalue(I) operator()(const oln_psite(I)& p) const;
+ oln_lvalue(I) operator()(const oln_psite(I)& p);
+ };
+
+
+
+ template <typename I>
+ safe_image<I> safe(Image<I>& ima);
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I>
+ safe_image<I>::safe_image(Image<I>& ima)
+ : super(ima)
+ {
+ }
+
+ template <typename I>
+ oln_rvalue(I)
+ safe_image<I>::operator()(const oln_psite(I)& p) const
+ {
+ static oln_value(I) tmp;
+ if (not this->owns_(p))
+ return tmp;
+ return this->adaptee_(p);
+ }
+
+ template <typename I>
+ oln_lvalue(I)
+ safe_image<I>::operator()(const oln_psite(I)& p)
+ {
+ static oln_value(I) tmp;
+ if (not this->owns_(p))
+ return tmp;
+ return this->adaptee_(p);
+ }
+
+ template <typename I>
+ safe_image<I> safe(Image<I>& ima)
+ {
+ safe_image<I> tmp(ima);
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_SAFE_IMAGE_HH
Index: milena/mlc/equal.hh
--- milena/mlc/equal.hh (revision 0)
+++ milena/mlc/equal.hh (revision 0)
@@ -0,0 +1,30 @@
+#ifndef MLN_MLC_EQUAL_HH
+# define MLN_MLC_EQUAL_HH
+
+# include <core/concept/genpoint.hh>
+
+
+namespace mln
+{
+
+ namespace mlc
+ {
+
+ template <typename T1, typename T2>
+ struct equal
+ {
+ };
+
+ template <typename T>
+ struct equal< T, T >
+ {
+ static void check() {}
+ };
+
+
+ } // end of namespace mln::mlc
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MLC_EQUAL_HH
Index: milena/mlc/same_point.hh
--- milena/mlc/same_point.hh (revision 0)
+++ milena/mlc/same_point.hh (revision 0)
@@ -0,0 +1,24 @@
+#ifndef MLN_MLC_SAME_POINT_HH
+# define MLN_MLC_SAME_POINT_HH
+
+# include <mlc/equal.hh>
+# include <core/macros.hh>
+
+
+namespace mln
+{
+
+ namespace mlc
+ {
+
+ template <typename T1, typename T2>
+ struct same_point : mlc::equal<oln_point(T2), oln_point(T2)>
+ {
+ };
+
+ } // end of namespace mln::mlc
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MLC_SAME_POINT_HH
Index: milena/README
--- milena/README (revision 0)
+++ milena/README (revision 0)
@@ -0,0 +1,14 @@
+
+Object
+ |
+ | GenPoint
+ | |
+ + -- Psite
+ | |
+ | + -- Point
+ |
+ + -- Iterator
+ | |
+ | | GenPoint
+ | | |
+ | + -- Piter
2
1
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add milena neighborhood.
* milena/test/main.cc: Update.
* milena/core/neighb2d.hh: New.
* milena/core/neighb.hh: New.
* milena/core/concept/neighborhood.hh: New.
* milena/core/dpoints_qiter.hh: Rename as...
* milena/core/dpoints_piter.hh: ...this.
* milena/core/internal/set_of.hh (operator<<): New;
factor code.
* milena/core/rectangle2d.hh: Update.
* milena/core/window.hh: Update.
core/concept/neighborhood.hh | 39 +++++++++++++++++++++
core/dpoints_piter.hh | 28 +++++++--------
core/internal/set_of.hh | 15 ++++++++
core/neighb.hh | 56 ++++++++++++++++++++++++++++++
core/neighb2d.hh | 79 +++++++++++++++++++++++++++++++++++++++++++
core/rectangle2d.hh | 6 +--
core/window.hh | 25 ++-----------
test/main.cc | 5 ++
8 files changed, 216 insertions(+), 37 deletions(-)
Index: milena/test/main.cc
--- milena/test/main.cc (revision 985)
+++ milena/test/main.cc (working copy)
@@ -7,6 +7,8 @@
#include <core/window2d.hh>
#include <core/rectangle2d.hh>
+#include <core/neighb2d.hh>
+
#include <morpho/erosion.hh>
@@ -29,6 +31,8 @@
0, 1, 0,
1, 0, 0 };
window2d win = mk_window2d(w);
+ std::cout << win << std::endl;
+ std::cout << c8() << std::endl;
/*
{
@@ -56,4 +60,5 @@
image2d<int> ima2 = morpho::erosion(ima, win);
debug::println(ima2);
}
+
}
Index: milena/core/neighb2d.hh
--- milena/core/neighb2d.hh (revision 0)
+++ milena/core/neighb2d.hh (revision 0)
@@ -0,0 +1,79 @@
+#ifndef MLN_CORE_NEIGHB2D_HH
+# define MLN_CORE_NEIGHB2D_HH
+
+# include <cmath>
+# include <core/neighb.hh>
+# include <core/dpoint2d.hh>
+
+
+namespace mln
+{
+
+ typedef neighb_<dpoint2d> neighb2d;
+
+ const neighb2d& c4();
+ const neighb2d& c8();
+ const neighb2d& c2_row();
+ const neighb2d& c2_col();
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ const neighb2d& c4()
+ {
+ static bool flower = true;
+ static neighb2d it;
+ if (flower)
+ {
+ it.insert(mk_dpoint2d(0, 1));
+ it.insert(mk_dpoint2d(1, 0));
+ flower = false;
+ }
+ return it;
+ }
+
+ const neighb2d& c8()
+ {
+ static bool flower = true;
+ static neighb2d it;
+ if (flower)
+ {
+ it.insert(mk_dpoint2d(0, 1));
+ it.insert(mk_dpoint2d(1,-1));
+ it.insert(mk_dpoint2d(1, 0));
+ it.insert(mk_dpoint2d(1, 1));
+ flower = false;
+ }
+ return it;
+ }
+
+ const neighb2d& c2_row()
+ {
+ static bool flower = true;
+ static neighb2d it;
+ if (flower)
+ {
+ it.insert(mk_dpoint2d(0, 1));
+ flower = false;
+ }
+ return it;
+ }
+
+ const neighb2d& c2_col()
+ {
+ static bool flower = true;
+ static neighb2d it;
+ if (flower)
+ {
+ it.insert(mk_dpoint2d(1, 0));
+ flower = false;
+ }
+ return it;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_NEIGHB2D_HH
Index: milena/core/dpoints_piter.hh
--- milena/core/dpoints_piter.hh (revision 985)
+++ milena/core/dpoints_piter.hh (working copy)
@@ -1,5 +1,5 @@
-#ifndef MLN_CORE_DPOINTS_QITER_HH
-# define MLN_CORE_DPOINTS_QITER_HH
+#ifndef MLN_CORE_DPOINTS_PITER_HH
+# define MLN_CORE_DPOINTS_PITER_HH
# include <core/concept/piter.hh>
# include <core/concept/genpoint.hh>
@@ -9,7 +9,7 @@
{
template <typename D>
- class dpoints_fwd_qiter : public Piter< dpoints_fwd_qiter<D> >
+ class dpoints_fwd_piter : public Piter< dpoints_fwd_piter<D> >
{
public:
@@ -21,7 +21,7 @@
typedef mln_coord(D) coord;
template <typename Dps, typename Pref>
- dpoints_fwd_qiter(const Dps& dps,
+ dpoints_fwd_piter(const Dps& dps,
const GenPoint<Pref>& p_ref);
operator point() const;
@@ -48,7 +48,7 @@
template <typename D>
template <typename Dps, typename Pref>
- dpoints_fwd_qiter<D>::dpoints_fwd_qiter(const Dps& dps,
+ dpoints_fwd_piter<D>::dpoints_fwd_piter(const Dps& dps,
const GenPoint<Pref>& p_ref)
: dps_(exact(dps).vec()),
p_ref_(* force_exact<Pref>(p_ref).pointer())
@@ -57,7 +57,7 @@
}
template <typename D>
- dpoints_fwd_qiter<D>::operator mln_point(D)() const
+ dpoints_fwd_piter<D>::operator mln_point(D)() const
{
assert(is_valid());
return p_;
@@ -65,28 +65,28 @@
template <typename D>
const mln_point(D)*
- dpoints_fwd_qiter<D>::pointer() const
+ dpoints_fwd_piter<D>::pointer() const
{
return & p_;
}
template <typename D>
bool
- dpoints_fwd_qiter<D>::is_valid() const
+ dpoints_fwd_piter<D>::is_valid() const
{
return i_ != dps_.size();
}
template <typename D>
void
- dpoints_fwd_qiter<D>::invalidate()
+ dpoints_fwd_piter<D>::invalidate()
{
i_ = dps_.size();
}
template <typename D>
void
- dpoints_fwd_qiter<D>::start()
+ dpoints_fwd_piter<D>::start()
{
i_ = 0;
update_p_();
@@ -94,7 +94,7 @@
template <typename D>
void
- dpoints_fwd_qiter<D>::next_()
+ dpoints_fwd_piter<D>::next_()
{
++i_;
update_p_();
@@ -102,7 +102,7 @@
template <typename D>
void
- dpoints_fwd_qiter<D>::update_p_()
+ dpoints_fwd_piter<D>::update_p_()
{
if (is_valid())
p_ = p_ref_ + dps_[i_];
@@ -110,7 +110,7 @@
template <typename D>
mln_coord(D)
- dpoints_fwd_qiter<D>::operator[](unsigned i) const
+ dpoints_fwd_piter<D>::operator[](unsigned i) const
{
return p_[i];
}
@@ -120,4 +120,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_DPOINTS_QITER_HH
+#endif // ! MLN_CORE_DPOINTS_PITER_HH
Index: milena/core/rectangle2d.hh
--- milena/core/rectangle2d.hh (revision 985)
+++ milena/core/rectangle2d.hh (working copy)
@@ -4,7 +4,7 @@
# include <core/concept/window.hh>
# include <core/internal/set_of.hh>
# include <core/dpoint2d.hh>
-# include <core/dpoints_qiter.hh>
+# include <core/dpoints_piter.hh>
namespace mln
@@ -13,8 +13,8 @@
struct rectangle2d : public Window< rectangle2d >,
public internal::set_of_<dpoint2d>
{
- typedef dpoints_fwd_qiter<dpoint2d> fwd_qiter;
- typedef dpoints_bkd_qiter<dpoint2d> bkd_qiter;
+ typedef dpoints_fwd_piter<dpoint2d> fwd_qiter;
+ typedef dpoints_bkd_piter<dpoint2d> bkd_qiter;
typedef fwd_qiter qiter;
rectangle2d(unsigned half_height, unsigned half_width);
Index: milena/core/neighb.hh
--- milena/core/neighb.hh (revision 0)
+++ milena/core/neighb.hh (revision 0)
@@ -0,0 +1,56 @@
+#ifndef MLN_CORE_NEIGHB_HH
+# define MLN_CORE_NEIGHB_HH
+
+# include <core/concept/neighborhood.hh>
+# include <core/internal/set_of.hh>
+# include <core/dpoint.hh>
+
+
+namespace mln
+{
+
+ // fwd decls
+ template <typename D> class dpoints_fwd_piter;
+ template <typename D> class dpoints_bkd_piter;
+
+
+ template <typename D>
+ struct neighb_ : public Neighborhood< neighb_<D> >,
+ public internal::set_of_<D>
+ {
+ typedef dpoints_fwd_piter<D> fwd_niter;
+ typedef dpoints_bkd_piter<D> bkd_niter;
+ typedef fwd_niter niter;
+
+ neighb_();
+
+ void insert(const D& dp);
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename D>
+ neighb_<D>::neighb_()
+ {
+ }
+
+ template <typename D>
+ void
+ neighb_<D>::insert(const D& dp)
+ {
+ typedef internal::set_of_<D> super;
+ this->super::insert( dp);
+ this->super::insert(-dp);
+ }
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+# include <core/dpoints_piter.hh>
+
+
+#endif // ! MLN_CORE_NEIGHB_HH
Index: milena/core/concept/neighborhood.hh
--- milena/core/concept/neighborhood.hh (revision 0)
+++ milena/core/concept/neighborhood.hh (revision 0)
@@ -0,0 +1,39 @@
+#ifndef MLN_CORE_CONCEPT_NEIGHBORHOOD_HH
+# define MLN_CORE_CONCEPT_NEIGHBORHOOD_HH
+
+# include <core/concept/object.hh>
+
+
+namespace mln
+{
+
+ template <typename E>
+ struct Neighborhood : public Object<E>
+ {
+ /*
+ typedef niter;
+ typedef fwd_niter;
+ typedef bkd_niter;
+ */
+
+ protected:
+ Neighborhood();
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename E>
+ Neighborhood<E>::Neighborhood()
+ {
+ typedef mln_niter(E) niter;
+ typedef mln_fwd_niter(E) fwd_niter;
+ typedef mln_bkd_niter(E) bkd_niter;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_CONCEPT_NEIGHBORHOOD_HH
Index: milena/core/window.hh
--- milena/core/window.hh (revision 985)
+++ milena/core/window.hh (working copy)
@@ -10,16 +10,16 @@
{
// fwd decls
- template <typename D> class dpoints_fwd_qiter;
- template <typename D> class dpoints_bkd_qiter;
+ template <typename D> class dpoints_fwd_piter;
+ template <typename D> class dpoints_bkd_piter;
template <typename D>
struct window_ : public Window< window_<D> >,
public internal::set_of_<D>
{
- typedef dpoints_fwd_qiter<D> fwd_qiter;
- typedef dpoints_bkd_qiter<D> bkd_qiter;
+ typedef dpoints_fwd_piter<D> fwd_qiter;
+ typedef dpoints_bkd_piter<D> bkd_qiter;
typedef fwd_qiter qiter;
window_();
@@ -28,10 +28,6 @@
bool is_symmetric() const;
};
- template <typename D>
- std::ostream& operator<<(std::ostream& ostr,
- const window_<D>& win);
-
# ifndef MLN_INCLUDE_ONLY
@@ -54,23 +50,12 @@
return false;
}
- template <typename D>
- std::ostream& operator<<(std::ostream& ostr,
- const window_<D>& win)
- {
- ostr << '[';
- for (unsigned i = 0; i < win.nelements(); ++i)
- ostr << win.element(i)
- << (i = win.nelements() - 1 ? ']' : ',');
- return ostr;
- }
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
-# include <core/dpoints_qiter.hh>
+# include <core/dpoints_piter.hh>
#endif // ! MLN_CORE_WINDOW_HH
Index: milena/core/internal/set_of.hh
--- milena/core/internal/set_of.hh (revision 985)
+++ milena/core/internal/set_of.hh (working copy)
@@ -36,6 +36,10 @@
};
+ template <typename E>
+ std::ostream& operator<<(std::ostream& ostr, const set_of_<E>& s);
+
+
# ifndef MLN_INCLUDE_ONLY
template <typename E>
@@ -98,6 +102,17 @@
std::copy(s_.begin(), s_.end(), std::back_inserter(v_));
}
+ template <typename E>
+ std::ostream& operator<<(std::ostream& ostr,
+ const set_of_<E>& s)
+ {
+ ostr << '[';
+ for (unsigned i = 0; i < s.nelements(); ++i)
+ ostr << s.element(i)
+ << (i = s.nelements() - 1 ? ']' : ',');
+ return ostr;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::internal
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Update milena.
* milena/test/main.cc: Use erosion.
* milena/debug/println.hh: Remove version with win.
Add a facade.
New 2D version.
* milena/level/fill.hh: Add overloads.
* milena/core/concept/point_set.hh (npoints): New.
* milena/core/concept/box.hh (npoints): New.
* milena/core/image2d.hh (operator=): New.
(image2d): New cpy ctor.
* milena/value/props.hh: Extend.
core/concept/box.hh | 17 ++++++++++
core/concept/point_set.hh | 3 +
core/image2d.hh | 31 +++++++++++++++++++
debug/println.hh | 42 +++++++++++++++-----------
level/fill.hh | 35 ++++++++++++++++++++--
test/main.cc | 38 +++++++++++++++++++----
value/props.hh | 73 ++++++++++++++++++++++++++++++++++++++++++++--
7 files changed, 209 insertions(+), 30 deletions(-)
Index: milena/test/main.cc
--- milena/test/main.cc (revision 984)
+++ milena/test/main.cc (working copy)
@@ -1,3 +1,5 @@
+#include <cmath>
+
#include <core/image2d.hh>
#include <level/fill.hh>
#include <debug/println.hh>
@@ -8,28 +10,50 @@
#include <morpho/erosion.hh>
+int cos_sin(const mln::point2d& p)
+{
+ return int(255 * std::cos(float(p.row())) * std::sin(float(p.col())));
+}
+
+
int main()
{
using namespace mln;
- box2d b = mk_box2d(/* row = */ 1, 2,
- /* col = */ 3, 5);
+ box2d b = mk_box2d(/* row = */ 1, 3,
+ /* col = */ 4, 6);
std::cout << b << std::endl;
- image2d<int> ima(b);
- level::fill(ima, 51);
- debug::println(ima);
-
bool w[] { 0, 1, 0,
0, 1, 0,
1, 0, 0 };
window2d win = mk_window2d(w);
+
+ /*
+ {
+ image2d<int> ima(b);
+ level::fill(ima, 51);
+ debug::println(ima);
+
std::cout << win << std::endl;
- debug::println(ima, win);
morpho::erosion(ima, win);
rectangle2d rec(1, 2);
std::cout << rec << std::endl;
}
+ */
+
+
+ {
+ image2d<int> ima(b);
+ level::fill(ima, cos_sin);
+ debug::println(ima);
+
+ std::cout << std::endl;
+
+ image2d<int> ima2 = morpho::erosion(ima, win);
+ debug::println(ima2);
+ }
+}
Index: milena/debug/println.hh
--- milena/debug/println.hh (revision 984)
+++ milena/debug/println.hh (working copy)
@@ -3,6 +3,7 @@
# include <core/concept/image.hh>
# include <core/concept/window.hh>
+# include <core/box2d.hh>
namespace mln
@@ -12,7 +13,7 @@
{
template <typename I>
- void println(const Image<I>& input_);
+ void println(const Image<I>& input);
template <typename I, typename W>
void println(const Image<I>& input_,
@@ -21,8 +22,11 @@
# ifndef MLN_INCLUDE_ONLY
- template <typename I>
- void println(const Image<I>& input_)
+ namespace impl
+ {
+
+ template <typename S, typename I>
+ void println(const S&, const Image<I>& input_)
{
const I& input = exact(input_);
mln_piter(I) p(input.domain());
@@ -31,26 +35,30 @@
std::cout << std::endl;
}
-
- template <typename I, typename W>
- void println(const Image<I>& input_,
- const Window<W>& win_)
+ template <typename I>
+ void println(const box2d& b,
+ const I& input)
{
- const I& input = exact(input_);
- const W& win = exact(win_);
-
- mln_piter(I) p(input.domain());
- mln_qiter(W) q(win, p);
- for_all(p)
+ for (int row = b.pmin().row(); row <= b.pmax().row(); ++row)
{
- std::cout << input(p) << ':';
- for_all(q)
- if (input.owns_(q))
- std::cout << input(q) << ' ';
+ for (int col = b.pmin().col(); col <= b.pmax().col(); ++col)
+ std::cout << input(mk_point2d(row, col)) << ' ';
std::cout << std::endl;
}
}
+ } // end of namespace mln::debug::impl
+
+
+
+ // facade
+
+ template <typename I>
+ void println(const Image<I>& input)
+ {
+ impl::println(exact(input).domain(), exact(input));
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::debug
Index: milena/level/fill.hh
--- milena/level/fill.hh (revision 984)
+++ milena/level/fill.hh (working copy)
@@ -11,13 +11,23 @@
{
template <typename I>
- void fill(Image<I>& ima_, const mln_value(I)& value);
+ void fill(Image<I>& ima_,
+ const mln_value(I)& value);
+
+ template <typename I>
+ void fill(Image<I>& ima_,
+ mln_value(I) (*f)(const mln_point(I)& p));
+
+ template <typename I>
+ void fill(Image<I>& ima_,
+ const mln_value(I) array[]);
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- void fill(Image<I>& ima_, const mln_value(I)& value)
+ void fill(Image<I>& ima_,
+ const mln_value(I)& value)
{
I& ima = exact(ima_);
mln_piter(I) p(ima.domain());
@@ -25,6 +35,27 @@
ima(p) = value;
}
+ template <typename I>
+ void fill(Image<I>& ima_,
+ mln_value(I) (*f)(const mln_point(I)& p))
+ {
+ I& ima = exact(ima_);
+ mln_piter(I) p(ima.domain());
+ for_all(p)
+ ima(p) = f(p);
+ }
+
+ template <typename I>
+ void fill(Image<I>& ima_,
+ const mln_value(I) array[])
+ {
+ I& ima = exact(ima_);
+ mln_piter(I) p(ima.domain());
+ unsigned i = 0;
+ for_all(p)
+ ima(p) = array[i++];
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::level
Index: milena/core/concept/point_set.hh
--- milena/core/concept/point_set.hh (revision 984)
+++ milena/core/concept/point_set.hh (working copy)
@@ -20,6 +20,7 @@
bool has(const psite& p) const;
const box_<point>& bbox() const;
+ std::size_t npoints() const;
*/
protected:
@@ -45,6 +46,8 @@
m1 = 0;
const box_<point>& (E::*m2)() const = & E::bbox;
m2 = 0;
+ std::size_t (E::*m3)() const = & E::npoints;
+ m3 = 0;
}
# endif // ! MLN_INCLUDE_ONLY
Index: milena/core/concept/box.hh
--- milena/core/concept/box.hh (revision 984)
+++ milena/core/concept/box.hh (working copy)
@@ -15,7 +15,9 @@
const point& pmax() const;
*/
- const E& bbox() const; // final
+ // final
+ const E& bbox() const;
+ std::size_t npoints() const;
protected:
Box();
@@ -40,6 +42,19 @@
m2 = 0;
}
+ template <typename E>
+ std::size_t
+ Box<E>::npoints() const
+ {
+ std::size_t count = 1;
+ for (unsigned i = 0; i < E::point::dim; ++i)
+ count *+ exact(this)->pmax()[i]
+ + 1
+ - exact(this)->pmin()[i];
+ return count;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
Index: milena/core/image2d.hh
--- milena/core/image2d.hh (revision 984)
+++ milena/core/image2d.hh (working copy)
@@ -18,6 +18,9 @@
image2d();
image2d(int nrows, int ncols);
image2d(const box2d& b);
+ image2d(const image2d<T>& rhs);
+
+ image2d& operator=(const image2d<T>& rhs);
bool has_data() const;
const box2d& domain() const;
@@ -63,6 +66,34 @@
allocate_();
}
+ template <typename T>
+ image2d<T>::image2d(const image2d<T>& rhs)
+ : b_(rhs.domain())
+ {
+ allocate_();
+ std::memcpy(this->buffer_,
+ rhs.buffer_,
+ b_.npoints() * sizeof(value));
+ }
+
+ // assignment
+
+ template <typename T>
+ image2d<T>&
+ image2d<T>::operator=(const image2d<T>& rhs)
+ {
+ assert(rhs.has_data());
+ if (& rhs = this)
+ return *this;
+ if (this->has_data())
+ this->deallocate_();
+ this->b_ = rhs.domain();
+ std::memcpy(this->buffer_,
+ rhs.buffer_,
+ b_.npoints() * sizeof(value));
+ return *this;
+ }
+
// methods
template <typename T>
Index: milena/value/props.hh
--- milena/value/props.hh (revision 984)
+++ milena/value/props.hh (working copy)
@@ -24,6 +24,15 @@
# ifndef MLN_INCLUDE_ONLY
template <>
+ struct props<bool>
+ {
+ static bool min() { return false; }
+ static bool max() { return true; }
+ };
+
+ // integers
+
+ template <>
struct props<unsigned char>
{
static unsigned char min() { return 0; }
@@ -31,10 +40,68 @@
};
template <>
- struct props<int>
+ struct props<signed char>
+ {
+ static signed char min() { return -128; }
+ static signed char max() { return 127; }
+ };
+
+ template <>
+ struct props<unsigned short>
+ {
+ static unsigned short min() { return 0; }
+ static unsigned short max() { return 65535; }
+ };
+
+ template <>
+ struct props<signed short>
+ {
+ static signed short min() { return -32768; }
+ static signed short max() { return 32767; }
+ };
+
+ template <>
+ struct props<unsigned int>
+ {
+ static unsigned int min() { return std::numeric_limits<unsigned int>::min(); }
+ static unsigned int max() { return std::numeric_limits<unsigned int>::max(); }
+ };
+
+ template <>
+ struct props<signed int>
+ {
+ static signed int min() { return std::numeric_limits<signed int>::min(); }
+ static signed int max() { return std::numeric_limits<signed int>::max(); }
+ };
+
+ template <>
+ struct props<unsigned long int>
+ {
+ static unsigned long int min() { return std::numeric_limits<unsigned long int>::min(); }
+ static unsigned long int max() { return std::numeric_limits<unsigned long int>::max(); }
+ };
+
+ template <>
+ struct props<signed long int>
+ {
+ static signed long int min() { return std::numeric_limits<signed long int>::min(); }
+ static signed long int max() { return std::numeric_limits<signed long int>::max(); }
+ };
+
+ // floating
+
+ template <>
+ struct props<float>
+ {
+ static float min() { return std::numeric_limits<float>::min(); }
+ static float max() { return std::numeric_limits<float>::max(); }
+ };
+
+ template <>
+ struct props<double>
{
- static int min() { return std::numeric_limits<int>::min(); }
- static int max() { return std::numeric_limits<int>::max(); }
+ static double min() { return std::numeric_limits<double>::min(); }
+ static double max() { return std::numeric_limits<double>::max(); }
};
# endif // ! MLN_INCLUDE_ONLY
1
0