toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] tag Makefile.am Makefile.in tag/fn.h


From: Gerhard Reitmayr
Subject: [Toon-members] tag Makefile.am Makefile.in tag/fn.h
Date: Mon, 19 Jun 2006 10:55:07 +0000

CVSROOT:        /cvsroot/toon
Module name:    tag
Changes by:     Gerhard Reitmayr <gerhard>      06/06/19 10:55:07

Modified files:
        .              : Makefile.am Makefile.in 
Added files:
        tag            : fn.h 

Log message:
        added header for std functional and iterator add ons

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/tag/Makefile.am?cvsroot=toon&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/tag/Makefile.in?cvsroot=toon&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/tag/tag/fn.h?cvsroot=toon&rev=1.1

Patches:
Index: Makefile.am
===================================================================
RCS file: /cvsroot/toon/tag/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Makefile.am 31 May 2006 16:46:20 -0000      1.3
+++ Makefile.am 19 Jun 2006 10:55:07 -0000      1.4
@@ -1,6 +1,6 @@
 # the library we want to create and its source files
-lib_LTLIBRARIES     = libtag.la
-libtag_la_SOURCES   = src/absorient.cpp src/fourpointpose.cpp
+lib_LTLIBRARIES     = libtoontag.la
+libtoontag_la_SOURCES   = src/absorient.cpp src/fourpointpose.cpp
 
 # the header files to be installed
 pkginclude_HEADERS  = \
@@ -14,7 +14,8 @@
        tag/ransac_estimators.h  \
        tag/stdpp.h \
        tag/printf.h \
-       tag/tuple.h
+       tag/tuple.h \
+       tag/fn.h
 
 docs:
        doxygen Doxyfile

Index: Makefile.in
===================================================================
RCS file: /cvsroot/toon/tag/Makefile.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- Makefile.in 31 May 2006 16:46:20 -0000      1.3
+++ Makefile.in 19 Jun 2006 10:55:07 -0000      1.4
@@ -15,7 +15,7 @@
 @SET_MAKE@
 
 
-SOURCES = $(libtag_la_SOURCES)
+SOURCES = $(libtoontag_la_SOURCES)
 
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -61,9 +61,9 @@
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"
 libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
