summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--.gitignore22
-rw-r--r--AUTHORS3
-rw-r--r--COPYING19
-rw-r--r--ChangeLog0
-rw-r--r--Doxyfile.in247
-rw-r--r--Makefile.am27
-rw-r--r--NEWS.xml6
-rw-r--r--NEWS.xsl24
-rw-r--r--README0
-rw-r--r--acinclude.m480
-rwxr-xr-xautogen.sh9
-rw-r--r--configure.ac65
-rw-r--r--include/.gitignore2
-rw-r--r--include/Makefile.am12
-rw-r--r--include/konforka/basic_wrapper.h118
-rw-r--r--include/konforka/exception.h203
-rw-r--r--include/konforka/pointer_map.h105
-rw-r--r--include/konforka/pqxx_pile.h59
-rw-r--r--include/konforka/resource_pile.h118
-rw-r--r--include/konforka/responsible_wrapper.h99
-rw-r--r--konforka.pc.in11
-rw-r--r--lib/.gitignore7
-rw-r--r--lib/Makefile.am16
-rw-r--r--lib/exception.cc66
-rw-r--r--lib/pointer_map.cc74
-rw-r--r--lib/pqxx_pile.cc17
26 files changed, 1409 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..41e63e2
--- a/dev/null
+++ b/.gitignore
@@ -0,0 +1,22 @@
+configure
+Makefile.in
+Doxyfile
+config.log
+depcomp
+config.guess
+config.h
+ltmain.sh
+config.sub
+INSTALL
+konforka.pc
+NEWS
+Makefile
+config.status
+stamp-h1
+doxydox
+config.h.in
+libtool
+autom4te.cache
+missing
+aclocal.m4
+install-sh
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..a9fb0c7
--- a/dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
+Klever dissected:
+ Michael 'hacker' Krelin <hacker@klever.net>
+ Leonid Ivanov <kamel@klever.net>
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..96befc6
--- a/dev/null
+++ b/COPYING
@@ -0,0 +1,19 @@
+Copyright (c) 2004-2005 Klever Group (http://www.klever.net/)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
--- a/dev/null
+++ b/ChangeLog
diff --git a/Doxyfile.in b/Doxyfile.in
new file mode 100644
index 0000000..ea0b482
--- a/dev/null
+++ b/Doxyfile.in
@@ -0,0 +1,247 @@
+# Doxyfile 1.3.9.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = @PACKAGE@
+PROJECT_NUMBER = @VERSION@
+OUTPUT_DIRECTORY = @builddir@/doxydox
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF =
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH = include
+STRIP_FROM_INC_PATH = include
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+DISTRIBUTE_GROUP_DOC = NO
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+SUBGROUPING = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = NO
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = YES
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = NO
+SHOW_DIRECTORIES = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+INPUT = \
+ @srcdir@/include/konforka/
+FILE_PATTERNS = *.h
+RECURSIVE = NO
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 2
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+GENERATE_XML = YES
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = @HAVE_DOT@
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH = @DOT@
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 0
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+SEARCHENGINE = NO
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..c3fef99
--- a/dev/null
+++ b/Makefile.am
@@ -0,0 +1,27 @@
+SUBDIRS=include lib
+EXTRA_DIST = NEWS NEWS.xml NEWS.xsl
+
+DISTCHECK_CONFIGURE_FLAGS=--with-pkgconfigdir=$${dc_install_base}/lib/pkgconfig
+if HAVE_PKGCONFIG
+pkgconfigdir=@PKGCONFIG_DIR@
+pkgconfig_DATA=konforka.pc
+endif
+
+LOCAL_TARGETS=
+if HAVE_DOXYGEN
+LOCAL_TARGETS+=doxygen
+endif
+
+all-local: NEWS $(addprefix all-lota-,${LOCAL_TARGETS})
+clean-local: $(addprefix clean-lota-,${LOCAL_TARGETS})
+
+NEWS: NEWS.xsl NEWS.xml
+ ${XSLTPROC} -o $@ NEWS.xsl NEWS.xml
+
+all-lota-doxygen: doxydox/built
+doxydox/built: $(wildcard ${top_srcdir}/include/konforka/*.h)
+ ${DOXYGEN}
+ touch $@
+
+clean-lota-doxygen:
+ rm -rf doxydox
diff --git a/NEWS.xml b/NEWS.xml
new file mode 100644
index 0000000..d1d89f6
--- a/dev/null
+++ b/NEWS.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="us-ascii"?>
+<news>
+ <version version="0.0" date="January 29th, 2005">
+ <ni>Initial release</ni>
+ </version>
+</news>
diff --git a/NEWS.xsl b/NEWS.xsl
new file mode 100644
index 0000000..7c71307
--- a/dev/null
+++ b/NEWS.xsl
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="us-ascii"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ >
+ <xsl:output
+ method="text"
+ encoding="us-ascii"
+ media-type="text/plain" />
+
+ <xsl:template match="news">
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="version">
+ <xsl:value-of select="concat(@version,' (',@date,')&#xA;')"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="ni">
+ <xsl:text> - </xsl:text>
+ <xsl:apply-templates mode="text"/>
+ <xsl:text>&#xA;</xsl:text>
+ </xsl:template>
+ <xsl:template match="*|text()"/>
+
+</xsl:stylesheet>
diff --git a/README b/README
new file mode 100644
index 0000000..e69de29
--- a/dev/null
+++ b/README
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..ec2c50f
--- a/dev/null
+++ b/acinclude.m4
@@ -0,0 +1,80 @@
+dnl AC_WITH_PKGCONFIG([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]])
+dnl Outputs:
+dnl AC_SUBST: PKGCONFIG_PKGCONFIG PKGCONFIG_DIR
+dnl AM_CONDTIONAL: HAVE_PKGCONFIG
+AC_DEFUN([AC_WITH_PKGCONFIG],[
+ PKGCONFIG_PKGCONFIG=""
+ PKGCONFIG_DIR=""
+ HAVE_PKGCONFIG="no"
+ EXPLICIT_PKGCONFIGDIR="no"
+ test -z "${WANT_PKGCONFIG}" && WANT_PKGCONFIG=""
+ AC_PATH_PROG([PKGCONFIG_PKGCONFIG],[pkg-config],[false])
+ if test "${PKGCONFIG_PKGCONFIG}" != "false" ; then
+ AC_ARG_WITH([pkgconfigdir],
+ AC_HELP_STRING([--with-pkgconfigdir=dir],[Specify pkgconfig directory]),
+ [
+ if test "${withval}" = "no" ; then
+ WANT_PKGCONFIG="no"
+ else
+ PKGCONFIG_DIR="${withval}"
+ EXPLICIT_PKGCONFIGDIR="yes"
+ fi
+ ],[
+ AC_MSG_CHECKING([for pkgconfig directory])
+ PKGCONFIG_DIR="`${PKGCONFIG_PKGCONFIG} --debug 2>&1 | grep '^Scanning'| head -n 1 | cut -d\' -f2-|cut -d\' -f1`"
+ AC_MSG_RESULT([${PKGCONFIG_DIR}])
+ ]
+ )
+ if test -d "${PKGCONFIG_DIR}" ; then
+ HAVE_PKGCONFIG=yes
+ AC_SUBST([PKGCONFIG_PKGCONFIG])
+ AC_SUBST([PKGCONFIG_DIR])
+ else
+ AC_MSG_NOTICE([unexistent pkgconfig directory: ${PKGCONFIG_DIR}])
+ if test "${EXPLICIT_PKGCONFIGDIR}" = "yes" ; then
+ HAVE_PKGCONFIG=yes
+ AC_SUBST([PKGCONFIG_PKGCONFIG])
+ AC_SUBST([PKGCONFIG_DIR])
+ else
+ ifelse([$2], , :, [$2])
+ fi
+ fi
+ fi
+ AM_CONDITIONAL([HAVE_PKGCONFIG],[test "${HAVE_PKGCONFIG}" = "yes"])
+])
+
+dnl AC_WITH_DOXYGEN([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]])
+dnl Outputs:
+dnl AC_SUBST: DOXYGEN HAVE_DOXYGEN
+dnl AM_CONDTIONAL: HAVE_DOXYGEN
+AC_DEFUN([AC_WITH_DOXYGEN],[
+ HAVE_DOXYGEN="no"
+ AC_PATH_PROG([DOXYGEN],[doxygen],[false])
+ if test "${DOXYGEN}" = "false" ; then
+ ifelse([$2], , :, [$2])
+ else
+ HAVE_DOXYGEN="yes"
+ AC_SUBST([DOXYGEN])
+ $1
+ fi
+ AC_SUBST([HAVE_DOXYGEN])
+ AM_CONDITIONAL([HAVE_DOXYGEN],[test "${HAVE_DOXYGEN}" = "yes"])
+])
+
+dnl AC_WITH_DOT([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]])
+dnl Outputs:
+dnl AC_SUBST: DOT HAVE_DOT
+dnl AM_CONDITIONAL: HAVE_DOT
+AC_DEFUN([AC_WITH_DOT],[
+ HAVE_DOT="no"
+ AC_PATH_PROG([DOT],[dot],[false])
+ if test "${DOT}" = "false" ; then
+ ifelse([$2], , :, [$2])
+ else
+ HAVE_DOT="yes"
+ AC_SUBST([DOT])
+ $1
+ fi
+AC_SUBST([HAVE_DOT])
+ AM_CONDITIONAL([HAVE_DOT],[test "${HAVE_DOT}" = "yes"])
+])
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..ba27501
--- a/dev/null
+++ b/autogen.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+WANT_AUTOMAKE=1.8
+export WANT_AUTOMAKE
+libtoolize -f \
+&& aclocal \
+&& autoheader \
+&& automake -a \
+&& autoconf \
+&& ./configure "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..96d9325
--- a/dev/null
+++ b/configure.ac
@@ -0,0 +1,65 @@
+AC_INIT([konforka], [0.0], [konforka-bugs@klever.net])
+AC_CONFIG_SRCDIR([include/konforka/exception.h])
+AC_CONFIG_HEADER([config.h])
+AM_INIT_AUTOMAKE([dist-bzip2])
+
+AC_PROG_INSTALL
+AC_PROG_AWK
+AC_PROG_CXX
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+AC_HEADER_STDC
+
+AC_C_CONST
+
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+
+AC_PATH_PROG([XSLTPROC],[xsltproc],[true])
+
+AC_WITH_PKGCONFIG
+WANT_DOXYGEN="yes"
+AC_ARG_ENABLE([doxygen],
+ AC_HELP_STRING([--disable-doxygen],[do not generate documentation]),
+ [
+ test "${enableval}" = "no" && WANT_DOXYGEN="no"
+ ]
+)
+if test "${WANT_DOXYGEN}" = "yes" ; then
+ AC_WITH_DOXYGEN
+ AC_WITH_DOT
+else
+ AM_CONDITIONAL([HAVE_DOXYGEN],[false])
+ AM_CONDITIONAL([HAVE_DOT],[false])
+fi
+
+WANT_PQXX="yes"
+AC_ARG_WITH([libpqxx],
+ AC_HELP_STRING([--without-libpqxx],[do not build libpqxx connection pool support]),
+ [
+ test "${withval}" = "no" && WANT_PQXX="no"
+ ]
+)
+HAVE_PQXX="no"
+PC_REQ_PQXX=""
+if test "${WANT_PQXX}" = "yes" ; then
+ PKG_CHECK_MODULES([PQXX],[libpqxx],[
+ HAVE_PQXX="yes"
+ PC_REQ_PQXX="libpqxx"
+ ],[
+ AC_MSG_NOTICE([no libpqxx found, no connection piling support will be built])
+ ]
+ )
+fi
+AC_SUBST([PC_REQ_PQXX],[${PC_REQ_PQXX}])
+AM_CONDITIONAL([HAVE_PQXX],[test "${HAVE_PQXX}" = "yes"])
+
+AC_CONFIG_FILES([
+ Makefile
+ konforka.pc
+ Doxyfile
+ include/Makefile
+ lib/Makefile
+])
+AC_OUTPUT
diff --git a/include/.gitignore b/include/.gitignore
new file mode 100644
index 0000000..3dda729
--- a/dev/null
+++ b/include/.gitignore
@@ -0,0 +1,2 @@
+Makefile.in
+Makefile
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..3e043d3
--- a/dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,12 @@
+EXTRA_DIST = konforka/pqxx_pile.h
+EXTRA_HEADERS=
+if HAVE_PQXX
+EXTRA_HEADERS += konforka/pqxx_pile.h
+endif
+
+nobase_include_HEADERS = \
+ konforka/exception.h \
+ konforka/basic_wrapper.h konforka/responsible_wrapper.h \
+ konforka/resource_pile.h \
+ konforka/pointer_map.h \
+ ${EXTRA_HEADERS}
diff --git a/include/konforka/basic_wrapper.h b/include/konforka/basic_wrapper.h
new file mode 100644
index 0000000..909f8b6
--- a/dev/null
+++ b/include/konforka/basic_wrapper.h
@@ -0,0 +1,118 @@
+#ifndef __KONFORKA_BASIC_WRAPPER_H
+#define __KONFORKA_BASIC_WRAPPER_H
+
+/**
+ * @file
+ * @brief The konforka::basic_wrapper class declaration.
+ */
+
+#include <konforka/exception.h>
+
+namespace konforka {
+
+ /**
+ * @brief The basic wrapper class.
+ *
+ */
+ template<typename T>
+ class basic_wrapper {
+ public:
+ /**
+ * The type of wrapped content.
+ */
+ typedef T content_type;
+
+ /**
+ * The content wrapped into the instance.
+ */
+ content_type opkele;
+ /**
+ * This boolean indicates whether the object has a content
+ * attached to it.
+ */
+ bool bopkele;
+
+ /**
+ * Default constructors creates the object with no content
+ * associated with it.
+ */
+ basic_wrapper()
+ : bopkele(false) { }
+ /**
+ * The constructor associates the content give with the object.
+ * @param o the content being attached to the object.
+ */
+ basic_wrapper(content_type o)
+ : opkele(o), bopkele(true) { }
+ /**
+ * Virtual destructor doing nothing in this class.
+ */
+ virtual ~basic_wrapper() { }
+
+ /**
+ * Attaches the given content to the object.
+ * @param o the content being attached to the object.
+ */
+ void attach(content_type o) {
+ opkele = o;
+ bopkele = true;
+ }
+
+ /**
+ * Test whether the object has content attached.
+ * @return naturally, returns true if yes.
+ */
+ bool is() const {
+ return bopkele;
+ }
+
+ /**
+ * Throws an exception in case the object lacks content
+ * attached.
+ */
+ void ensure() const {
+ if(!is())
+ throw konforka::exception(CODEPOINT,"no content attached");
+ }
+
+ /**
+ * Get the content attached to the object. It would throw an
+ * exception if there is no content attached.
+ * @return reference to the content.
+ */
+ virtual content_type& get_content() {
+ ensure();
+ return opkele;
+ }
+ /**
+ * Get the content attached to the object. It would throw an
+ * exception if there is no content attached.
+ * @return const reference to the content.
+ */
+ virtual const content_type& get_content() const {
+ ensure();
+ return opkele;
+ }
+
+ /**
+ * Casts the object to the reference to the content type,
+ * throwing an exception if there's no content associated with
+ * an object.
+ * @return reference to the content attached.
+ * @see get_content()
+ */
+ operator const content_type&(void) const { return get_content(); }
+ /**
+ * Casts the object to the const reference to the content type,
+ * throwing an exception if there's no content associated with
+ * an object.
+ * @return reference to the content attached.
+ * @see get_content()
+ */
+ operator content_type&(void) { return get_content(); }
+ };
+
+}
+
+#endif /* __KONFORKA_BASIC_WRAPPER_H */
+/* vim:set ft=cpp: */
diff --git a/include/konforka/exception.h b/include/konforka/exception.h
new file mode 100644
index 0000000..5e0bf96
--- a/dev/null
+++ b/include/konforka/exception.h
@@ -0,0 +1,203 @@
+#ifndef __KONFORKA_EXCEPTION_H
+#define __KONFORKA_EXCEPTION_H
+
+#include <exception>
+#include <string>
+#include <list>
+
+/**
+ * @file
+ * @brief exception-related stuff.
+ *
+ * Basic exception-related declarations and definitions.
+ */
+
+/**
+ * @def CODEPOINT
+ * the convenience definition of the parameters passed to the
+ * konforka::code_point constructor.
+ */
+#define CODEPOINT __FILE__,__PRETTY_FUNCTION__,__LINE__
+/**
+ * @def NOCODEPOINT
+ * the convenience definition for the codepoint denoting no particular point in
+ * code.
+ */
+#define NOCODEPOINT "no information"
+
+/**
+ * @brief The main konforka namespace.
+ */
+namespace konforka {
+ using std::string;
+ using std::list;
+
+ /**
+ * @brief Pinpoint the code context.
+ *
+ * Class, holding the point in code, for instance, where the exception
+ * occured.
+ */
+ class code_point {
+ public:
+ /**
+ * The string describing the point in code.
+ */
+ string where;
+ /**
+ * The file (as provided by __FILE__) if available.
+ */
+ string file;
+ /**
+ * The function name (as provided by __PRETTY_FUNCTION__) if
+ * available.
+ */
+ string function;
+ /**
+ * The line number (as provided by __LINE__) if available.
+ */
+ int line;
+
+ /**
+ * Constructs the object, using only textual description of the
+ * point in code (no file, function, line information).
+ * @param w the description of the point in code.
+ */
+ code_point(const string& w);
+ /**
+ * Constructs the object, specifying the exact position in code.
+ * @param fi source file name.
+ * @param fu function name.
+ * @param l the line number.
+ */
+ code_point(const string& fi,const string& fu,int l);
+
+ /**
+ * Extract the information on the point in code.
+ * @return the reference to the character string.
+ * @see where
+ */
+ const char *c_str() const throw();
+
+ /**
+ * Build the textual description from the broken down information on
+ * the point in code.
+ * @see where
+ * @see file
+ * @see function
+ * @see line
+ */
+ void make_where();
+ };
+
+ /**
+ * @brief The basic exception class.
+ */
+ class exception : public std::exception {
+ public:
+ /**
+ * The string, containing the description of exception.
+ */
+ string _what;
+ /**
+ * Reference to the point in code where the exception has occured.
+ */
+ code_point _where;
+ /**
+ * In case the exception has been rethrown a number of times, here
+ * we can trace where was it seen (a kind of backtrace).
+ */
+ list<code_point> _seen;
+
+ /**
+ * The simple constructor, only providing textual information on the
+ * exception nature and the point in code where the exception has
+ * occured.
+ * @param whe the point in code.
+ * @param wha the description of exception.
+ */
+ exception(const string& whe, const string& wha);
+ /**
+ * The constructor, storing elaborate information on where the
+ * exception has occured.
+ * @param fi source file name.
+ * @param fu function name.
+ * @param l line number.
+ * @param w the error message.
+ * @see #CODEPOINT
+ */
+ exception(const string& fi,const string& fu,int l,const string& w);
+ virtual ~exception() throw();
+
+ /**
+ * Extract the textual information on the point in code where
+ * exception has occured.
+ * @return the string describing point in code where exception has
+ * occured.
+ */
+ virtual const char* where() const throw();
+ /**
+ * Extract the textual information on the nature of the exception.
+ * @return the error message.
+ */
+ virtual const char* what() const throw();
+
+ /**
+ * Register the point in code (described by the string) in the
+ * 'backtrace' list.
+ * @param w the description of the point in code.
+ */
+ void see(const string& w);
+ /**
+ * Register the point in code in the 'backtrace' list.
+ * @param fi souce file name.
+ * @param fu function name.
+ * @param l line number.
+ * @see CODEPOINT
+ */
+ void see(const string& fi,const string& fu,int l);
+ };
+
+ /**
+ * @brief errno-holding exception.
+ *
+ * The exception object storing the information provided by the errno
+ * variable.
+ */
+ class system_error : public exception {
+ public:
+ /**
+ * The value of errno.
+ */
+ int _errno;
+
+ /**
+ * Construct the exception object storing plain text information on
+ * the point in code.
+ * @param whe the description of point in code.
+ * @param wha the error message.
+ */
+ system_error(const string& whe,const string& wha);
+ /**
+ * Construct the exception object storing elaborate information on
+ * the point in code where it has occured.
+ * @param fi source file name.
+ * @param fu function name.
+ * @param l line number.
+ * @param w the error message.
+ * @see CODEPOINT
+ */
+ system_error(const string& fi,const string& fu,int l,const string& w);
+ virtual ~system_error() throw();
+
+ /**
+ * Return the information on the system error recorded.
+ * @return the string describing the error occured.
+ */
+ virtual const char* why() const throw();
+ };
+
+}
+
+#endif /* __KONFORKA_EXCEPTION_H */
+/* vim:set ft=cpp: */
diff --git a/include/konforka/pointer_map.h b/include/konforka/pointer_map.h
new file mode 100644
index 0000000..d706e71
--- a/dev/null
+++ b/include/konforka/pointer_map.h
@@ -0,0 +1,105 @@
+#ifndef __KONFORKA_POINTER_MAP_H
+#define __KONFORKA_POINTER_MAP_H
+
+#include <typeinfo>
+
+/**
+ * @file
+ * @brief mapping of pointers.
+ *
+ * The support for global mapping of pointers. Useful when using third-party
+ * libraries callbacks when the library does not provide mechanism for passing
+ * along custom context-dependent data.
+ */
+
+namespace konforka {
+
+ /**
+ * @brief internally used actual implementation of mapping pointer.
+ *
+ * @param tf the typeid of the key pointer.
+ * @param pf the key pointer.
+ * @param tt the typeid of the value pointer.
+ * @param pt the value pointer.
+ */
+ void _map_pointer(const type_info& tf,void *pf,const type_info& tt,void *pt);
+ /**
+ * @brief internally used actual implementation of destroying mapped
+ * pointer.
+ *
+ * @param tf the typeid of the key pointer.
+ * @param pf the key pointer.
+ * @param tt the typeid of the value pointer.
+ * @param pt the value pointer.
+ */
+ void _unmap_pointer(const type_info& tf,void *pf,const type_info& tt,void *pt);
+ /**
+ * @brief internally used actual implementation of retrieving mapped
+ * pointer.
+ *
+ * @param tf the typeid of the key pointer.
+ * @param pf the key pointer.
+ * @param tt the typeid of the value pointer.
+ * @return the value.
+ */
+ void *_mapped_pointer(const type_info& tf,void *pf,const type_info& tt);
+
+ /**
+ * @brief the object, maintaining mapped pointer.
+ *
+ * @param from_t the key type.
+ * @param to_t the value type.
+ */
+ template<typename from_t,typename to_t>
+ class map_pointer {
+ public:
+ /**
+ * stored key.
+ */
+ from_t _from;
+ /**
+ * stored value.
+ */
+ to_t _to;
+ /**
+ * flag, specifying that the object is currently mapped.
+ */
+ bool bmapped;
+
+ /**
+ * @brief constructs the object, mapping the key/value pair.
+ *
+ * @param f the key.
+ * @param t the value.
+ */
+ map_pointer(from_t f,to_t t)
+ : _from(f), _to(t), bmapped(false) {
+ _map_pointer(typeid(from_t),_from,typeid(to_t),_to);
+ bmapped=true;
+ }
+ /**
+ * @brief destructor unmaps the key/value pair stored.
+ */
+ ~map_pointer() {
+ if(bmapped)
+ _unmap_pointer(typeid(from_t),_from,typeid(to_t),_to);
+ }
+ };
+
+ /**
+ * The template function for pointer retrieval.
+ *
+ * @param from_t the key type.
+ * @param to_t the value type.
+ * @param f the key.
+ * @return the value.
+ */
+ template<typename from_t,typename to_t>
+ to_t mapped_pointer(from_t f) {
+ return (to_t)_mapped_pointer(typeid(from_t),f,typeid(to_t));
+ }
+
+}
+
+#endif /* __KONFORKA_POINTER_MAP_H */
+/* vim:set ft=cpp: */
diff --git a/include/konforka/pqxx_pile.h b/include/konforka/pqxx_pile.h
new file mode 100644
index 0000000..fdfaed6
--- a/dev/null
+++ b/include/konforka/pqxx_pile.h
@@ -0,0 +1,59 @@
+#ifndef __KONFORKA_PQXX_PILE_H
+#define __KONFORKA_PQXX_PILE_H
+
+#include <pqxx/connection>
+#include <konforka/resource_pile.h>
+
+/**
+ * @file
+ * @brief libpqxx-based postgresql connections pile.
+ */
+
+namespace konforka {
+
+ /**
+ * @brief the base for pqxx-based connection classes.
+ *
+ * @param pqxxc_t the type of libpqxx connection (pqxx::connection,
+ * pqxx::lazyconnection or pqxx::asyncconnection).
+ */
+ template<typename pqxxc_t>
+ class pqxx_piled_connection_base : public resource_pile_base<string,pqxxc_t*, resource_pile_generic_ptr_factory<string,pqxxc_t> > {
+ public:
+ /**
+ * @brief the constractor based on connection info.
+ *
+ * @param ci connection info string.
+ */
+ pqxx_piled_connection_base(const string& ci)
+ : resource_pile_base<string,pqxxc_t*, resource_pile_generic_ptr_factory<string,pqxxc_t> >(ci) { }
+ ~pqxx_piled_connection_base() { this->drop(); }
+
+ /**
+ * @brief cast the object to the reference to the corresponding
+ * libpqxx type.
+ */
+ operator pqxxc_t&(void) { return *this->get_content(); }
+ /**
+ * @brief cast the object to the const reference to the
+ * corresponding libpqxx type.
+ */
+ operator const pqxxc_t&(void) const { return *this->get_content(); }
+ };
+
+ /**
+ * @brief the implementation for piling pqxx::connection objects.
+ */
+ typedef pqxx_piled_connection_base<pqxx::connection> pqxx_piled_connection;
+ /**
+ * @brief the implementation for piling pqxx::lazyconnection objects.
+ */
+ typedef pqxx_piled_connection_base<pqxx::lazyconnection> pqxx_piled_lazy_connection;
+ /**
+ * @brief the implementation for piling pqxx::asyncconnection objects.
+ */
+ typedef pqxx_piled_connection_base<pqxx::asyncconnection> pqxx_piled_async_connection;
+}
+
+#endif /* __KONFORKA_PQXX_PILE_H */
+/* vim:set ft=cpp: */
diff --git a/include/konforka/resource_pile.h b/include/konforka/resource_pile.h
new file mode 100644
index 0000000..d76a07b
--- a/dev/null
+++ b/include/konforka/resource_pile.h
@@ -0,0 +1,118 @@
+#ifndef __KONFORKA_RESOURCE_PILE_H
+#define __KONFORKA_RESOURCE_PILE_H
+
+#include <map>
+#include <konforka/responsible_wrapper.h>
+
+/**
+ * @file
+ * @brief resource-piling base support.
+ *
+ * Base for implementing resource-piling.
+ */
+
+namespace konforka {
+ using std::multimap;
+ using std::pair;
+
+ /**
+ * @brief template base class for resource piling.
+ *
+ * @param key_t the type used for keying resources.
+ * @param value_t the type of resource itself.
+ * @param factory_t the factory class, providing value_t allocate(key_t)
+ * static member.
+ */
+ template<typename key_t,typename value_t,typename factory_t>
+ class resource_pile_base : public responsible_wrapper<value_t> {
+ /**
+ * @brief the type of the pile container itself.
+ */
+ typedef multimap<key_t,value_t> pile_t;
+ /*
+ * @brief the pile of resources.
+ */
+ static pile_t pile;
+ public:
+ /**
+ * @brief stored value for the key associated with the resource
+ * contained.
+ */
+ key_t _key;
+
+ /**
+ * @brief default constructor fetches or allocates resource.
+ *
+ * @param k the key for resource.
+ * @see allocate
+ */
+ resource_pile_base(const key_t& k) {
+ allocate(k);
+ }
+ /**
+ * @brief destructor releases the resource back to pile.
+ */
+ virtual ~resource_pile_base() { this->drop(); }
+
+ /**
+ * @brief this is where the resource is handed back to pile.
+ */
+ void release() {
+ pile.insert(pair<key_t,value_t>(_key,this->opkele));
+ }
+
+ /**
+ * @brief fetch from pile or allocate the resource.
+ *
+ * Try to see if we have a piled resource keyed to the argument. If
+ * we do -- fetch it from the pile, otherwise allocate anew.
+ *
+ * @param k the key for resource.
+ */
+ void allocate(const key_t& k) {
+ this->drop();
+ typename pile_t::iterator i = pile.find(k);
+ if(i==pile.end()) {
+ this->attach(factory_t::allocate(k));
+ }else{
+ this->attach(i->second);
+ try{ pile.erase(i); }catch(...){ _key = k; throw; }
+ }
+ _key = k;
+ }
+
+ };
+
+ template<typename key_t,typename value_t,typename factory_t>
+ typename resource_pile_base<key_t,value_t,factory_t>::pile_t
+ resource_pile_base<key_t,value_t,factory_t>::pile;
+
+ /**
+ * @brief the generic single parameter new-based resource factory.
+ *
+ * The generic resource factory using new as a way to allocate resource
+ * using the single-parameter constructor.
+ *
+ * @param key_t the key type.
+ * @param value_t the resource type.
+ *
+ * @see resource_pile_base
+ */
+ template<typename key_t,typename value_t>
+ struct resource_pile_generic_ptr_factory {
+ public:
+ /**
+ * @brief allocate the resource using new.
+ *
+ * @param k the key.
+ * @return pointer to the newly allocated object.
+ */
+ static value_t *allocate(const key_t& k) {
+ return new value_t(k);
+ }
+ };
+
+}
+
+#endif /* __KONFORKA_RESOURCE_PILE_H */
+/* vim:set ft=cpp: */
diff --git a/include/konforka/responsible_wrapper.h b/include/konforka/responsible_wrapper.h
new file mode 100644
index 0000000..374ad45
--- a/dev/null
+++ b/include/konforka/responsible_wrapper.h
@@ -0,0 +1,99 @@
+#ifndef __KONFORKA_RESPONSIBLE_WRAPPER_H
+#define __KONFORKA_RESPONSIBLE_WRAPPER_H
+
+/**
+ * @file
+ * @brief The konforka::responsible_wrapper class declaration.
+ */
+
+#include <konforka/basic_wrapper.h>
+
+namespace konforka {
+
+ /**
+ * @brief The auto-cleanup wrapper class.
+ *
+ * The wrapper class that may feel responsible for releasing the resources
+ * associated with the content attached.
+ *
+ */
+ template<typename T>
+ class responsible_wrapper : public basic_wrapper<T> {
+ public:
+ /**
+ * The type of wrapped content.
+ */
+ typedef typename basic_wrapper<T>::content_type content_type;
+ /**
+ * Flag indicating whether the object feels responsible for
+ * releasing resources associated with the content.
+ */
+ bool bresponsible;
+
+ /**
+ * Default constructor creates the object with no content
+ * attached.
+ */
+ responsible_wrapper()
+ : basic_wrapper<content_type>() { }
+ /**
+ * Constructor, associating the content with the instance.
+ * @param o the content.
+ * @param br indicates whether resources associated with the
+ * content should be released.
+ */
+ responsible_wrapper(content_type o,bool br=true)
+ : basic_wrapper<content_type>(o), bresponsible(br) { }
+ /**
+ * Destructor releases resources associated with the content
+ * attached (if any), if the instance feels responsible for the
+ * content.
+ */
+ virtual ~responsible_wrapper() { drop(); }
+
+ /**
+ * Attaches the given content to the object.
+ * @param o the content.
+ * @param br indicates whether the object should feel
+ * responsible for releasing the content.
+ */
+ void attach(content_type o,bool br=true) {
+ drop();
+ basic_wrapper<content_type>::attach(o);
+ bresponsible = true;
+ }
+
+ /**
+ * 'empties' object, releasing resources associated with the
+ * content if it feels responsible.
+ */
+ virtual void drop() {
+ if(!this->is())
+ return;
+ if(bresponsible)
+ release();
+ this->bopkele = false;
+ }
+
+ /**
+ * Detaches the content from the object without releasing
+ * resources even if feels responsible for it.
+ * @return the content attached.
+ */
+ virtual content_type detach() {
+ this->ensure();
+ this->bopkele = false;
+ return this->opkele;
+ }
+
+ /**
+ * Pure virtual provided for derived classes to override for
+ * doing whatever it takes to release resources associated with
+ * the content.
+ */
+ virtual void release() = 0;
+ };
+}
+
+#endif /* __KONFORKA_RESPONSIBLE_WRAPPER_H */
+/* vim:set ft=cpp: */
diff --git a/konforka.pc.in b/konforka.pc.in
new file mode 100644
index 0000000..81b1d2f
--- a/dev/null
+++ b/konforka.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: konforka
+Description: Convenience library for common KIN project code
+Version: @VERSION@
+Requires: @PC_REQ_PQXX@
+Libs: -L${libdir} -lkonforka
+Cflags: -I${includedir}
diff --git a/lib/.gitignore b/lib/.gitignore
new file mode 100644
index 0000000..7a5e754
--- a/dev/null
+++ b/lib/.gitignore
@@ -0,0 +1,7 @@
+Makefile.in
+.libs
+.deps
+Makefile
+*.lo
+*.o
+*.la
diff --git a/lib/Makefile.am b/lib/Makefile.am
new file mode 100644
index 0000000..a904569
--- a/dev/null
+++ b/lib/Makefile.am
@@ -0,0 +1,16 @@
+lib_LTLIBRARIES = libkonforka.la
+
+INCLUDES = -I${top_srcdir}/include
+AM_CXXFLAGS = ${PQXX_CFLAGS}
+LDADD = ${PQXX_LIBS}
+
+EXTRA_DIST = pqxx_pile.cc
+EXTRA_SOURCES=
+if HAVE_PQXX
+EXTRA_SOURCES += pqxx_pile.cc
+endif
+
+libkonforka_la_SOURCES = \
+ exception.cc \
+ pointer_map.cc \
+ ${EXTRA_SOURCES}
diff --git a/lib/exception.cc b/lib/exception.cc
new file mode 100644
index 0000000..65302bf
--- a/dev/null
+++ b/lib/exception.cc
@@ -0,0 +1,66 @@
+#include <string.h>
+#include <errno.h>
+#include "konforka/exception.h"
+
+namespace konforka {
+
+ /*
+ * code_point
+ */
+
+ code_point::code_point(const string& w)
+ : where(w), line(-1) { }
+ code_point::code_point(const string& fi,const string& fu,int l)
+ : file(fi), function(fu), line(l) {
+ make_where();
+ }
+
+ const char *code_point::c_str() const throw() {
+ return where.c_str();
+ }
+
+ void code_point::make_where() {
+ static char tmp[8];
+ snprintf(tmp,sizeof(tmp),"%d",line);
+ where = file + ":" + tmp + " [" + function + "]";
+ }
+
+ /*
+ * exception
+ */
+
+ exception::exception(const string& whe,const string& wha)
+ : _where(whe), _what(wha) { }
+ exception::exception(const string& fi,const string& fu,int l,const string& w)
+ : _where(fi,fu,l), _what(w) { }
+ exception::~exception() throw() { }
+
+ const char *exception::where() const throw() {
+ return _where.c_str();
+ }
+ const char *exception::what() const throw() {
+ return _what.c_str();
+ }
+
+ void exception::see(const string& w) {
+ _seen.push_back(code_point(w));
+ }
+ void exception::see(const string& fi,const string& fu,int l) {
+ _seen.push_back(code_point(fi,fu,l));
+ }
+
+ /*
+ * system_error
+ */
+
+ system_error::system_error(const string& whe,const string& wha)
+ : _errno(errno), exception(whe,wha) { }
+ system_error::system_error(const string& fi,const string& fu,int l,const string& w)
+ : _errno(errno), exception(fi,fu,l,w) { }
+ system_error::~system_error() throw() { }
+
+ const char *system_error::why() const throw() {
+ return strerror(errno); // TODO: strerror_r
+ }
+
+}
diff --git a/lib/pointer_map.cc b/lib/pointer_map.cc
new file mode 100644
index 0000000..44f7ebc
--- a/dev/null
+++ b/lib/pointer_map.cc
@@ -0,0 +1,74 @@
+#include <cassert>
+#include <map>
+#include <string>
+using namespace std;
+#include "konforka/exception.h"
+#include "konforka/pointer_map.h"
+
+namespace konforka {
+
+ /*
+ * to_t->from_t->from->to
+ */
+ class mpointer_t {
+ public:
+ void *ptr;
+ int ref;
+
+ mpointer_t() : ptr(0), ref(0) { }
+
+ void _ref() { ref++; }
+ void _unref() { ref--; }
+ };
+ typedef map<void*,mpointer_t> map_ptr_1_t;
+ typedef map<string,map_ptr_1_t> map_ptr_2_t;
+ typedef map<string,map_ptr_2_t> map_ptr_t;
+
+ static map_ptr_t pointer_map;
+
+ void _map_pointer(const type_info& tf,void *pf,const type_info& tt,void *pt) {
+ mpointer_t& mpt = pointer_map[tf.name()][tt.name()][pf];
+ if(mpt.ref) {
+ if(mpt.ptr != pt)
+ throw exception(CODEPOINT,"trying to remap existing pointer with different value");
+ }else{
+ mpt.ptr = pt;
+ }
+ mpt.ref++;
+ }
+ void _unmap_pointer(const type_info& tf,void *pf,const type_info& tt,void *pt) {
+ map_ptr_t::iterator i1 = pointer_map.find(tf.name());
+ if(i1==pointer_map.end())
+ throw exception(CODEPOINT,"no pointer of such type has ever been mapped");
+ map_ptr_2_t::iterator i2 = i1->second.find(tt.name());
+ if(i2==i1->second.end())
+ throw exception(CODEPOINT,"no pointer has ever been mapped to the object of this type");
+ map_ptr_1_t::iterator i3 = i2->second.find(pf);
+ if(i3==i2->second.end())
+ throw exception(CODEPOINT,"this pointer has never been mapped");
+ assert(i3->second.ref>0);
+ if(--(i3->second.ref))
+ return;
+ i2->second.erase(i3);
+ if(!i2->second.empty())
+ return;
+ i1->second.erase(i2);
+ if(!i1->second.empty())
+ return;
+ pointer_map.erase(i1);
+ }
+ void *_mapped_pointer(const type_info& tf,void *pf,const type_info& tt) {
+ map_ptr_t::iterator i1 = pointer_map.find(tf.name());
+ if(i1==pointer_map.end())
+ throw exception(CODEPOINT,"no pointer of such type has ever been mapped");
+ map_ptr_2_t::iterator i2 = i1->second.find(tt.name());
+ if(i2==i1->second.end())
+ throw exception(CODEPOINT,"no pointer has ever been mapped to the object of this type");
+ map_ptr_1_t::iterator i3 = i2->second.find(pf);
+ if(i3==i2->second.end())
+ throw exception(CODEPOINT,"this pointer has never been mapped");
+ assert(i3->second.ref>0);
+ return i3->second.ptr;
+ }
+
+}
diff --git a/lib/pqxx_pile.cc b/lib/pqxx_pile.cc
new file mode 100644
index 0000000..d6623bb
--- a/dev/null
+++ b/lib/pqxx_pile.cc
@@ -0,0 +1,17 @@
+#include "konforka/pqxx_pile.h"
+
+namespace konforka {
+
+ template class resource_pile_generic_ptr_factory<string,pqxx::connection>;
+ template class resource_pile_generic_ptr_factory<string,pqxx::lazyconnection>;
+ template class resource_pile_generic_ptr_factory<string,pqxx::asyncconnection>;
+
+ template class resource_pile_base<string,pqxx::connection*,resource_pile_generic_ptr_factory<string,pqxx::connection> >;
+ template class resource_pile_base<string,pqxx::lazyconnection*,resource_pile_generic_ptr_factory<string,pqxx::lazyconnection> >;
+ template class resource_pile_base<string,pqxx::asyncconnection*,resource_pile_generic_ptr_factory<string,pqxx::asyncconnection> >;
+
+ template class pqxx_piled_connection_base<pqxx::connection>;
+ template class pqxx_piled_connection_base<pqxx::lazyconnection>;
+ template class pqxx_piled_connection_base<pqxx::asyncconnection>;
+
+}