diff options
author | David Robillard <d@drobilla.net> | 2006-10-04 21:45:20 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2006-10-04 21:45:20 +0000 |
commit | fa7925c233e226da9ad3f24c2587e3c0be097e31 (patch) | |
tree | 60de6f03d0ceac11f6bd6bbb756d7d540a0d0bff | |
download | raul-fa7925c233e226da9ad3f24c2587e3c0be097e31.tar.gz raul-fa7925c233e226da9ad3f24c2587e3c0be097e31.tar.bz2 raul-fa7925c233e226da9ad3f24c2587e3c0be097e31.zip |
Moved generic utility stuff to new library "raul".
git-svn-id: http://svn.drobilla.net/lad/raul@156 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | AUTHORS | 4 | ||||
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | README | 5 | ||||
-rwxr-xr-x | autogen.sh | 9 | ||||
-rw-r--r-- | configure.ac | 79 | ||||
-rw-r--r-- | doc/Makefile.am | 4 | ||||
-rw-r--r-- | doc/mainpage.dox | 10 | ||||
-rw-r--r-- | doc/reference.doxygen.in | 1157 | ||||
-rw-r--r-- | raul/Atom.h | 127 | ||||
-rw-r--r-- | raul/AtomLiblo.h | 73 | ||||
-rw-r--r-- | raul/AtomRaptor.h | 93 | ||||
-rw-r--r-- | raul/Condition.h | 42 | ||||
-rw-r--r-- | raul/Makefile | 376 | ||||
-rw-r--r-- | raul/Makefile.am | 21 | ||||
-rw-r--r-- | raul/Mutex.h | 41 | ||||
-rw-r--r-- | raul/Path.h | 251 | ||||
-rw-r--r-- | raul/Queue.h | 160 | ||||
-rw-r--r-- | raul/Semaphore.h | 63 | ||||
-rw-r--r-- | raul/SharedPtr.h | 58 | ||||
-rw-r--r-- | raul/Slave.h | 66 | ||||
-rw-r--r-- | raul/Thread.h | 107 | ||||
-rw-r--r-- | raul/WeakPtr.h | 26 |
24 files changed, 2778 insertions, 0 deletions
@@ -0,0 +1,4 @@ +Author: + +Dave Robillard <drobilla@connect.carleton.ca> + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..d89c799 --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ +This is what revision control is for... diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..025d68b --- /dev/null +++ b/Makefile.am @@ -0,0 +1,4 @@ +SUBDIRS = raul doc + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = raul.pc @@ -0,0 +1 @@ +No news is good news. @@ -0,0 +1,5 @@ +RAUL - Realtime Audio Utility Library + +Raul is a lightweight header-only C++ convenience library for realtime +programming, with a (slight) bias towards audio applications. + diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..19f7543 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +echo 'Generating necessary files...' +#libtoolize --copy --force +aclocal +#autoheader -Wall +automake --gnu --add-missing -Wall +autoconf + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..3d7cae6 --- /dev/null +++ b/configure.ac @@ -0,0 +1,79 @@ +AC_PREREQ(2.59) +AC_INIT(raul, 0.0.0, [drobilla@connect.carleton.ca]) +#AC_CONFIG_HEADER([config.h]) +AC_CONFIG_SRCDIR([raul/Mutex.h]) +AM_INIT_AUTOMAKE + +AC_LANG([C++]) + +#AC_PROG_CXX +AC_TYPE_SIZE_T +#AC_PROG_LIBTOOL + +AC_HEADER_STDC +AC_TYPE_INT32_T +AC_TYPE_SIZE_T + +AC_FUNC_MALLOC +AC_CHECK_FUNCS([strdup strerror]) + +AC_CHECK_HEADER([pthread.h], [], + AC_MSG_ERROR([Raul requires POSIX threads.])) + +build_smart_pointers="yes" +AC_ARG_ENABLE(smart_pointers, + [AS_HELP_STRING(--enable-smart_pointers, [Include smart pointers - requires boost (yes)])], + [ if test x$enable_smart_pointers = xno ; then build_smart_pointers=no ; fi ]) +if test "$build_smart_pointers" = "yes"; then + AC_CHECK_HEADER([boost/shared_ptr.hpp], [], + AC_MSG_ERROR([You need the boost headers package (e.g. libboost-dev)])) + + AC_CHECK_HEADER([boost/weak_ptr.hpp], [], + AC_MSG_ERROR([You need the boost headers package (e.g. libboost-dev)])) + + AC_SUBST(BOOST_CFLAGS) + AC_SUBST(BOOST_LIBS) +fi +AM_CONDITIONAL(WITH_BOOST, [test "$build_smart_pointers" = "yes"]) + + +build_raptor="yes" +AC_ARG_ENABLE(raptor, + [AS_HELP_STRING(--enable-raptor, [Include Raptor (RDF) serialization support (yes)])], + [ if test x$enable_raptor = xno ; then build_raptor=no ; fi ]) +if test "$build_raptor" = "yes"; then + PKG_CHECK_MODULES(RAPTOR, raptor >= 1.4.0, [], + AC_MSG_ERROR([RDF support requires raptor (>= 1.4.0)])) + AC_SUBST(RAPTOR_CFLAGS) + AC_SUBST(RAPTOR_LIBS) +fi +AM_CONDITIONAL(WITH_RAPTOR, [test "$build_raptor" = "yes"]) + + +build_liblo="yes" +AC_ARG_ENABLE(liblo, + [AS_HELP_STRING(--enable-liblo, [Include liblo (OSC) support (yes)])], + [ if test x$enable_liblo = xno ; then build_liblo=no ; fi ]) +if test "$build_liblo" = "yes"; then + PKG_CHECK_MODULES(LIBLO, liblo >= 0.22, [], + AC_MSG_ERROR([OSC support requires liblo (>= 0.22)])) + AC_SUBST(LIBLO_LIBS) + AC_SUBST(LIBLO_CFLAGS) +fi +AM_CONDITIONAL(WITH_LIBLO, [test "$build_liblo" = "yes"]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([raul/Makefile]) +AC_CONFIG_FILES([doc/Makefile]) +AC_CONFIG_FILES([doc/reference.doxygen]) +AC_CONFIG_FILES([raul.pc]) + +AC_OUTPUT + +AC_MSG_RESULT([]) +AC_MSG_RESULT([Raul build configuration:]) +AC_MSG_RESULT([]) +AC_MSG_RESULT([OSC supprt: $build_liblo]) +AC_MSG_RESULT([RDF supprt: $build_raptor]) +AC_MSG_RESULT([Smart Pointers: $build_smart_pointers]) + diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..7f63357 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = reference.doxygen mainpage.dox + +doc: $(top_srcdir)/doc/reference.doxygen $(top_srcdir)/raul/*.h + doxygen $(top_srcdir)/doc/reference.doxygen diff --git a/doc/mainpage.dox b/doc/mainpage.dox new file mode 100644 index 0000000..8305ef1 --- /dev/null +++ b/doc/mainpage.dox @@ -0,0 +1,10 @@ +/** @mainpage + +@section Overview + +Raul is a lightweight header-only C++ convenience library for realtime +programming, with a (slight) bias towards audio applications. + +See the class heirarchy for an index of the available functionality. + +*/ diff --git a/doc/reference.doxygen.in b/doc/reference.doxygen.in new file mode 100644 index 0000000..23e8276 --- /dev/null +++ b/doc/reference.doxygen.in @@ -0,0 +1,1157 @@ +# @configure_input@ + +# Doxyfile 1.3.8 + +# 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 +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "RAUL" + +# 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@ + +# 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 = @top_srcdir@/doc + +# 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: +# 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, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES +# forces the Windows encoding (this is the default for the Windows binary), +# whereas setting the tag to NO uses a Unix-style encoding (the default for +# all platforms other than Windows). + +USE_WINDOWS_ENCODING = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is used +# as the annotated text. Otherwise, the brief description is used as-is. If left +# blank, the following values are used ("$name" is automatically replaced with the +# name of the entity): "The $name class" "The $name widget" "The $name file" +# "is" "provides" "specifies" "contains" "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited +# members of a class in the documentation of that class as if those members were +# ordinary class members. Constructors, destructors and assignment operators of +# the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = 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 = + +# 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 = YES + +# 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 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 + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# 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 + +# 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 = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = NO + +# 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 = YES + +# 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 = YES + +# 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 = YES + +# 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 = NO + +# 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 = YES + +# 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 = NO + +# 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 = NO + +# 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 = NO + +# 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 + +#--------------------------------------------------------------------------- +# 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 = NO + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_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. + +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@/doc/mainpage.dox \ + @top_srcdir@/raul + + +# 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 + +FILE_PATTERNS = + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# 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 = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# 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 = *.c + +# 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 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 = NO + +# 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 = NO + +# 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 = NO + +# 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 = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# 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 = YES + +# 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_PREDEFINED 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. + +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 = NO + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# 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 = NO + +# 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 = NO + +# 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 = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = NO + +# 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 = NO + +# 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 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 = NO + +# 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 on 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_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes that +# lay further from the root node will be omitted. Note that setting this option to +# 1 or 2 may greatly reduce the computation time needed for large code bases. Also +# note that a graph may be further truncated if the graph's image dimensions are +# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). +# If 0 is used for the depth value (the default), the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# 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 = NO + +# 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 diff --git a/raul/Atom.h b/raul/Atom.h new file mode 100644 index 0000000..4d85f7f --- /dev/null +++ b/raul/Atom.h @@ -0,0 +1,127 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_ATOM_H +#define RAUL_ATOM_H + +#include <cstdlib> +#include <cassert> +#include <cstring> +#include <string> + +using std::string; + + +/** An OSC atom (fundamental data types OSC messages are composed of). + */ +class Atom { +public: + enum Type { + NIL, + INT, + FLOAT, + STRING, + BLOB + }; + + Atom() : _type(NIL), _blob_val(0) {} + Atom(int32_t val) : _type(INT), _int_val(val) {} + Atom(float val) : _type(FLOAT), _float_val(val) {} + Atom(const char* val) : _type(STRING), _string_val(strdup(val)) {} + Atom(const string& val) : _type(STRING), _string_val(strdup(val.c_str())) {} + + Atom(void* val) : _type(BLOB), _blob_size(sizeof(val)), _blob_val(malloc(_blob_size)) + { memcpy(_blob_val, val, sizeof(_blob_size)); } + + ~Atom() + { + if (_type == STRING) + free(_string_val); + else if (_type == BLOB) + free(_blob_val); + } + + // Gotta love C++ boilerplate: + + Atom(const Atom& copy) + : _type(copy._type) + , _blob_size(copy._blob_size) + { + switch (_type) { + case NIL: _blob_val = 0; break; + case INT: _int_val = copy._int_val; break; + case FLOAT: _float_val = copy._float_val; break; + case STRING: _string_val = strdup(copy._string_val); break; + + case BLOB: _blob_val = malloc(_blob_size); + memcpy(_blob_val, copy._blob_val, _blob_size); + break; + + default: break; + } + } + + Atom& operator=(const Atom& other) + { + if (_type == BLOB) + free(_blob_val); + else if (_type == STRING) + free(_string_val); + + _type = other._type; + _blob_size = other._blob_size; + + switch (_type) { + case NIL: _blob_val = 0; break; + case INT: _int_val = other._int_val; break; + case FLOAT: _float_val = other._float_val; break; + case STRING: _string_val = strdup(other._string_val); break; + + case BLOB: _blob_val = malloc(_blob_size); + memcpy(_blob_val, other._blob_val, _blob_size); + break; + + default: break; + } + return *this; + } + + /** Type of this atom. Always check this before attempting to get the + * value - attempting to get the incorrectly typed value is a fatal error. + */ + Type type() const { return _type; } + + inline int32_t get_int32() const { assert(_type == INT); return _int_val; } + inline float get_float() const { assert(_type == FLOAT); return _float_val; } + inline const char* get_string() const { assert(_type == STRING); return _string_val; } + inline const void* get_blob() const { assert(_type == BLOB); return _blob_val; } + + inline operator bool() const { return (_type != NIL); } + +private: + Type _type; + + size_t _blob_size; ///< always a multiple of 32 + + union { + int32_t _int_val; + float _float_val; + char* _string_val; + void* _blob_val; + }; +}; + +#endif // RAUL_ATOM_H diff --git a/raul/AtomLiblo.h b/raul/AtomLiblo.h new file mode 100644 index 0000000..772a26e --- /dev/null +++ b/raul/AtomLiblo.h @@ -0,0 +1,73 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_ATOM_LIBLO_H +#define RAUL_ATOM_LIBLO_H + +#include <lo/lo.h> +#include "raul/Atom.h" + + +/** Support for serializing an Atom to/from liblo messages. + * + * (Here to prevent a unnecessary liblo dependency for Atom). + */ +class AtomLiblo { +public: + static void lo_message_add_atom(lo_message m, const Atom& atom) { + switch (atom.type()) { + //case NIL: + // (see below) + //break; + case Atom::INT: + lo_message_add_int32(m, atom.get_int32()); + break; + case Atom::FLOAT: + lo_message_add_float(m, atom.get_float()); + break; + case Atom::STRING: + lo_message_add_string(m, atom.get_string()); + break; + case Atom::BLOB: + // FIXME: is this okay? what does liblo do? + lo_message_add_blob(m, const_cast<void*>(atom.get_blob())); + break; + default: // This catches Atom::Type::NIL too + lo_message_add_nil(m); + break; + } + } + + static Atom lo_arg_to_atom(char type, lo_arg* arg) { + switch (type) { + case 'i': + return Atom(arg->i); + case 'f': + return Atom(arg->f); + case 's': + return Atom(&arg->s); + //case 'b' + // FIXME: How to get a blob from a lo_arg? + //return Atom(arg->b); + default: + return Atom(); + } + } + +}; + + +#endif // RAUL_ATOM_LIBLO_H diff --git a/raul/AtomRaptor.h b/raul/AtomRaptor.h new file mode 100644 index 0000000..b06286d --- /dev/null +++ b/raul/AtomRaptor.h @@ -0,0 +1,93 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_ATOM_RAPTOR_H +#define RAUL_ATOM_RAPTOR_H + +#include <sstream> +#include <cstring> +#include <raptor.h> +#include "raul/Atom.h" + +#define U(x) ((const unsigned char*)(x)) + +/** Support for serializing an Atom to/from RDF (via redland aka librdf). + * + * (Here to prevent a unnecessary redland dependency for Atom). + */ +class AtomRaptor { +public: + /** Set this atom's value to the object (value) portion of an RDF triple. + * + * Caller is responsible for calling free(triple->object). + */ + static void atom_to_triple_object(raptor_statement* triple, const Atom& atom) { + std::ostringstream os; + + triple->object_literal_language = NULL; + + switch (atom.type()) { + case Atom::INT: + os << atom.get_int32(); + triple->object = (unsigned char*)strdup(os.str().c_str()); + triple->object_type = RAPTOR_IDENTIFIER_TYPE_LITERAL; + triple->object_literal_datatype = raptor_new_uri( + U("http://www.w3.org/2001/XMLSchema#integer")); + break; + case Atom::FLOAT: + os << atom.get_float(); + triple->object = (unsigned char*)strdup(os.str().c_str()); + triple->object_type = RAPTOR_IDENTIFIER_TYPE_LITERAL; + triple->object_literal_datatype = raptor_new_uri( + U("http://www.w3.org/2001/XMLSchema#float")); + break; + case Atom::STRING: + triple->object = strdup(atom.get_string()); + triple->object_type = RAPTOR_IDENTIFIER_TYPE_LITERAL; + break; + case Atom::BLOB: + case Atom::NIL: + default: + cerr << "WARNING: Unserializable Atom!" << endl; + triple->object = NULL; + triple->object_type = RAPTOR_IDENTIFIER_TYPE_UNKNOWN; + } + } + +#if 0 + static Atom node_to_atom(librdf_node* node) { + /*switch (type) { + case 'i': + return Atom(arg->i); + case 'f': + return Atom(arg->f); + case 's': + return Atom(&arg->s); + //case 'b' + // FIXME: How to get a blob from a lo_arg? + //return Atom(arg->b); + default: + return Atom(); + }*/ + cerr << "FIXME: node_to_atom\n"; + return Atom(); + } +#endif + +}; + + +#endif // RAUL_ATOM_RAPTOR_H diff --git a/raul/Condition.h b/raul/Condition.h new file mode 100644 index 0000000..29eaec8 --- /dev/null +++ b/raul/Condition.h @@ -0,0 +1,42 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_CONDITION_H +#define RAUL_CONDITION_H + +#include <pthread.h> + + +/** Trivial (but pretty) wrapper around POSIX Conditions (zero overhead). + * + * A semaphore that isn't a counter, is slow, and not realtime safe. Yay. + */ +class Condition { +public: + inline Condition() { pthread_cond_init(&_cond, NULL); } + + inline ~Condition() { pthread_cond_destroy(&_cond); } + + inline void signal() { pthread_cond_signal(&_cond); } + inline void wait(Mutex& mutex) { pthread_cond_wait(&_cond, &mutex._mutex); } + +private: + pthread_cond_t _cond; +}; + + +#endif // RAUL_CONDITION_H + diff --git a/raul/Makefile b/raul/Makefile new file mode 100644 index 0000000..6e7ba67 --- /dev/null +++ b/raul/Makefile @@ -0,0 +1,376 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# raul/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +srcdir = . +top_srcdir = .. + +pkgdatadir = $(datadir)/raul +pkglibdir = $(libdir)/raul +pkgincludedir = $(includedir)/raul +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +am__append_1 = AtomLiblo.h +am__append_2 = AtomRaptor.h +subdir = raul +DIST_COMMON = $(am__raulinclude_HEADERS_DIST) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +am__raulinclude_HEADERS_DIST = SharedPtr.h WeakPtr.h Path.h Queue.h \ + Semaphore.h Mutex.h Condition.h Thread.h Slave.h Atom.h \ + AtomLiblo.h AtomRaptor.h +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(raulincludedir)" +raulincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(raulinclude_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/dave/code/codesonnet/raul/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /home/dave/code/codesonnet/raul/missing --run tar +AUTOCONF = ${SHELL} /home/dave/code/codesonnet/raul/missing --run autoconf +AUTOHEADER = ${SHELL} /home/dave/code/codesonnet/raul/missing --run autoheader +AUTOMAKE = ${SHELL} /home/dave/code/codesonnet/raul/missing --run automake-1.9 +AWK = gawk +BOOST_CFLAGS = +BOOST_LIBS = +CPPFLAGS = +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=none +CXXFLAGS = -pipe -O2 -march=pentium4 -msse -msse2 -mfpmath=sse -ffast-math -ftree-vectorize -DNDEBUG -finline-functions -fomit-frame-pointer -fmessage-length=139 -fdiagnostics-show-location=every-line +CYGPATH_W = echo +DEFS = -DPACKAGE_NAME=\"raul\" -DPACKAGE_TARNAME=\"raul\" -DPACKAGE_VERSION=\"0.0.0\" -DPACKAGE_STRING=\"raul\ 0.0.0\" -DPACKAGE_BUGREPORT=\"drobilla@connect.carleton.ca\" -DPACKAGE=\"raul\" -DVERSION=\"0.0.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 +DEPDIR = .deps +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +GREP = /bin/grep +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBLO_CFLAGS = -I/usr/local/include +LIBLO_LIBS = -L/usr/local/lib -llo -lpthread +LIBOBJS = +LIBS = +LTLIBOBJS = +MAKEINFO = ${SHELL} /home/dave/code/codesonnet/raul/missing --run makeinfo +OBJEXT = o +PACKAGE = raul +PACKAGE_BUGREPORT = drobilla@connect.carleton.ca +PACKAGE_NAME = raul +PACKAGE_STRING = raul 0.0.0 +PACKAGE_TARNAME = raul +PACKAGE_VERSION = 0.0.0 +PATH_SEPARATOR = : +PKG_CONFIG = /usr/bin/pkg-config +RAPTOR_CFLAGS = +RAPTOR_LIBS = -lraptor -lcurl -lgssapi_krb5 -lkrb5 -lk5crypto -lkrb5support -lcom_err -lresolv -lidn -ldl -lssl -lcrypto -lz -lxslt -lxml2 +SET_MAKE = +SHELL = /bin/bash +STRIP = +VERSION = 0.0.0 +WITH_BOOST_FALSE = # +WITH_BOOST_TRUE = +WITH_LIBLO_FALSE = # +WITH_LIBLO_TRUE = +WITH_RAPTOR_FALSE = # +WITH_RAPTOR_TRUE = +ac_ct_CXX = g++ +am__fastdepCXX_FALSE = +am__fastdepCXX_TRUE = # +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build_alias = +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host_alias = +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = /home/dave/code/codesonnet/raul/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = mkdir -p -- +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target_alias = +raulincludedir = $(includedir)/raul +raulinclude_HEADERS = SharedPtr.h WeakPtr.h Path.h Queue.h Semaphore.h \ + Mutex.h Condition.h Thread.h Slave.h Atom.h $(am__append_1) \ + $(am__append_2) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu raul/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu raul/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +uninstall-info-am: +install-raulincludeHEADERS: $(raulinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(raulincludedir)" || $(mkdir_p) "$(DESTDIR)$(raulincludedir)" + @list='$(raulinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(raulincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(raulincludedir)/$$f'"; \ + $(raulincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(raulincludedir)/$$f"; \ + done + +uninstall-raulincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(raulinclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(raulincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(raulincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(raulincludedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-raulincludeHEADERS + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-raulincludeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + ctags distclean distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man \ + install-raulincludeHEADERS install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am \ + uninstall-raulincludeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/raul/Makefile.am b/raul/Makefile.am new file mode 100644 index 0000000..7d5ac48 --- /dev/null +++ b/raul/Makefile.am @@ -0,0 +1,21 @@ +raulincludedir = $(includedir)/raul + +raulinclude_HEADERS = \ + SharedPtr.h \ + WeakPtr.h \ + Path.h \ + Queue.h \ + Semaphore.h \ + Mutex.h \ + Condition.h \ + Thread.h \ + Slave.h \ + Atom.h + +if WITH_LIBLO +raulinclude_HEADERS += AtomLiblo.h +endif + +if WITH_RAPTOR +raulinclude_HEADERS += AtomRaptor.h +endif diff --git a/raul/Mutex.h b/raul/Mutex.h new file mode 100644 index 0000000..8cff728 --- /dev/null +++ b/raul/Mutex.h @@ -0,0 +1,41 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_MUTEX_H +#define RAUL_MUTEX_H + +#include <pthread.h> + + +/** Trivial (but pretty) wrapper around POSIX Mutexes (zero overhead). + */ +class Mutex { +public: + inline Mutex() { pthread_mutex_init(&_mutex, NULL); } + + inline ~Mutex() { pthread_mutex_destroy(&_mutex); } + + inline bool try_lock() { return (pthread_mutex_trylock(&_mutex) == 0); } + inline void lock() { pthread_mutex_lock(&_mutex); } + inline void unlock() { pthread_mutex_unlock(&_mutex); } + +private: + friend class Condition; + pthread_mutex_t _mutex; +}; + + +#endif // RAUL_MUTEX_H diff --git a/raul/Path.h b/raul/Path.h new file mode 100644 index 0000000..9412e3c --- /dev/null +++ b/raul/Path.h @@ -0,0 +1,251 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_PATH_H +#define RAUL_PATH_H + +#include <cctype> +#include <string> +#include <cassert> +using std::string; + + +/** Simple wrapper around standard string with useful path-specific methods. + * + * This enforces that a Path is a valid OSC path (though it is used for + * GraphObject paths, which aren't directly OSC paths but a portion of one). + * + * A path is divided by slashes (/). The first character MUST be a slash, and + * the last character MUST NOT be a slash (except in the special case of the + * root path "/", which is the only valid single-character path). + * + * Valid characters are the 95 printable ASCII characters (32-126), excluding: + * space # * , ? [ ] { } + */ +class Path : public std::basic_string<char> { +public: + + /** Construct a Path from an std::string. + * + * It is a fatal error to construct a Path from an invalid string, + * use is_valid first to check. + */ + Path(const std::basic_string<char>& path) + : std::basic_string<char>(path) + { + assert(is_valid(path)); + } + + + /** Construct a Path from a C string. + * + * It is a fatal error to construct a Path from an invalid string, + * use is_valid first to check. + */ + Path(const char* cpath) + : std::basic_string<char>(cpath) + { + assert(is_valid(cpath)); + } + + + static bool is_valid(const std::basic_string<char>& path) + { + if (path.length() == 0) + return false; + + // Must start with a / + if (path.at(0) != '/') + return false; + + // Must not end with a slash unless "/" + if (path.length() > 1 && path.at(path.length()-1) == '/') + return false; + + assert(path.find_last_of("/") != string::npos); + + // Double slash not allowed + if (path.find("//") != string::npos) + return false; + + // All characters must be printable ASCII + for (size_t i=0; i < path.length(); ++i) + if (path.at(i) < 32 || path.at(i) > 126) + return false; + + // Disallowed characters + if ( path.find(" ") != string::npos + || path.find("#") != string::npos + || path.find("*") != string::npos + || path.find(",") != string::npos + || path.find("?") != string::npos + || path.find("[") != string::npos + || path.find("]") != string::npos + || path.find("{") != string::npos + || path.find("}") != string::npos) + return false; + + return true; + } + + static bool is_valid_name(const std::basic_string<char>& path) + { + return is_valid(string("/").append(path)); + } + + + /** Convert a string to a valid full path. + * + * This will make a best effort at turning @a str into a complete, valid + * Path, and will always return one. + */ + static string pathify(const std::basic_string<char>& str) + { + string path = str; + + if (path.length() == 0) + return "/"; // this might not be wise + + // Must start with a / + if (path.at(0) != '/') + path = string("/").append(path); + + // Must not end with a slash unless "/" + if (path.length() > 1 && path.at(path.length()-1) == '/') + path = path.substr(0, path.length()-1); // chop trailing slash + + assert(path.find_last_of("/") != string::npos); + + replace_invalid_chars(path, false); + + assert(is_valid(path)); + + return path; + } + + /** Convert a string to a valid name (or "method" - tokens between slashes) + * + * This will strip all slashes, etc, and always return a valid name/method. + */ + static string nameify(const std::basic_string<char>& str) + { + string name = str; + + if (name.length() == 0) + return "."; // this might not be wise + + replace_invalid_chars(name, true); + + assert(is_valid(string("/") + name)); + + return name; + } + + + /** Replace any invalid characters in @a str with a suitable replacement. + * + * Makes a pretty name - underscores are a valid character, but this chops + * both spaces and underscores, uppercasing the next letter, to create + * uniform CamelCase names that look nice + */ + static void replace_invalid_chars(string& str, bool replace_slash = false) + { + for (size_t i=0; i < str.length(); ++i) { + if (str[i] == ' ' || str[i] == '_') { + str[i+1] = std::toupper(str[i+1]); // capitalize next char + str = str.substr(0, i) + str.substr(i+1); // chop space/underscore + } else if (str[i] == '[' || str[i] == '{') { + str[i] = '('; + } else if (str[i] == ']' || str[i] == '}') { + str[i] = ')'; + } else if (str[i] < 32 || str.at(i) > 126 + || str[i] == '#' + || str[i] == '*' + || str[i] == ',' + || str[i] == '?' + || (replace_slash && str[i] == '/')) { + str[i] = '.'; + } + } + + // Chop brackets + while (true) { + + const string::size_type open = str.find("("); + const string::size_type close = str.find(")"); + + if (open != string::npos) { + if (close != string::npos) + str.erase(open, (close - open) + 1); + } else { + break; + } + + } + } + + + /** Return the name of this object (everything after the last '/'). + * This is the "method name" for OSC paths. + */ + inline std::basic_string<char> name() const + { + if ((*this) == "/") + return ""; + else + return substr(find_last_of("/")+1); + } + + + /** Return the parent's path. + * + * Calling this on the path "/" will return "/". + * This is the (deepest) "container path" for OSC paths. + */ + inline Path parent() const + { + std::basic_string<char> parent = substr(0, find_last_of("/")); + return (parent == "") ? "/" : parent; + } + + /** Parent path with a "/" appended. + * + * This exists to avoid needing to be careful about the special case of "/". + * To create a child of a path, use parent.base() + child_name. + * Returned value is always a valid path, with the single exception that + * the last character is "/". + */ + inline string base() const + { + if ((*this) == "/") + return *this; + else + return (*this) + "/"; + } + + inline bool is_child_of(const Path& parent) const + { + return (length() > parent.length() && substr(0, parent.length()) == parent); + } + + inline bool is_parent_of(const Path& child) const + { + return child.is_child_of(*this); + } +}; + + +#endif // RAUL_PATH_H diff --git a/raul/Queue.h b/raul/Queue.h new file mode 100644 index 0000000..f400497 --- /dev/null +++ b/raul/Queue.h @@ -0,0 +1,160 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_QUEUE_H +#define RAUL_QUEUE_H + +#include <cassert> +#include <cstdlib> + + +/** Realtime-safe single-reader single-writer queue (aka lock-free ringbuffer) + * + * Implemented as a dequeue in a fixed array. This is read/write thread-safe, + * pushing and popping may occur simultaneously by seperate threads, but + * the push and pop operations themselves are not thread-safe. + * + * FIXME: Verify atomicity of everything here. + */ +template <typename T> +class Queue +{ +public: + Queue(size_t size); + ~Queue(); + + inline bool is_empty() const; + inline bool is_full() const; + + inline size_t capacity() const { return m_size-1; } + inline size_t fill() const; + + inline T& front() const; + + inline bool push(T obj); + inline T& pop(); + +private: + // Prevent copies (these are undefined) + Queue(const Queue& copy); + Queue& operator=(const Queue& copy); + + volatile size_t m_front; ///< Index to front of queue (circular) + volatile size_t m_back; ///< Index to back of queue (one past last element) (circular) + const size_t m_size; ///< Size of @ref m_objects (you can store m_size-1 objects) + T* const m_objects; ///< Fixed array containing queued elements +}; + + +template<typename T> +Queue<T>::Queue(size_t size) +: m_front(0), + m_back(0), + m_size(size+1), + m_objects((T*)calloc(m_size, sizeof(T))) +{ + assert(size > 1); +} + + +template <typename T> +Queue<T>::~Queue() +{ + free(m_objects); +} + + +/** Return whether or not the queue is empty. + */ +template <typename T> +inline bool +Queue<T>::is_empty() const +{ + return (m_back == m_front); +} + + +/** Return whether or not the queue is full. + */ +template <typename T> +inline bool +Queue<T>::is_full() const +{ + // FIXME: This can probably be faster + return (fill() == capacity()); +} + + +/** Returns how many elements are currently in the queue. + */ +template <typename T> +inline size_t +Queue<T>::fill() const +{ + return (m_back + m_size - m_front) % m_size; +} + + +/** Return the element at the front of the queue without removing it + */ +template <typename T> +inline T& +Queue<T>::front() const +{ + return m_objects[m_front]; +} + + +/** Push an item onto the back of the Queue - realtime-safe, not thread-safe. + * + * @returns true if @a elem was successfully pushed onto the queue, + * false otherwise (queue is full). + */ +template <typename T> +inline bool +Queue<T>::push(T elem) +{ + if (is_full()) { + return false; + } else { + m_objects[m_back] = elem; + m_back = (m_back + 1) % (m_size); + return true; + } +} + + +/** Pop an item off the front of the queue - realtime-safe, not thread-safe. + * + * It is a fatal error to call pop() when the queue is empty. + * + * @returns the element popped. + */ +template <typename T> +inline T& +Queue<T>::pop() +{ + assert(!is_empty()); + assert(m_size > 0); + + T& r = m_objects[m_front]; + m_front = (m_front + 1) % (m_size); + + return r; +} + + +#endif // RAUL_QUEUE_H diff --git a/raul/Semaphore.h b/raul/Semaphore.h new file mode 100644 index 0000000..9a696f9 --- /dev/null +++ b/raul/Semaphore.h @@ -0,0 +1,63 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_SEMAPHORE_H +#define RAUL_SEMAPHORE_H + +#include <semaphore.h> + + +/** Trivial wrapper around POSIX semaphores (zero memory overhead). + * + * This was created to provide an alternative debuggable implementation of + * semaphores based on a cond/mutex pair because semaphore's appeared not to + * work in GDB. Turns out sem_wait can fail when run in GDB, and Debian + * really needs to update it's man pages. + * + * This class remains as a trivial (yet pretty) wrapper/abstraction. + */ +class Semaphore { +public: + inline Semaphore(unsigned int initial) { sem_init(&m_sem, 0, initial); } + + inline ~Semaphore() { sem_destroy(&m_sem); } + + /** Increment (and signal any waiters). + * + * Realtime safe. + */ + inline void post() { sem_post(&m_sem); } + + /** Wait until count is > 0, then decrement. + * + * Note that sem_wait always returns 0 in practise. It returns nonzero + * when run in GDB, so the while is necessary to allow debugging. + * + * Obviously not realtime safe. + */ + inline void wait() { while (sem_wait(&m_sem) != 0) ; } + + /** Non-blocking version of wait(). + * + * Realtime safe? + */ + inline int try_wait() { return sem_trywait(&m_sem); } +private: + sem_t m_sem; +}; + + +#endif // RAUL_SEMAPHORE_H diff --git a/raul/SharedPtr.h b/raul/SharedPtr.h new file mode 100644 index 0000000..c6e72a1 --- /dev/null +++ b/raul/SharedPtr.h @@ -0,0 +1,58 @@ +/* A Reference Counting Smart Pointer. + * Copyright (C) 2006 Dave Robillard. + * + * This is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This file is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_SHARED_PTR_H +#define RAUL_SHARED_PTR_H + +#include <cassert> +#include <cstddef> + +#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS +#include <iostream> +#include <list> +#include <algorithm> + +static std::list<void*> shared_ptr_counters; + +// Use debug hooks to ensure 2 shared_ptrs never point to the same thing +namespace boost { + + inline void sp_scalar_constructor_hook(void* object, unsigned long cnt, void* ptr) { + assert(std::find(shared_ptr_counters.begin(), shared_ptr_counters.end(), + (void*)object) == shared_ptr_counters.end()); + shared_ptr_counters.push_back(object); + //std::cerr << "Creating SharedPtr to " + // << object << ", count = " << cnt << std::endl; + } + + inline void sp_scalar_destructor_hook(void* object, unsigned long cnt, void* ptr) { + shared_ptr_counters.remove(object); + //std::cerr << "Destroying SharedPtr to " + // << object << ", count = " << cnt << std::endl; + } + +} +#endif // BOOST_SP_ENABLE_DEBUG_HOOKS + + +#include <boost/shared_ptr.hpp> + +#define SharedPtr boost::shared_ptr +#define PtrCast boost::dynamic_pointer_cast + +#endif // RAUL_SHARED_PTR_H + diff --git a/raul/Slave.h b/raul/Slave.h new file mode 100644 index 0000000..c16818b --- /dev/null +++ b/raul/Slave.h @@ -0,0 +1,66 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_SLAVE_H +#define RAUL_SLAVE_H + +#include <pthread.h> +#include "raul/Semaphore.h" +#include "raul/Thread.h" + + +/** Thread driven by (realtime safe) signals. + * + * Use this to perform some task in a separate thread you want to 'drive' + * from a realtime (or otherwise) thread. + * + * \ingroup engine + */ +class Slave : public Thread +{ +public: + Slave() : _whip(0) {} + + /** Tell the slave to do whatever work it does. Realtime safe. */ + inline void whip() { _whip.post(); } + +protected: + /** Worker method. + * + * This is called once from this thread every time whip() is called. + * Implementations likely want to put a single (non loop) chunk of code + * here, e.g. to process an event. + */ + virtual void _whipped() = 0; + + Semaphore _whip; + +private: + // Prevent copies (undefined) + Slave(const Slave&); + Slave& operator=(const Slave&); + + inline void _run() + { + while (true) { + _whip.wait(); + _whipped(); + } + } +}; + + +#endif // RAUL_SLAVE_H diff --git a/raul/Thread.h b/raul/Thread.h new file mode 100644 index 0000000..37dcacd --- /dev/null +++ b/raul/Thread.h @@ -0,0 +1,107 @@ +/* This file is part of Ingen. Copyright (C) 2006 Dave Robillard. + * + * Ingen is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_THREAD_H +#define RAUL_THREAD_H + +#include <string> +#include <iostream> +#include <pthread.h> + + +/** Abstract base class for a thread. + * + * Extend this and override the _run method to easily create a thread + * to perform some task. + * + * \ingroup engine + */ +class Thread +{ +public: + Thread() : _pthread_exists(false) {} + + virtual ~Thread() { stop(); } + + void set_name(const std::string& name) { _name = name; } + + /** Launch and start the thread. */ + virtual void start() { + std::cout << "[" << _name << " Thread] Starting." << std::endl; + + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, 1500000); + + pthread_create(&_pthread, &attr, _static_run, this); + _pthread_exists = true; + } + + /** Stop and terminate the thread. */ + virtual void stop() { + if (_pthread_exists) { + pthread_cancel(_pthread); + pthread_join(_pthread, NULL); + _pthread_exists = false; + } + } + + void set_scheduling(int policy, unsigned int priority) { + sched_param sp; + sp.sched_priority = priority; + int result = pthread_setschedparam(_pthread, SCHED_FIFO, &sp); + if (!result) { + std::cout << "[" << _name << "] Set scheduling policy to "; + switch (policy) { + case SCHED_FIFO: std::cout << "SCHED_FIFO"; break; + case SCHED_RR: std::cout << "SCHED_RR"; break; + case SCHED_OTHER: std::cout << "SCHED_OTHER"; break; + default: std::cout << "UNKNOWN"; break; + } + std::cout << ", priority " << sp.sched_priority << std::endl; + } else { + std::cout << "[" << _name << "] Unable to set scheduling policy (" + << strerror(result) << ")" << std::endl; + } + } + + +protected: + /** Thread function to execute. + * + * This is called once on start, and terminated on stop. + * Implementations likely want to put some infinite loop here. + */ + virtual void _run() = 0; + +private: + // Prevent copies (undefined) + Thread(const Thread&); + Thread& operator=(const Thread&); + + inline static void* _static_run(void* me) { + Thread* myself = (Thread*)me; + myself->_run(); + return NULL; // and I + } + + std::string _name; + bool _pthread_exists; + pthread_t _pthread; +}; + + +#endif // RAUL_THREAD_H diff --git a/raul/WeakPtr.h b/raul/WeakPtr.h new file mode 100644 index 0000000..3523d25 --- /dev/null +++ b/raul/WeakPtr.h @@ -0,0 +1,26 @@ +/* A "weak" pointer to a resource owned by a shared pointer. + * Copyright (C) 2006 Dave Robillard. + * + * This is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This file is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef RAUL_WEAK_PTR_H +#define RAUL_WEAK_PTR_H + +#include <boost/weak_ptr.hpp> + +#define WeakPtr boost::weak_ptr + +#endif // RAUL_WEAK_PTR_H + |