-libtag_la_LIBADD =
-am_libtag_la_OBJECTS = absorient.lo fourpointpose.lo
-libtag_la_OBJECTS = $(am_libtag_la_OBJECTS)
+libtoontag_la_LIBADD =
+am_libtoontag_la_OBJECTS = absorient.lo fourpointpose.lo
+libtoontag_la_OBJECTS = $(am_libtoontag_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(srcdir)
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -75,8 +75,8 @@
 CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
        $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(libtag_la_SOURCES)
-DIST_SOURCES = $(libtag_la_SOURCES)
+SOURCES = $(libtoontag_la_SOURCES)
+DIST_SOURCES = $(libtoontag_la_SOURCES)
 pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(pkginclude_HEADERS)
 ETAGS = etags
@@ -190,8 +190,8 @@
 target_alias = @target_alias@
 
 # the library we want to create and its source files
-lib_LTLIBRARIES = libtag.la
-libtag_la_SOURCES = src/absorient.cpp src/fourpointpose.cpp
+lib_LTLIBRARIES = libtoontag.la
+libtoontag_la_SOURCES = src/absorient.cpp src/fourpointpose.cpp
 
 # the header files to be installed
 pkginclude_HEADERS = \
@@ -205,7 +205,8 @@
        tag/ransac_estimators.h  \
        tag/stdpp.h \
        tag/printf.h \
-       tag/tuple.h
+       tag/tuple.h \
+       tag/fn.h
 
 all: all-am
 
@@ -271,8 +272,8 @@
          echo "rm -f \"$${dir}/so_locations\""; \
          rm -f "$${dir}/so_locations"; \
        done
-libtag.la: $(libtag_la_OBJECTS) $(libtag_la_DEPENDENCIES) 
-       $(CXXLINK) -rpath $(libdir) $(libtag_la_LDFLAGS) $(libtag_la_OBJECTS) 
$(libtag_la_LIBADD) $(LIBS)
+libtoontag.la: $(libtoontag_la_OBJECTS) $(libtoontag_la_DEPENDENCIES) 
+       $(CXXLINK) -rpath $(libdir) $(libtoontag_la_LDFLAGS) 
$(libtoontag_la_OBJECTS) $(libtoontag_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)

Index: tag/fn.h
===================================================================
RCS file: tag/fn.h
diff -N tag/fn.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tag/fn.h    19 Jun 2006 10:55:07 -0000      1.1
@@ -0,0 +1,147 @@
+#ifndef TAG_FN_H
+#define TAG_FN_H
+
+#include <functional>
+#include <iterator>
+
+namespace tag {
+
+///@defgroup functional additional functors for <functional>
+///This group provides additional functors to complement the <functional> 
header of STL.
+///@ingroup stdpp
+//@{
+
+template <typename A, typename m>
+struct mem_data_ref_t : std::unary_function<A &, m &> {
+    m A::*data;
+    inline mem_data_ref_t( m A::*d ) : data(d) {};
+    inline m & operator()(A & instance) const {
+        return instance.*data;
+    }
+};
+
+template <typename A, typename m>
+struct const_mem_data_ref_t : std::unary_function<const A &, const m &> {
+    const m A::*data;
+    inline const_mem_data_ref_t( const m A::*d ) : data(d) {};
+    inline const m & operator()(const A & instance) const {
+        return instance.*data;
+    }
+};
+
+template <typename A, typename m>
+inline struct mem_data_ref_t<A,m> mem_data_ref( m A::*data ){
+    return mem_data_ref_t<A,m>(data);
+}
+
+template <typename A, typename m>
+inline struct const_mem_data_ref_t<A,m> const_mem_data_ref( const m A::*data ){
+    return const_mem_data_ref_t<A,m>(data);
+}
+
+template <typename A, typename m>
+struct mem_data_t : std::unary_function<A *, m &> {
+    m A::*data;
+    inline mem_data_t( m A::*d ) : data(d) {};
+    inline m & operator()(A * instance) const {
+        return instance->*data;
+    }
+};
+
+template <typename A, typename m>
+struct const_mem_data_t : std::unary_function<const A *, const m &> {
+    const m A::*data;
+    inline const_mem_data_t(const m A::*d ) : data(d) {};
+    inline const m & operator()(const A * instance) const {
+        return instance->*data;
+    }
+};
+
+template <typename A, typename m>
+inline struct mem_data_t<A,m> mem_data( m A::*data ){
+    return mem_data_t<A,m>(data);
+}
+
+template <typename A, typename m>
+inline struct const_mem_data_t<A,m> const_mem_data( const m A::*data ){
+    return const_mem_data_t<A,m>(data);
+}
+
+template <typename G, typename F>
+struct bind_t : std::unary_function<typename F::argument_type, typename 
G::result_type> {
+    const F & f;
+    const G & g;
+    inline bind_t( const F & f_, const G & g_) :f(f_), g(g_) {};
+    inline typename G::result_type operator()( typename F::argument_type a) 
const {
+        return g(f(a));
+    }
+};
+
+template <typename G, typename F>
+inline struct bind_t<G,F> bind( const G & g, const F & f ){
+    return bind_t<G,F>(f,g);
+}
+
+//@}
+
+///@defgroup iterator additional iterators
+///This group provides additional iterators to complement the <iterator> 
header of STL.
+///@ingroup stdpp
+//@{
+
+
+/**
+An iterator wrapper that returns a member of a struct the wrapped iterator 
would point to.
address@hidden
+struct simple { int a; float b; };
+vector<simple> test;
+member_iterator_t<vector<simple>::iterator, int> ita( &simple::a );
+ita = test.begin();
+cout << *ita; // prints the value of a
address@hidden
+*/
+template <typename It, typename m>
+struct member_iterator_t : public It {
+    typedef typename std::iterator_traits<It>::value_type Value;
+    m Value::*data;
+    inline member_iterator_t( m Value::*d ) : data(d) {};
+    inline member_iterator_t( const It & it,  m Value::*d ) : data(d) { *this 
= it; };
+    template <typename Other> inline member_iterator_t & operator=(const Other 
& other) {
+        It::operator=(other);
+        return *this;
+    }
+    inline member_iterator_t & operator=( const member_iterator_t & other){
+        data = other.data;
+        It::operator=(other);
+        return *this;
+    }
+    inline m & operator*(void){
+        return It::operator*().*data;
+    }
+    inline m & operator->(void){
+        return It::operator->()->*data;
+    }
+    inline const m & operator*(void) const {
+        return It::operator*().*data;
+    }
+    inline const m & operator->(void) const {
+        return It::operator->()->*data;
+    }
+};
+
+/**
+helper function to simplify the use of @ref member_iterator_t wrapper. This is 
useful for passing
+member iterators as arguments.
address@hidden it the iterator to wrap, the new member_iterator_t returned will 
point to the same position
address@hidden d the member to wrap
+*/
+template <typename It, typename m>
+inline struct member_iterator_t<It, m> member_iterator( const It & it, m 
std::iterator_traits<It>::value_type::*d ){
+    return member_iterator_t<It, m>(it, d);
+}
+
+//@}
+
+}
+
+#endif // TAG_FN_H




reply via email to

[Prev in Thread] Current Thread [Next in Thread]