=> we do not provide this for now
- naming scheme?!
perhaps generated group class should not be prefixed by cmd_group_
+
+++ /dev/null
-# not a GNU package. You can remove this line, if
-# you have all needed files, that a GNU package needs
-AUTOMAKE_OPTIONS = foreign
-
-INCLUDES = @LIBT2N_CFLAGS@
-LDADD = @LIBT2N_LIBS@
-
-# list your command groups
-CMDGROUPS = default other
-
-# for each command group list the files to parse for LIBT2N_EXPORT
-default_GROUP = default.cpp
-# example of a command group using multiple cpp files
-other_GROUP = other-1.cpp other-2.cpp
-
-# headers declaring data types used as rpc arguments must be listed manually
-# (in this example the class Foo)
-include_HEADERS = foo.hxx
-
-# unfortunately we can't set those from variables
-# because they are parsed by automake
-
-# we would like to use nodist_ here but our automake is to old
-# nodist_libdefault_la_SOURCES = default_client.cpp
-# nodist_libother_la_SOURCES = other_client.cpp
-
-# using objects as workaround
-libdefault_la_OBJECTS += default_client.lo
-#libdefault_la_SOURCES = default_client.cpp
-libother_la_OBJECTS += other_client.lo
-#libother_la_SOURCES = other_client.cpp
-lib_LTLIBRARIES = libdefault.la libother.la
-
-# build an example server and client
-client_SOURCES = client.cpp
-client_LDADD = $(LDADD) libdefault.la libother.la
-
-noinst_PROGRAMS = client server
-
-# we would like to use nodist_ here but our automake is to old
-# nodist_server_SOURCES = other_server.cpp default_server.cpp
-
-server_LDADD = $(LDADD) other_server.$(OBJEXT) default_server.$(OBJEXT)
-
-server_SOURCES = \
- server.cpp $(other_GROUP) $(default_GROUP)
-# other_server.cpp default_server.cpp
-
-
-# test script
-
-TESTS = test
-
-EXTRA_DIST = $(TESTS) configure.in
-
-# if you use libt2n-codegen you should add this
-# (i did not find a nice way to let libt2n install this makefile snippet
-# and let projects using libt2n use the installed version.
-# the core of the problem is:
-# the makefile snippet is already needed when automake is run
-# => no way to let configure locate the snippet)
-include codegen.make
+++ /dev/null
-Example how to use the code generator libt2n-codegen.
-This example may be build during the build of libt2n or it may be build seperately using a
-installed version of libt2n.
-
-To build it seperately using a installed version of libt2n:
-autoreconf && ./configure && make && make distcheck
-
-if it does not work you may have to move the example-codegen out of the libt2n directory and
-pass some options to autoreconf
-I use something like:
-tar xzvf libt2n-0.1.tar.gz
-mv libt2n-0.1/example-codegen .
-cd example-codegen
-# get configure script created and missing autotools helper files installed
-# if you installed libt2n in some non-standard directory you might have to pass
-# -M pathtolibt2n.m4
-autoreconf -f -i
-./configure && make && make distcheck
+++ /dev/null
-multiple command groups test: howto multiplex multiple commands on one stream?
-don't multiplex but a select on multiple groups would be nice
-
-include problem:
-- i don't see a solution using gccxml
-- a simple solution would be to have a special include file containing the neccessary includes (or 2: one for the type definitions and one for the serialization)
-- another solution would be to extract the includes from the file and add them to the generated code
-both solutions only work if the include paths used during compilation of a program using the library are correct[tm]
-now we use the first solution
-
-- test using valgrind
-- would be nice to reduce amount of changed files
- (codegen output is often the same as the existing files - something similar to ccache
- for codegen - but not overwriting output files if they are the same)
-- howto include the part after "# always the same:" in all makefiles (using the codegenerator)
- (we now use make's include)
-- lib name should be group name + suffix/prefix ?!
- user should have complete control => no default suffix/perfix
- headers should be installed in pkgincludedir? maybe yes on the other hand
- the user can pass the directory to configure via --includedir
-- the example should not get installed (but still it should show how to build a lib that gets installed :-(
- (overwriting install: doesn't work)
- => perhaps split libt2n package into 3 packages?
- libt2n
- libt2n-example-codegen
- libt2n-example-libusage
-- at the moment make dist from within a clean source will not work
- (this is related to the nodist problem / old automake version)
- this is caused by BUILT_SOURCES not working for make dist(check?)
- and the dependency generation
-
- distcheck -> dist -> distdir -> DISTFILES
-
- all -> all-redirect -> all-am -> Makefile -> BUILT_SOURCES => bene
-
- => how to add dependency on BUILT_SOURCES for dist?
- the real problem is that make dist should not depend on BUILT_SOURCES
- unfortunately we can't fix this as long as we use a old automake version
- (DISTFILES includes generated files we would like to mark as noinst)
-- make clean / make distclean?! make clean geht beim zweiten mal nicht
- now it works?! why?!
- das ganze ist abhängig davon in welchem verzeichnis man ist?!
- das problem ist:
- BUILT_SOURCES -> generierte files -> codegen !
- (make clean in toplevel src dir -> codegen does not exist)
-
- => how to get rid off BUILT_SOURCES
- or how to get rid off dependency off clean and dist on BUILT_SOURCES files ?
- (the nodist problem)
-
- getting rid off BUILT_SOURCES would not suffice
- (explicit dependencies still would depend upon the files)
- => the real problem is the missing nodist
-
- => workaround for old automake version?
- a workaround would require us not to use _SOURCES but still be able to add object files
- to the libs/bins created
- looking at the generated Makefile this perhaps could be done via _OBJECTS
-
- nodist wurde mit automake 1.5 eingeführt (2001-08-23)
-
- what doesn't work:
- - make dist and make clean only work if you did a make all
-
- hmm Makefile should not depend on BUILT_SOURCES
- http://sources.redhat.com/ml/bug-automake/2000/msg00040.html
-
\ No newline at end of file
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2004 by Intra2net AG *
- * info@intra2net.com *
- * *
- ***************************************************************************/
-
-#include <socket_client.hxx>
-
-// include generated library headers
-#include "default_client.hxx"
-#include "other_client.hxx"
-
-int main(int argc, char** argv)
-{
- libt2n::socket_client_connection sc("./socket");
- libt2n::socket_client_connection sc_other("./socket_other");
- cmd_group_default_client cc(sc);
- cmd_group_other_client cc_other(sc_other);
-
- bool throwok=false;
- try
- {
- cc.testfunc("throw");
- }catch(libt2n::t2n_runtime_error &e){
- throwok=(std::string(e.what())=="throw me around");
- }
-
- Foo foo={10,10};
-
- return ( throwok
- && ( cc.testfunc("hello") == "hello, testfunc() was here" )
- && ( cc.testfunc_ref("hello") == "hello, testfunc() was here" )
- && ( cc.t2(10) == 10 )
- && ( cc_other.t3(10, 20, "hello", std::pair<int, float>(10,20)) )
- && ( cc_other.t3(10) == 10 )
- && ( cc_other.t3(std::vector<int>(1,10)) )
- && ( cc_other.t3(foo) ) )
- ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-# Makefile snippet included by projects using libt2n-codegen
-
-# Asumptions:
-# gnu make (functions for transforming text)
-# sed is available
-
-include_HEADERS += $(foreach i, $(CMDGROUPS), $(i)_client.hxx $(i).hxx)
-
-# not needed but nice to have
-# IFILES=$(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j)))
-
--include $(foreach i, $(CMDGROUPS), libt2ngroup_$(i).P)
-
-libt2ngroup_%.P : Makefile.am
- echo $@ : $($*_GROUP) > libt2ngroup_$*.P
-
-%.libt2nstamp : libt2ngroup_%.P
-# assuming we have some unix like shell (maybe even bash)
-# echo BUILT_SOURCES: $(BUILT_SOURCES)
-# temporarily create _common.hxx file (will be overwritten by codegen below)
- echo '#include "codegen-stubhead.hxx"' > $*_common.hxx;
- echo '#include "$*.hxx"' >> $*_common.hxx;
-# todo use tmp file for xml file
- for i in $($*_GROUP); do \
- gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(srcdir)/$${i} -fxml=$${i%*.cpp}.xml; \
- done; \
- $(LIBT2N_CODEGEN) $* $($*_GROUP:.cpp=.xml) && touch $@
-
-LIBT2N_CODEGEN_BUILT = $(foreach i, $(CMDGROUPS), $(foreach j, _common.hxx _common.cpp _client.hxx _client.cpp _server.hxx _server.cpp, $(i)$(j)) )
-
-# using BUILT_SOURCES is a bit problematic (see also automake manual)
-BUILT_SOURCES += $(LIBT2N_CODEGEN_BUILT)
-
-LIBT2N_STAMPS=$(CMDGROUPS:=.libt2nstamp)
-$(BUILT_SOURCES) : $(LIBT2N_STAMPS)
-
-# Install the pkg-config files: (todo: perhaps use +=)
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = $(CMDGROUPS:=.pc)
-
-# .pc files (one pc file for each command group)
-%.pc : $(LIBT2N_CLIENT_PCTEMPLATE) Makefile
- sed \
- -e 's,\@CMDGROUP\@,$*,g' \
- -e 's,\@prefix\@,$(prefix),g' \
- -e 's,\@exec_prefix\@,$(exec_prefix),g' \
- -e 's,\@libdir\@,$(libdir),g' \
- -e 's,\@includedir\@,$(includedir),g' \
- -e 's,\@VERSION\@,$(VERSION),g' \
- $< >$*.pc
-
-CLEANFILES += $(LIBT2N_CODEGEN_BUILT) $(LIBT2N_STAMPS) $(pkgconfig_DATA)
-
-# didn't work (same problem as with _LTLIBRARIES [parsing by automake],
-# this time _OBJECTS was not correct)
-# server_SOURCES = server.cpp \
-# $(foreach i, $(CMDGROUPS), $(foreach j, $($(i)_GROUP), $(j))) \
-# $(foreach i, $(CMDGROUPS), $(i)_server.cpp)
-
-# we have got an old automake version (1.4-p5) which doesn't support nodist_
-# => we use this hack using the dist-hook
-dist-hook: $(LIBT2N_CODEGEN_BUILT)
- rm -vf $(foreach i, $(LIBT2N_CODEGEN_BUILT), $(distdir)/$(i))
-
-EXTRA_DIST += codegen.make
+++ /dev/null
-AC_INIT(configure.in)
-
-AM_INIT_AUTOMAKE(libt2n-example, 0.1)
-
-AC_LANG_CPLUSPLUS
-AC_PROG_CXX
-AM_PROG_LIBTOOL
-
-LIBT2N_CHECK(libt2n = 0.1)
-
-AC_OUTPUT(Makefile)
+++ /dev/null
-#include "default_common.hxx"
-
-//! test pass by copy
-LIBT2N_EXPORT std::string testfunc(std::string str)
-{
- std::string ret;
- if (str=="throw")
- throw libt2n::t2n_runtime_error("throw me around");
- if (str=="big")
- ret.insert(0,100*1024,'x');
- else
- ret=str+", testfunc() was here";
- return ret;
-}
-
-//! test pass by const reference
-LIBT2N_EXPORT std::string testfunc_ref(const std::string &str)
-{
- std::string ret;
- if (str=="throw")
- throw libt2n::t2n_runtime_error("throw me around");
- if (str=="big")
- ret.insert(0,100*1024,'x');
- else
- ret=str+", testfunc() was here";
- return ret;
-}
-
-//! test builtin type
-LIBT2N_EXPORT int t2(int i)
-{
- return i;
-}
+++ /dev/null
-#include <string>
-// serialization of string
-#include <boost/serialization/string.hpp>
-// serialization of pair
-#include <boost/serialization/utility.hpp>
-
-// std::vector
-#include <vector>
-#include <boost/serialization/vector.hpp>
+++ /dev/null
-#ifndef FOO_HXX
-#define FOO_HXX
-
-#include <boost/serialization/version.hpp>
-
-struct Foo
-{
- int i,j;
-
- friend class boost::serialization::access;
- template<class Archive>
- void serialize(Archive & ar, const unsigned int /* version */)
- {
- ar & BOOST_SERIALIZATION_NVP(i);
- ar & BOOST_SERIALIZATION_NVP(j);
- }
-};
-
-BOOST_CLASS_VERSION(Foo, 1)
-
-#endif
+++ /dev/null
-#include "other_common.hxx"
-
-using namespace std;
-
-//! test function overload
-LIBT2N_EXPORT int t3(int i)
-{
- return i;
-}
-
-//! test pair, multiple arguments and namespace
-LIBT2N_EXPORT bool t3(int i, float f, const string &s, const pair<int, float> &p)
-{
- return (i==p.first) && (f==p.second) && (s=="hello");
-}
-
-//! test std::vector
-LIBT2N_EXPORT bool t3(const std::vector<int> &i)
-{
- return (i.size()==1) && (i[0]==10);
-}
+++ /dev/null
-#include "other_common.hxx"
-
-//! test own type
-LIBT2N_EXPORT bool t3(const Foo &foo)
-{
- return (foo.i==foo.j);
-}
+++ /dev/null
-#include <string>
-// serialization of string
-#include <boost/serialization/string.hpp>
-// serialization of pair
-#include <boost/serialization/utility.hpp>
-
-// std::vector
-#include <vector>
-#include <boost/serialization/vector.hpp>
-
-#include "foo.hxx"
+++ /dev/null
-#include <socket_server.hxx>
-#include <command_server.hxx>
-
-#include "default_server.hxx"
-#include "other_server.hxx"
-
-using namespace libt2n;
-
-
-int main(int argc, char** argv) {
- socket_server ss("./socket");
- socket_server ss_other("./socket_other");
- group_command_server<cmd_group_default> cs(ss);
- group_command_server<cmd_group_other> cs_other(ss_other);
-
- // handle requests
- while(true) {
- cs.handle(1000);
- cs_other.handle(1000);
- }
-
- return 0;
-}
+++ /dev/null
-#!/bin/bash
-
-set -o nounset
-set -o errexit
-
-# todo handle separate build dir
-./server &
-SPID="$!"
-# ugly
-sleep 1
-if ./client; then
- RET="0"
-else
- RET="1"
-fi
-kill "$SPID"
-exit "$RET"
+++ /dev/null
-# not a GNU package. You can remove this line, if
-# you have all needed files, that a GNU package needs
-AUTOMAKE_OPTIONS = foreign
-
-INCLUDES = @DEFAULT_CFLAGS@
-LDADD = @DEFAULT_LIBS@
-
-client_SOURCES = client.cpp
-
-bin_PROGRAMS = client
+++ /dev/null
-example how to use a installed library generated using libt2n-codegen
+++ /dev/null
-/***************************************************************************
- * Copyright (C) 2004 by Intra2net AG *
- * info@intra2net.com *
- * *
- ***************************************************************************/
-
-#include <socket_client.hxx>
-
-// include generated library header
-#include "default_client.hxx"
-
-int main(int argc, char** argv)
-{
- libt2n::socket_client_connection sc("./socket");
- cmd_group_default_client cc(sc);
-
- bool throwok=false;
- try
- {
- cc.testfunc("throw");
- }catch(libt2n::t2n_runtime_error &e){
- throwok=(std::string(e.what())=="throw me around");
- }
-
- return ( throwok
- && ( cc.testfunc("hello") == "hello, testfunc() was here" )
- && ( cc.testfunc_ref("hello") == "hello, testfunc() was here" )
- && ( cc.t2(10) == 10 ) )
- ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-AC_INIT(configure.in)
-
-AM_INIT_AUTOMAKE(libt2n-clientexample, 0.1)
-
-AC_LANG_CPLUSPLUS
-AC_PROG_CXX
-AM_PROG_LIBTOOL
-
-PKG_CHECK_MODULES(DEFAULT, default = 0.1)
-
-AC_OUTPUT(Makefile)