summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2005-01-29 19:41:34 (UTC)
committer Michael Krelin <hacker@klever.net>2005-01-29 19:41:34 (UTC)
commitee7ac58694c16cdd922a6eeddbe1a2eba0da7b4e (patch) (unidiff)
treebe8029ce4a68870d991651927a27df8ee9d89617
parentd851b00e16839d6ec14da3a5c442be62ca868bba (diff)
downloadkonforka-ee7ac58694c16cdd922a6eeddbe1a2eba0da7b4e.zip
konforka-ee7ac58694c16cdd922a6eeddbe1a2eba0da7b4e.tar.gz
konforka-ee7ac58694c16cdd922a6eeddbe1a2eba0da7b4e.tar.bz2
initial commit.0.0
Diffstat (more/less context) (ignore 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 @@
1configure
2Makefile.in
3Doxyfile
4config.log
5depcomp
6config.guess
7config.h
8ltmain.sh
9config.sub
10INSTALL
11konforka.pc
12NEWS
13Makefile
14config.status
15stamp-h1
16doxydox
17config.h.in
18libtool
19autom4te.cache
20missing
21aclocal.m4
22install-sh
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..a9fb0c7
--- a/dev/null
+++ b/AUTHORS
@@ -0,0 +1,3 @@
1Klever dissected:
2 Michael 'hacker' Krelin <hacker@klever.net>
3 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 @@
1Copyright (c) 2004-2005 Klever Group (http://www.klever.net/)
2
3Permission is hereby granted, free of charge, to any person obtaining a copy of
4this software and associated documentation files (the "Software"), to deal in
5the Software without restriction, including without limitation the rights to
6use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7of the Software, and to permit persons to whom the Software is furnished to do
8so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in all
11copies or substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19SOFTWARE.
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 @@
1# Doxyfile 1.3.9.1
2
3#---------------------------------------------------------------------------
4# Project related configuration options
5#---------------------------------------------------------------------------
6PROJECT_NAME = @PACKAGE@
7PROJECT_NUMBER = @VERSION@
8OUTPUT_DIRECTORY = @builddir@/doxydox
9CREATE_SUBDIRS = NO
10OUTPUT_LANGUAGE = English
11USE_WINDOWS_ENCODING = NO
12BRIEF_MEMBER_DESC = YES
13REPEAT_BRIEF = YES
14ABBREVIATE_BRIEF =
15ALWAYS_DETAILED_SEC = NO
16INLINE_INHERITED_MEMB = NO
17FULL_PATH_NAMES = YES
18STRIP_FROM_PATH = include
19STRIP_FROM_INC_PATH = include
20SHORT_NAMES = NO
21JAVADOC_AUTOBRIEF = NO
22MULTILINE_CPP_IS_BRIEF = NO
23DETAILS_AT_TOP = NO
24INHERIT_DOCS = YES
25DISTRIBUTE_GROUP_DOC = NO
26TAB_SIZE = 8
27ALIASES =
28OPTIMIZE_OUTPUT_FOR_C = NO
29OPTIMIZE_OUTPUT_JAVA = NO
30SUBGROUPING = YES
31
32#---------------------------------------------------------------------------
33# Build related configuration options
34#---------------------------------------------------------------------------
35
36EXTRACT_ALL = NO
37EXTRACT_PRIVATE = NO
38EXTRACT_STATIC = NO
39EXTRACT_LOCAL_CLASSES = YES
40EXTRACT_LOCAL_METHODS = NO
41HIDE_UNDOC_MEMBERS = NO
42HIDE_UNDOC_CLASSES = NO
43HIDE_FRIEND_COMPOUNDS = NO
44HIDE_IN_BODY_DOCS = NO
45INTERNAL_DOCS = NO
46CASE_SENSE_NAMES = YES
47HIDE_SCOPE_NAMES = NO
48SHOW_INCLUDE_FILES = NO
49INLINE_INFO = YES
50SORT_MEMBER_DOCS = YES
51SORT_BRIEF_DOCS = NO
52SORT_BY_SCOPE_NAME = YES
53GENERATE_TODOLIST = YES
54GENERATE_TESTLIST = YES
55GENERATE_BUGLIST = YES
56GENERATE_DEPRECATEDLIST= YES
57ENABLED_SECTIONS =
58MAX_INITIALIZER_LINES = 30
59SHOW_USED_FILES = NO
60SHOW_DIRECTORIES = YES
61
62#---------------------------------------------------------------------------
63# configuration options related to warning and progress messages
64#---------------------------------------------------------------------------
65
66QUIET = NO
67WARNINGS = YES
68WARN_IF_UNDOCUMENTED = YES
69WARN_IF_DOC_ERROR = YES
70WARN_FORMAT = "$file:$line: $text"
71WARN_LOGFILE =
72
73#---------------------------------------------------------------------------
74# configuration options related to the input files
75#---------------------------------------------------------------------------
76
77INPUT = \
78 @srcdir@/include/konforka/
79FILE_PATTERNS = *.h
80RECURSIVE = NO
81EXCLUDE =
82EXCLUDE_SYMLINKS = NO
83EXCLUDE_PATTERNS =
84EXAMPLE_PATH =
85EXAMPLE_PATTERNS =
86EXAMPLE_RECURSIVE = NO
87IMAGE_PATH =
88INPUT_FILTER =
89FILTER_PATTERNS =
90FILTER_SOURCE_FILES = NO
91
92#---------------------------------------------------------------------------
93# configuration options related to source browsing
94#---------------------------------------------------------------------------
95
96SOURCE_BROWSER = NO
97INLINE_SOURCES = NO
98STRIP_CODE_COMMENTS = YES
99REFERENCED_BY_RELATION = YES
100REFERENCES_RELATION = YES
101VERBATIM_HEADERS = YES
102
103#---------------------------------------------------------------------------
104# configuration options related to the alphabetical class index
105#---------------------------------------------------------------------------
106
107ALPHABETICAL_INDEX = YES
108COLS_IN_ALPHA_INDEX = 2
109IGNORE_PREFIX =
110
111#---------------------------------------------------------------------------
112# configuration options related to the HTML output
113#---------------------------------------------------------------------------
114
115GENERATE_HTML = YES
116HTML_OUTPUT = html
117HTML_FILE_EXTENSION = .html
118HTML_HEADER =
119HTML_FOOTER =
120HTML_STYLESHEET =
121HTML_ALIGN_MEMBERS = YES
122GENERATE_HTMLHELP = NO
123CHM_FILE =
124HHC_LOCATION =
125GENERATE_CHI = NO
126BINARY_TOC = NO
127TOC_EXPAND = NO
128DISABLE_INDEX = NO
129ENUM_VALUES_PER_LINE = 4
130GENERATE_TREEVIEW = NO
131TREEVIEW_WIDTH = 250
132
133#---------------------------------------------------------------------------
134# configuration options related to the LaTeX output
135#---------------------------------------------------------------------------
136
137GENERATE_LATEX = NO
138LATEX_OUTPUT = latex
139LATEX_CMD_NAME = latex
140MAKEINDEX_CMD_NAME = makeindex
141COMPACT_LATEX = NO
142PAPER_TYPE = a4wide
143EXTRA_PACKAGES =
144LATEX_HEADER =
145PDF_HYPERLINKS = NO
146USE_PDFLATEX = NO
147LATEX_BATCHMODE = NO
148LATEX_HIDE_INDICES = NO
149
150#---------------------------------------------------------------------------
151# configuration options related to the RTF output
152#---------------------------------------------------------------------------
153
154GENERATE_RTF = NO
155RTF_OUTPUT = rtf
156COMPACT_RTF = NO
157RTF_HYPERLINKS = NO
158RTF_STYLESHEET_FILE =
159RTF_EXTENSIONS_FILE =
160
161#---------------------------------------------------------------------------
162# configuration options related to the man page output
163#---------------------------------------------------------------------------
164
165GENERATE_MAN = NO
166MAN_OUTPUT = man
167MAN_EXTENSION = .3
168MAN_LINKS = YES
169
170#---------------------------------------------------------------------------
171# configuration options related to the XML output
172#---------------------------------------------------------------------------
173
174GENERATE_XML = YES
175XML_OUTPUT = xml
176XML_SCHEMA =
177XML_DTD =
178XML_PROGRAMLISTING = YES
179
180#---------------------------------------------------------------------------
181# configuration options for the AutoGen Definitions output
182#---------------------------------------------------------------------------
183
184GENERATE_AUTOGEN_DEF = NO
185
186#---------------------------------------------------------------------------
187# configuration options related to the Perl module output
188#---------------------------------------------------------------------------
189
190GENERATE_PERLMOD = NO
191PERLMOD_LATEX = NO
192PERLMOD_PRETTY = YES
193PERLMOD_MAKEVAR_PREFIX =
194
195#---------------------------------------------------------------------------
196# Configuration options related to the preprocessor
197#---------------------------------------------------------------------------
198
199ENABLE_PREPROCESSING = YES
200MACRO_EXPANSION = NO
201EXPAND_ONLY_PREDEF = NO
202SEARCH_INCLUDES = YES
203INCLUDE_PATH =
204INCLUDE_FILE_PATTERNS =
205PREDEFINED =
206EXPAND_AS_DEFINED =
207SKIP_FUNCTION_MACROS = YES
208
209#---------------------------------------------------------------------------
210# Configuration::additions related to external references
211#---------------------------------------------------------------------------
212
213TAGFILES =
214GENERATE_TAGFILE =
215ALLEXTERNALS = NO
216EXTERNAL_GROUPS = YES
217PERL_PATH = /usr/bin/perl
218
219#---------------------------------------------------------------------------
220# Configuration options related to the dot tool
221#---------------------------------------------------------------------------
222
223CLASS_DIAGRAMS = YES
224HIDE_UNDOC_RELATIONS = YES
225HAVE_DOT = @HAVE_DOT@
226CLASS_GRAPH = YES
227COLLABORATION_GRAPH = YES
228UML_LOOK = NO
229TEMPLATE_RELATIONS = YES
230INCLUDE_GRAPH = YES
231INCLUDED_BY_GRAPH = YES
232CALL_GRAPH = NO
233GRAPHICAL_HIERARCHY = YES
234DOT_IMAGE_FORMAT = png
235DOT_PATH = @DOT@
236DOTFILE_DIRS =
237MAX_DOT_GRAPH_WIDTH = 1024
238MAX_DOT_GRAPH_HEIGHT = 1024
239MAX_DOT_GRAPH_DEPTH = 0
240GENERATE_LEGEND = YES
241DOT_CLEANUP = YES
242
243#---------------------------------------------------------------------------
244# Configuration::additions related to the search engine
245#---------------------------------------------------------------------------
246
247SEARCHENGINE = 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 @@
1SUBDIRS=include lib
2EXTRA_DIST = NEWS NEWS.xml NEWS.xsl
3
4DISTCHECK_CONFIGURE_FLAGS=--with-pkgconfigdir=$${dc_install_base}/lib/pkgconfig
5if HAVE_PKGCONFIG
6pkgconfigdir=@PKGCONFIG_DIR@
7pkgconfig_DATA=konforka.pc
8endif
9
10LOCAL_TARGETS=
11if HAVE_DOXYGEN
12LOCAL_TARGETS+=doxygen
13endif
14
15all-local: NEWS $(addprefix all-lota-,${LOCAL_TARGETS})
16clean-local: $(addprefix clean-lota-,${LOCAL_TARGETS})
17
18NEWS: NEWS.xsl NEWS.xml
19 ${XSLTPROC} -o $@ NEWS.xsl NEWS.xml
20
21all-lota-doxygen: doxydox/built
22doxydox/built: $(wildcard ${top_srcdir}/include/konforka/*.h)
23 ${DOXYGEN}
24 touch $@
25
26clean-lota-doxygen:
27 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 @@
1<?xml version="1.0" encoding="us-ascii"?>
2<news>
3 <version version="0.0" date="January 29th, 2005">
4 <ni>Initial release</ni>
5 </version>
6</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 @@
1<?xml version="1.0" encoding="us-ascii"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 >
5 <xsl:output
6 method="text"
7 encoding="us-ascii"
8 media-type="text/plain" />
9
10 <xsl:template match="news">
11 <xsl:apply-templates/>
12 </xsl:template>
13 <xsl:template match="version">
14 <xsl:value-of select="concat(@version,' (',@date,')&#xA;')"/>
15 <xsl:apply-templates/>
16 </xsl:template>
17 <xsl:template match="ni">
18 <xsl:text> - </xsl:text>
19 <xsl:apply-templates mode="text"/>
20 <xsl:text>&#xA;</xsl:text>
21 </xsl:template>
22 <xsl:template match="*|text()"/>
23
24</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 @@
1dnl AC_WITH_PKGCONFIG([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]])
2dnl Outputs:
3dnl AC_SUBST: PKGCONFIG_PKGCONFIG PKGCONFIG_DIR
4dnl AM_CONDTIONAL: HAVE_PKGCONFIG
5AC_DEFUN([AC_WITH_PKGCONFIG],[
6 PKGCONFIG_PKGCONFIG=""
7 PKGCONFIG_DIR=""
8 HAVE_PKGCONFIG="no"
9 EXPLICIT_PKGCONFIGDIR="no"
10 test -z "${WANT_PKGCONFIG}" && WANT_PKGCONFIG=""
11 AC_PATH_PROG([PKGCONFIG_PKGCONFIG],[pkg-config],[false])
12 if test "${PKGCONFIG_PKGCONFIG}" != "false" ; then
13 AC_ARG_WITH([pkgconfigdir],
14 AC_HELP_STRING([--with-pkgconfigdir=dir],[Specify pkgconfig directory]),
15 [
16 if test "${withval}" = "no" ; then
17 WANT_PKGCONFIG="no"
18 else
19 PKGCONFIG_DIR="${withval}"
20 EXPLICIT_PKGCONFIGDIR="yes"
21 fi
22 ],[
23 AC_MSG_CHECKING([for pkgconfig directory])
24 PKGCONFIG_DIR="`${PKGCONFIG_PKGCONFIG} --debug 2>&1 | grep '^Scanning'| head -n 1 | cut -d\' -f2-|cut -d\' -f1`"
25 AC_MSG_RESULT([${PKGCONFIG_DIR}])
26 ]
27 )
28 if test -d "${PKGCONFIG_DIR}" ; then
29 HAVE_PKGCONFIG=yes
30 AC_SUBST([PKGCONFIG_PKGCONFIG])
31 AC_SUBST([PKGCONFIG_DIR])
32 else
33 AC_MSG_NOTICE([unexistent pkgconfig directory: ${PKGCONFIG_DIR}])
34 if test "${EXPLICIT_PKGCONFIGDIR}" = "yes" ; then
35 HAVE_PKGCONFIG=yes
36 AC_SUBST([PKGCONFIG_PKGCONFIG])
37 AC_SUBST([PKGCONFIG_DIR])
38 else
39 ifelse([$2], , :, [$2])
40 fi
41 fi
42 fi
43 AM_CONDITIONAL([HAVE_PKGCONFIG],[test "${HAVE_PKGCONFIG}" = "yes"])
44])
45
46dnl AC_WITH_DOXYGEN([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]])
47dnl Outputs:
48dnl AC_SUBST: DOXYGEN HAVE_DOXYGEN
49dnl AM_CONDTIONAL: HAVE_DOXYGEN
50AC_DEFUN([AC_WITH_DOXYGEN],[
51 HAVE_DOXYGEN="no"
52 AC_PATH_PROG([DOXYGEN],[doxygen],[false])
53 if test "${DOXYGEN}" = "false" ; then
54 ifelse([$2], , :, [$2])
55 else
56 HAVE_DOXYGEN="yes"
57 AC_SUBST([DOXYGEN])
58 $1
59 fi
60 AC_SUBST([HAVE_DOXYGEN])
61 AM_CONDITIONAL([HAVE_DOXYGEN],[test "${HAVE_DOXYGEN}" = "yes"])
62])
63
64dnl AC_WITH_DOT([ACTION-IF-FOUND[,ACTION-IF-NOT-FOUND]])
65dnl Outputs:
66dnl AC_SUBST: DOT HAVE_DOT
67dnl AM_CONDITIONAL: HAVE_DOT
68AC_DEFUN([AC_WITH_DOT],[
69 HAVE_DOT="no"
70 AC_PATH_PROG([DOT],[dot],[false])
71 if test "${DOT}" = "false" ; then
72 ifelse([$2], , :, [$2])
73 else
74 HAVE_DOT="yes"
75 AC_SUBST([DOT])
76 $1
77 fi
78AC_SUBST([HAVE_DOT])
79 AM_CONDITIONAL([HAVE_DOT],[test "${HAVE_DOT}" = "yes"])
80])
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 @@
1#!/bin/sh
2WANT_AUTOMAKE=1.8
3export WANT_AUTOMAKE
4libtoolize -f \
5&& aclocal \
6&& autoheader \
7&& automake -a \
8&& autoconf \
9&& ./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 @@
1AC_INIT([konforka], [0.0], [konforka-bugs@klever.net])
2AC_CONFIG_SRCDIR([include/konforka/exception.h])
3AC_CONFIG_HEADER([config.h])
4AM_INIT_AUTOMAKE([dist-bzip2])
5
6AC_PROG_INSTALL
7AC_PROG_AWK
8AC_PROG_CXX
9AC_PROG_CC
10AC_PROG_LIBTOOL
11
12AC_HEADER_STDC
13
14AC_C_CONST
15
16AC_FUNC_MALLOC
17AC_FUNC_REALLOC
18
19AC_PATH_PROG([XSLTPROC],[xsltproc],[true])
20
21AC_WITH_PKGCONFIG
22WANT_DOXYGEN="yes"
23AC_ARG_ENABLE([doxygen],
24 AC_HELP_STRING([--disable-doxygen],[do not generate documentation]),
25 [
26 test "${enableval}" = "no" && WANT_DOXYGEN="no"
27 ]
28)
29if test "${WANT_DOXYGEN}" = "yes" ; then
30 AC_WITH_DOXYGEN
31 AC_WITH_DOT
32else
33 AM_CONDITIONAL([HAVE_DOXYGEN],[false])
34 AM_CONDITIONAL([HAVE_DOT],[false])
35fi
36
37WANT_PQXX="yes"
38AC_ARG_WITH([libpqxx],
39 AC_HELP_STRING([--without-libpqxx],[do not build libpqxx connection pool support]),
40 [
41 test "${withval}" = "no" && WANT_PQXX="no"
42 ]
43)
44HAVE_PQXX="no"
45PC_REQ_PQXX=""
46if test "${WANT_PQXX}" = "yes" ; then
47 PKG_CHECK_MODULES([PQXX],[libpqxx],[
48 HAVE_PQXX="yes"
49 PC_REQ_PQXX="libpqxx"
50 ],[
51 AC_MSG_NOTICE([no libpqxx found, no connection piling support will be built])
52 ]
53 )
54fi
55AC_SUBST([PC_REQ_PQXX],[${PC_REQ_PQXX}])
56AM_CONDITIONAL([HAVE_PQXX],[test "${HAVE_PQXX}" = "yes"])
57
58AC_CONFIG_FILES([
59 Makefile
60 konforka.pc
61 Doxyfile
62 include/Makefile
63 lib/Makefile
64])
65AC_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 @@
1Makefile.in
2Makefile
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 @@
1EXTRA_DIST = konforka/pqxx_pile.h
2EXTRA_HEADERS=
3if HAVE_PQXX
4EXTRA_HEADERS += konforka/pqxx_pile.h
5endif
6
7nobase_include_HEADERS = \
8 konforka/exception.h \
9 konforka/basic_wrapper.h konforka/responsible_wrapper.h \
10 konforka/resource_pile.h \
11 konforka/pointer_map.h \
12 ${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 @@
1#ifndef __KONFORKA_BASIC_WRAPPER_H
2#define __KONFORKA_BASIC_WRAPPER_H
3
4/**
5 * @file
6 * @brief The konforka::basic_wrapper class declaration.
7 */
8
9#include <konforka/exception.h>
10
11namespace konforka {
12
13 /**
14 * @brief The basic wrapper class.
15 *
16 */
17 template<typename T>
18 class basic_wrapper {
19 public:
20 /**
21 * The type of wrapped content.
22 */
23 typedef T content_type;
24
25 /**
26 * The content wrapped into the instance.
27 */
28 content_type opkele;
29 /**
30 * This boolean indicates whether the object has a content
31 * attached to it.
32 */
33 bool bopkele;
34
35 /**
36 * Default constructors creates the object with no content
37 * associated with it.
38 */
39 basic_wrapper()
40 : bopkele(false) { }
41 /**
42 * The constructor associates the content give with the object.
43 * @param o the content being attached to the object.
44 */
45 basic_wrapper(content_type o)
46 : opkele(o), bopkele(true) { }
47 /**
48 * Virtual destructor doing nothing in this class.
49 */
50 virtual ~basic_wrapper() { }
51
52 /**
53 * Attaches the given content to the object.
54 * @param o the content being attached to the object.
55 */
56 void attach(content_type o) {
57 opkele = o;
58 bopkele = true;
59 }
60
61 /**
62 * Test whether the object has content attached.
63 * @return naturally, returns true if yes.
64 */
65 bool is() const {
66 return bopkele;
67 }
68
69 /**
70 * Throws an exception in case the object lacks content
71 * attached.
72 */
73 void ensure() const {
74 if(!is())
75 throw konforka::exception(CODEPOINT,"no content attached");
76 }
77
78 /**
79 * Get the content attached to the object. It would throw an
80 * exception if there is no content attached.
81 * @return reference to the content.
82 */
83 virtual content_type& get_content() {
84 ensure();
85 return opkele;
86 }
87 /**
88 * Get the content attached to the object. It would throw an
89 * exception if there is no content attached.
90 * @return const reference to the content.
91 */
92 virtual const content_type& get_content() const {
93 ensure();
94 return opkele;
95 }
96
97 /**
98 * Casts the object to the reference to the content type,
99 * throwing an exception if there's no content associated with
100 * an object.
101 * @return reference to the content attached.
102 * @see get_content()
103 */
104 operator const content_type&(void) const { return get_content(); }
105 /**
106 * Casts the object to the const reference to the content type,
107 * throwing an exception if there's no content associated with
108 * an object.
109 * @return reference to the content attached.
110 * @see get_content()
111 */
112 operator content_type&(void) { return get_content(); }
113 };
114
115}
116
117#endif /* __KONFORKA_BASIC_WRAPPER_H */
118/* 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 @@
1#ifndef __KONFORKA_EXCEPTION_H
2#define __KONFORKA_EXCEPTION_H
3
4#include <exception>
5#include <string>
6#include <list>
7
8/**
9 * @file
10 * @brief exception-related stuff.
11 *
12 * Basic exception-related declarations and definitions.
13 */
14
15/**
16 * @def CODEPOINT
17 * the convenience definition of the parameters passed to the
18 * konforka::code_point constructor.
19 */
20 #defineCODEPOINT __FILE__,__PRETTY_FUNCTION__,__LINE__
21/**
22 * @def NOCODEPOINT
23 * the convenience definition for the codepoint denoting no particular point in
24 * code.
25 */
26#define NOCODEPOINT "no information"
27
28/**
29 * @brief The main konforka namespace.
30 */
31namespace konforka {
32 using std::string;
33 using std::list;
34
35 /**
36 * @brief Pinpoint the code context.
37 *
38 * Class, holding the point in code, for instance, where the exception
39 * occured.
40 */
41 class code_point {
42 public:
43 /**
44 * The string describing the point in code.
45 */
46 string where;
47 /**
48 * The file (as provided by __FILE__) if available.
49 */
50 string file;
51 /**
52 * The function name (as provided by __PRETTY_FUNCTION__) if
53 * available.
54 */
55 string function;
56 /**
57 * The line number (as provided by __LINE__) if available.
58 */
59 int line;
60
61 /**
62 * Constructs the object, using only textual description of the
63 * point in code (no file, function, line information).
64 * @param w the description of the point in code.
65 */
66 code_point(const string& w);
67 /**
68 * Constructs the object, specifying the exact position in code.
69 * @param fi source file name.
70 * @param fu function name.
71 * @param l the line number.
72 */
73 code_point(const string& fi,const string& fu,int l);
74
75 /**
76 * Extract the information on the point in code.
77 * @return the reference to the character string.
78 * @see where
79 */
80 const char *c_str() const throw();
81
82 /**
83 * Build the textual description from the broken down information on
84 * the point in code.
85 * @see where
86 * @see file
87 * @see function
88 * @see line
89 */
90 void make_where();
91 };
92
93 /**
94 * @brief The basic exception class.
95 */
96 class exception : public std::exception {
97 public:
98 /**
99 * The string, containing the description of exception.
100 */
101 string _what;
102 /**
103 * Reference to the point in code where the exception has occured.
104 */
105 code_point _where;
106 /**
107 * In case the exception has been rethrown a number of times, here
108 * we can trace where was it seen (a kind of backtrace).
109 */
110 list<code_point> _seen;
111
112 /**
113 * The simple constructor, only providing textual information on the
114 * exception nature and the point in code where the exception has
115 * occured.
116 * @param whe the point in code.
117 * @param wha the description of exception.
118 */
119 exception(const string& whe, const string& wha);
120 /**
121 * The constructor, storing elaborate information on where the
122 * exception has occured.
123 * @param fi source file name.
124 * @param fu function name.
125 * @param l line number.
126 * @param w the error message.
127 * @see #CODEPOINT
128 */
129 exception(const string& fi,const string& fu,int l,const string& w);
130 virtual ~exception() throw();
131
132 /**
133 * Extract the textual information on the point in code where
134 * exception has occured.
135 * @return the string describing point in code where exception has
136 * occured.
137 */
138 virtual const char* where() const throw();
139 /**
140 * Extract the textual information on the nature of the exception.
141 * @return the error message.
142 */
143 virtual const char* what() const throw();
144
145 /**
146 * Register the point in code (described by the string) in the
147 * 'backtrace' list.
148 * @param w the description of the point in code.
149 */
150 void see(const string& w);
151 /**
152 * Register the point in code in the 'backtrace' list.
153 * @param fi souce file name.
154 * @param fu function name.
155 * @param l line number.
156 * @see CODEPOINT
157 */
158 void see(const string& fi,const string& fu,int l);
159 };
160
161 /**
162 * @brief errno-holding exception.
163 *
164 * The exception object storing the information provided by the errno
165 * variable.
166 */
167 class system_error : public exception {
168 public:
169 /**
170 * The value of errno.
171 */
172 int _errno;
173
174 /**
175 * Construct the exception object storing plain text information on
176 * the point in code.
177 * @param whe the description of point in code.
178 * @param wha the error message.
179 */
180 system_error(const string& whe,const string& wha);
181 /**
182 * Construct the exception object storing elaborate information on
183 * the point in code where it has occured.
184 * @param fi source file name.
185 * @param fu function name.
186 * @param l line number.
187 * @param w the error message.
188 * @see CODEPOINT
189 */
190 system_error(const string& fi,const string& fu,int l,const string& w);
191 virtual ~system_error() throw();
192
193 /**
194 * Return the information on the system error recorded.
195 * @return the string describing the error occured.
196 */
197 virtual const char* why() const throw();
198 };
199
200}
201
202#endif /* __KONFORKA_EXCEPTION_H */
203/* 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 @@
1#ifndef __KONFORKA_POINTER_MAP_H
2#define __KONFORKA_POINTER_MAP_H
3
4#include <typeinfo>
5
6/**
7 * @file
8 * @brief mapping of pointers.
9 *
10 * The support for global mapping of pointers. Useful when using third-party
11 * libraries callbacks when the library does not provide mechanism for passing
12 * along custom context-dependent data.
13 */
14
15namespace konforka {
16
17 /**
18 * @brief internally used actual implementation of mapping pointer.
19 *
20 * @param tf the typeid of the key pointer.
21 * @param pf the key pointer.
22 * @param tt the typeid of the value pointer.
23 * @param pt the value pointer.
24 */
25 void _map_pointer(const type_info& tf,void *pf,const type_info& tt,void *pt);
26 /**
27 * @brief internally used actual implementation of destroying mapped
28 * pointer.
29 *
30 * @param tf the typeid of the key pointer.
31 * @param pf the key pointer.
32 * @param tt the typeid of the value pointer.
33 * @param pt the value pointer.
34 */
35 void _unmap_pointer(const type_info& tf,void *pf,const type_info& tt,void *pt);
36 /**
37 * @brief internally used actual implementation of retrieving mapped
38 * pointer.
39 *
40 * @param tf the typeid of the key pointer.
41 * @param pf the key pointer.
42 * @param tt the typeid of the value pointer.
43 * @return the value.
44 */
45 void *_mapped_pointer(const type_info& tf,void *pf,const type_info& tt);
46
47 /**
48 * @brief the object, maintaining mapped pointer.
49 *
50 * @param from_t the key type.
51 * @param to_t the value type.
52 */
53 template<typename from_t,typename to_t>
54 class map_pointer {
55 public:
56 /**
57 * stored key.
58 */
59 from_t _from;
60 /**
61 * stored value.
62 */
63 to_t _to;
64 /**
65 * flag, specifying that the object is currently mapped.
66 */
67 bool bmapped;
68
69 /**
70 * @brief constructs the object, mapping the key/value pair.
71 *
72 * @param f the key.
73 * @param t the value.
74 */
75 map_pointer(from_t f,to_t t)
76 : _from(f), _to(t), bmapped(false) {
77 _map_pointer(typeid(from_t),_from,typeid(to_t),_to);
78 bmapped=true;
79 }
80 /**
81 * @brief destructor unmaps the key/value pair stored.
82 */
83 ~map_pointer() {
84 if(bmapped)
85 _unmap_pointer(typeid(from_t),_from,typeid(to_t),_to);
86 }
87 };
88
89 /**
90 * The template function for pointer retrieval.
91 *
92 * @param from_t the key type.
93 * @param to_t the value type.
94 * @param f the key.
95 * @return the value.
96 */
97 template<typename from_t,typename to_t>
98 to_t mapped_pointer(from_t f) {
99 return (to_t)_mapped_pointer(typeid(from_t),f,typeid(to_t));
100 }
101
102}
103
104#endif /* __KONFORKA_POINTER_MAP_H */
105/* 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 @@
1#ifndef __KONFORKA_PQXX_PILE_H
2#define __KONFORKA_PQXX_PILE_H
3
4#include <pqxx/connection>
5#include <konforka/resource_pile.h>
6
7/**
8 * @file
9 * @brief libpqxx-based postgresql connections pile.
10 */
11
12namespace konforka {
13
14 /**
15 * @brief the base for pqxx-based connection classes.
16 *
17 * @param pqxxc_t the type of libpqxx connection (pqxx::connection,
18 * pqxx::lazyconnection or pqxx::asyncconnection).
19 */
20 template<typename pqxxc_t>
21 class pqxx_piled_connection_base : public resource_pile_base<string,pqxxc_t*, resource_pile_generic_ptr_factory<string,pqxxc_t> > {
22 public:
23 /**
24 * @brief the constractor based on connection info.
25 *
26 * @param ci connection info string.
27 */
28 pqxx_piled_connection_base(const string& ci)
29 : resource_pile_base<string,pqxxc_t*, resource_pile_generic_ptr_factory<string,pqxxc_t> >(ci) { }
30 ~pqxx_piled_connection_base() { this->drop(); }
31
32 /**
33 * @brief cast the object to the reference to the corresponding
34 * libpqxx type.
35 */
36 operator pqxxc_t&(void) { return *this->get_content(); }
37 /**
38 * @brief cast the object to the const reference to the
39 * corresponding libpqxx type.
40 */
41 operator const pqxxc_t&(void) const { return *this->get_content(); }
42 };
43
44 /**
45 * @brief the implementation for piling pqxx::connection objects.
46 */
47 typedef pqxx_piled_connection_base<pqxx::connection> pqxx_piled_connection;
48 /**
49 * @brief the implementation for piling pqxx::lazyconnection objects.
50 */
51 typedef pqxx_piled_connection_base<pqxx::lazyconnection> pqxx_piled_lazy_connection;
52 /**
53 * @brief the implementation for piling pqxx::asyncconnection objects.
54 */
55 typedef pqxx_piled_connection_base<pqxx::asyncconnection> pqxx_piled_async_connection;
56}
57
58#endif /* __KONFORKA_PQXX_PILE_H */
59/* 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 @@
1#ifndef __KONFORKA_RESOURCE_PILE_H
2#define __KONFORKA_RESOURCE_PILE_H
3
4#include <map>
5#include <konforka/responsible_wrapper.h>
6
7/**
8 * @file
9 * @brief resource-piling base support.
10 *
11 * Base for implementing resource-piling.
12 */
13
14namespace konforka {
15 using std::multimap;
16 using std::pair;
17
18 /**
19 * @brief template base class for resource piling.
20 *
21 * @param key_t the type used for keying resources.
22 * @param value_t the type of resource itself.
23 * @param factory_t the factory class, providing value_t allocate(key_t)
24 * static member.
25 */
26 template<typename key_t,typename value_t,typename factory_t>
27 class resource_pile_base : public responsible_wrapper<value_t> {
28 /**
29 * @brief the type of the pile container itself.
30 */
31 typedef multimap<key_t,value_t> pile_t;
32 /*
33 * @brief the pile of resources.
34 */
35 static pile_t pile;
36 public:
37 /**
38 * @brief stored value for the key associated with the resource
39 * contained.
40 */
41 key_t _key;
42
43 /**
44 * @brief default constructor fetches or allocates resource.
45 *
46 * @param k the key for resource.
47 * @see allocate
48 */
49 resource_pile_base(const key_t& k) {
50 allocate(k);
51 }
52 /**
53 * @brief destructor releases the resource back to pile.
54 */
55 virtual ~resource_pile_base() { this->drop(); }
56
57 /**
58 * @brief this is where the resource is handed back to pile.
59 */
60 void release() {
61 pile.insert(pair<key_t,value_t>(_key,this->opkele));
62 }
63
64 /**
65 * @brief fetch from pile or allocate the resource.
66 *
67 * Try to see if we have a piled resource keyed to the argument. If
68 * we do -- fetch it from the pile, otherwise allocate anew.
69 *
70 * @param k the key for resource.
71 */
72 void allocate(const key_t& k) {
73 this->drop();
74 typename pile_t::iterator i = pile.find(k);
75 if(i==pile.end()) {
76 this->attach(factory_t::allocate(k));
77 }else{
78 this->attach(i->second);
79 try{ pile.erase(i); }catch(...){ _key = k; throw; }
80 }
81 _key = k;
82 }
83
84 };
85
86 template<typename key_t,typename value_t,typename factory_t>
87 typename resource_pile_base<key_t,value_t,factory_t>::pile_t
88 resource_pile_base<key_t,value_t,factory_t>::pile;
89
90 /**
91 * @brief the generic single parameter new-based resource factory.
92 *
93 * The generic resource factory using new as a way to allocate resource
94 * using the single-parameter constructor.
95 *
96 * @param key_t the key type.
97 * @param value_t the resource type.
98 *
99 * @see resource_pile_base
100 */
101 template<typename key_t,typename value_t>
102 struct resource_pile_generic_ptr_factory {
103 public:
104 /**
105 * @brief allocate the resource using new.
106 *
107 * @param k the key.
108 * @return pointer to the newly allocated object.
109 */
110 static value_t *allocate(const key_t& k) {
111 return new value_t(k);
112 }
113 };
114
115}
116
117#endif /* __KONFORKA_RESOURCE_PILE_H */
118/* 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 @@
1#ifndef __KONFORKA_RESPONSIBLE_WRAPPER_H
2#define __KONFORKA_RESPONSIBLE_WRAPPER_H
3
4/**
5 * @file
6 * @brief The konforka::responsible_wrapper class declaration.
7 */
8
9#include <konforka/basic_wrapper.h>
10
11namespace konforka {
12
13 /**
14 * @brief The auto-cleanup wrapper class.
15 *
16 * The wrapper class that may feel responsible for releasing the resources
17 * associated with the content attached.
18 *
19 */
20 template<typename T>
21 class responsible_wrapper : public basic_wrapper<T> {
22 public:
23 /**
24 * The type of wrapped content.
25 */
26 typedef typename basic_wrapper<T>::content_type content_type;
27 /**
28 * Flag indicating whether the object feels responsible for
29 * releasing resources associated with the content.
30 */
31 bool bresponsible;
32
33 /**
34 * Default constructor creates the object with no content
35 * attached.
36 */
37 responsible_wrapper()
38 : basic_wrapper<content_type>() { }
39 /**
40 * Constructor, associating the content with the instance.
41 * @param o the content.
42 * @param br indicates whether resources associated with the
43 * content should be released.
44 */
45 responsible_wrapper(content_type o,bool br=true)
46 : basic_wrapper<content_type>(o), bresponsible(br) { }
47 /**
48 * Destructor releases resources associated with the content
49 * attached (if any), if the instance feels responsible for the
50 * content.
51 */
52 virtual ~responsible_wrapper() { drop(); }
53
54 /**
55 * Attaches the given content to the object.
56 * @param o the content.
57 * @param br indicates whether the object should feel
58 * responsible for releasing the content.
59 */
60 void attach(content_type o,bool br=true) {
61 drop();
62 basic_wrapper<content_type>::attach(o);
63 bresponsible = true;
64 }
65
66 /**
67 * 'empties' object, releasing resources associated with the
68 * content if it feels responsible.
69 */
70 virtual void drop() {
71 if(!this->is())
72 return;
73 if(bresponsible)
74 release();
75 this->bopkele = false;
76 }
77
78 /**
79 * Detaches the content from the object without releasing
80 * resources even if feels responsible for it.
81 * @return the content attached.
82 */
83 virtual content_type detach() {
84 this->ensure();
85 this->bopkele = false;
86 return this->opkele;
87 }
88
89 /**
90 * Pure virtual provided for derived classes to override for
91 * doing whatever it takes to release resources associated with
92 * the content.
93 */
94 virtual void release() = 0;
95 };
96}
97
98#endif /* __KONFORKA_RESPONSIBLE_WRAPPER_H */
99/* 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 @@
1prefix=@prefix@
2exec_prefix=@exec_prefix@
3libdir=@libdir@
4includedir=@includedir@
5
6Name: konforka
7Description: Convenience library for common KIN project code
8Version: @VERSION@
9Requires: @PC_REQ_PQXX@
10Libs: -L${libdir} -lkonforka
11Cflags: -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 @@
1Makefile.in
2.libs
3.deps
4Makefile
5*.lo
6*.o
7*.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 @@
1lib_LTLIBRARIES = libkonforka.la
2
3INCLUDES = -I${top_srcdir}/include
4AM_CXXFLAGS = ${PQXX_CFLAGS}
5LDADD = ${PQXX_LIBS}
6
7EXTRA_DIST = pqxx_pile.cc
8EXTRA_SOURCES=
9if HAVE_PQXX
10EXTRA_SOURCES += pqxx_pile.cc
11endif
12
13libkonforka_la_SOURCES = \
14 exception.cc \
15 pointer_map.cc \
16 ${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 @@
1#include <string.h>
2#include <errno.h>
3#include "konforka/exception.h"
4
5namespace konforka {
6
7 /*
8 * code_point
9 */
10
11 code_point::code_point(const string& w)
12 : where(w), line(-1) { }
13 code_point::code_point(const string& fi,const string& fu,int l)
14 : file(fi), function(fu), line(l) {
15 make_where();
16 }
17
18 const char *code_point::c_str() const throw() {
19 return where.c_str();
20 }
21
22 void code_point::make_where() {
23 static char tmp[8];
24 snprintf(tmp,sizeof(tmp),"%d",line);
25 where = file + ":" + tmp + " [" + function + "]";
26 }
27
28 /*
29 * exception
30 */
31
32 exception::exception(const string& whe,const string& wha)
33 : _where(whe), _what(wha) { }
34 exception::exception(const string& fi,const string& fu,int l,const string& w)
35 : _where(fi,fu,l), _what(w) { }
36 exception::~exception() throw() { }
37
38 const char *exception::where() const throw() {
39 return _where.c_str();
40 }
41 const char *exception::what() const throw() {
42 return _what.c_str();
43 }
44
45 void exception::see(const string& w) {
46 _seen.push_back(code_point(w));
47 }
48 void exception::see(const string& fi,const string& fu,int l) {
49 _seen.push_back(code_point(fi,fu,l));
50 }
51
52 /*
53 * system_error
54 */
55
56 system_error::system_error(const string& whe,const string& wha)
57 : _errno(errno), exception(whe,wha) { }
58 system_error::system_error(const string& fi,const string& fu,int l,const string& w)
59 : _errno(errno), exception(fi,fu,l,w) { }
60 system_error::~system_error() throw() { }
61
62 const char *system_error::why() const throw() {
63 return strerror(errno); // TODO: strerror_r
64 }
65
66}
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 @@
1#include <cassert>
2#include <map>
3#include <string>
4using namespace std;
5#include "konforka/exception.h"
6#include "konforka/pointer_map.h"
7
8namespace konforka {
9
10 /*
11 * to_t->from_t->from->to
12 */
13 class mpointer_t {
14 public:
15 void *ptr;
16 int ref;
17
18 mpointer_t() : ptr(0), ref(0) { }
19
20 void _ref() { ref++; }
21 void _unref() { ref--; }
22 };
23 typedef map<void*,mpointer_t> map_ptr_1_t;
24 typedef map<string,map_ptr_1_t> map_ptr_2_t;
25 typedef map<string,map_ptr_2_t> map_ptr_t;
26
27 static map_ptr_t pointer_map;
28
29 void _map_pointer(const type_info& tf,void *pf,const type_info& tt,void *pt) {
30 mpointer_t& mpt = pointer_map[tf.name()][tt.name()][pf];
31 if(mpt.ref) {
32 if(mpt.ptr != pt)
33 throw exception(CODEPOINT,"trying to remap existing pointer with different value");
34 }else{
35 mpt.ptr = pt;
36 }
37 mpt.ref++;
38 }
39 void _unmap_pointer(const type_info& tf,void *pf,const type_info& tt,void *pt) {
40 map_ptr_t::iterator i1 = pointer_map.find(tf.name());
41 if(i1==pointer_map.end())
42 throw exception(CODEPOINT,"no pointer of such type has ever been mapped");
43 map_ptr_2_t::iterator i2 = i1->second.find(tt.name());
44 if(i2==i1->second.end())
45 throw exception(CODEPOINT,"no pointer has ever been mapped to the object of this type");
46 map_ptr_1_t::iterator i3 = i2->second.find(pf);
47 if(i3==i2->second.end())
48 throw exception(CODEPOINT,"this pointer has never been mapped");
49 assert(i3->second.ref>0);
50 if(--(i3->second.ref))
51 return;
52 i2->second.erase(i3);
53 if(!i2->second.empty())
54 return;
55 i1->second.erase(i2);
56 if(!i1->second.empty())
57 return;
58 pointer_map.erase(i1);
59 }
60 void *_mapped_pointer(const type_info& tf,void *pf,const type_info& tt) {
61 map_ptr_t::iterator i1 = pointer_map.find(tf.name());
62 if(i1==pointer_map.end())
63 throw exception(CODEPOINT,"no pointer of such type has ever been mapped");
64 map_ptr_2_t::iterator i2 = i1->second.find(tt.name());
65 if(i2==i1->second.end())
66 throw exception(CODEPOINT,"no pointer has ever been mapped to the object of this type");
67 map_ptr_1_t::iterator i3 = i2->second.find(pf);
68 if(i3==i2->second.end())
69 throw exception(CODEPOINT,"this pointer has never been mapped");
70 assert(i3->second.ref>0);
71 return i3->second.ptr;
72 }
73
74}
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 @@
1#include "konforka/pqxx_pile.h"
2
3namespace konforka {
4
5 template class resource_pile_generic_ptr_factory<string,pqxx::connection>;
6 template class resource_pile_generic_ptr_factory<string,pqxx::lazyconnection>;
7 template class resource_pile_generic_ptr_factory<string,pqxx::asyncconnection>;
8
9 template class resource_pile_base<string,pqxx::connection*,resource_pile_generic_ptr_factory<string,pqxx::connection> >;
10 template class resource_pile_base<string,pqxx::lazyconnection*,resource_pile_generic_ptr_factory<string,pqxx::lazyconnection> >;
11 template class resource_pile_base<string,pqxx::asyncconnection*,resource_pile_generic_ptr_factory<string,pqxx::asyncconnection> >;
12
13 template class pqxx_piled_connection_base<pqxx::connection>;
14 template class pqxx_piled_connection_base<pqxx::lazyconnection>;
15 template class pqxx_piled_connection_base<pqxx::asyncconnection>;
16
17}