From 117425a5858bb094f2e54af5d018499ab703b227 Mon Sep 17 00:00:00 2001 From: darco Date: Wed, 9 Nov 2005 16:25:21 +0000 Subject: [PATCH] Bump version number. Remove bogus copyright line. Don't distribute the kdevelop project. Add multiplication stuff to the fixed templates. Various fixes for the fixed, curve_func, handle, smart_ptr and clock templates. Fixes for the fixed, smart_ptr and handle tests. Disable the value and spline tests. git-svn-id: http://svn.voria.com/code@52 1f10aa63-cdf2-0310-b900-c93c546f37ac --- ETL/trunk/ETL.pbproj/frameworkfix.cpp | 1 - ETL/trunk/ETL.pc.in | 2 +- ETL/trunk/ETL/_clock_gettimeofday.h | 2 +- ETL/trunk/ETL/_curve_func.h | 2 +- ETL/trunk/ETL/_fixed.h | 37 +++++++++++++++++++++++++++++++---- ETL/trunk/ETL/_handle.h | 17 ++++++++-------- ETL/trunk/ETL/_smart_ptr.h | 27 +++++++++++++------------ ETL/trunk/Makefile.am | 2 +- ETL/trunk/config/build.cfg | 2 +- ETL/trunk/doxygen.cfg | 2 +- ETL/trunk/test/Makefile.am | 4 ++-- ETL/trunk/test/fixed.cpp | 2 +- ETL/trunk/test/handle.cpp | 10 +++++----- ETL/trunk/test/smart_ptr.cpp | 4 ++-- 14 files changed, 72 insertions(+), 42 deletions(-) diff --git a/ETL/trunk/ETL.pbproj/frameworkfix.cpp b/ETL/trunk/ETL.pbproj/frameworkfix.cpp index 83f0e3a..0aee6e8 100644 --- a/ETL/trunk/ETL.pbproj/frameworkfix.cpp +++ b/ETL/trunk/ETL.pbproj/frameworkfix.cpp @@ -3,7 +3,6 @@ * ETL * * Created by Robert Quattlebaum on Mon Aug 26 2002. - * Copyright (c) 2002 __MyCompanyName__. All rights reserved. * */ diff --git a/ETL/trunk/ETL.pc.in b/ETL/trunk/ETL.pc.in index 04ef18f..8b8dcd4 100644 --- a/ETL/trunk/ETL.pc.in +++ b/ETL/trunk/ETL.pc.in @@ -6,6 +6,6 @@ includedir=@includedir@ Name: ETL Description: Voria Extended Class and Template Library Requires: -Version: 0.04.06 +Version: 0.04.07 Libs: @LIBS@ Cflags: -I${includedir} diff --git a/ETL/trunk/ETL/_clock_gettimeofday.h b/ETL/trunk/ETL/_clock_gettimeofday.h index 8626c73..ab6a770 100644 --- a/ETL/trunk/ETL/_clock_gettimeofday.h +++ b/ETL/trunk/ETL/_clock_gettimeofday.h @@ -87,7 +87,7 @@ protected: return ret; } - inline timestamp &operator+(timestamp rhs)const + inline timestamp operator+(timestamp rhs)const { rhs.tv_usec+=tv_usec; diff --git a/ETL/trunk/ETL/_curve_func.h b/ETL/trunk/ETL/_curve_func.h index b578888..b1be012 100644 --- a/ETL/trunk/ETL/_curve_func.h +++ b/ETL/trunk/ETL/_curve_func.h @@ -43,7 +43,7 @@ struct affine_combo T reverse(const T &x, const T &b, const K &t)const { - return T( (x-b*t)*(static_cast(1)/(static_cast(1)-t)) ); + return T( (x-t*b)*(static_cast(1)/(static_cast(1)-t)) ); } }; diff --git a/ETL/trunk/ETL/_fixed.h b/ETL/trunk/ETL/_fixed.h index cf69fc1..642e164 100644 --- a/ETL/trunk/ETL/_fixed.h +++ b/ETL/trunk/ETL/_fixed.h @@ -111,12 +111,12 @@ private: class raw { }; public: fixed_base()ETL_ATTRIB_INLINE; - fixed_base(const _fixed &x)ETL_ATTRIB_INLINE; fixed_base(const float &f)ETL_ATTRIB_INLINE; fixed_base(const double &f)ETL_ATTRIB_INLINE; fixed_base(const long double &f)ETL_ATTRIB_INLINE; fixed_base(const int &i)ETL_ATTRIB_INLINE; fixed_base(const int &n,const int &d)ETL_ATTRIB_INLINE; //!< Fraction constructor + fixed_base(const _fixed &x)ETL_ATTRIB_INLINE; fixed_base(value_type x,raw)ETL_ATTRIB_INLINE; T &data() ETL_ATTRIB_PURE ETL_ATTRIB_INLINE; @@ -142,6 +142,8 @@ public: _fixed operator/(const _fixed &rhs)const ETL_ATTRIB_INLINE; _fixed operator*(const int &rhs)const ETL_ATTRIB_INLINE; _fixed operator/(const int &rhs)const ETL_ATTRIB_INLINE; + _fixed operator*(const float &rhs)const ETL_ATTRIB_INLINE; + _fixed operator*(const double &rhs)const ETL_ATTRIB_INLINE; // Negation Operator _fixed operator-()const ETL_ATTRIB_INLINE; @@ -175,15 +177,15 @@ fixed_base::fixed_base(const _fixed &x):_data(x._data) {} template -fixed_base::fixed_base(const float &f):_data(static_cast(f*_ONE()+0.5f)) +fixed_base::fixed_base(const float &f):_data(static_cast(f*_ONE()/*+0.5f*/)) {} template -fixed_base::fixed_base(const double &f):_data(static_cast(f*_ONE()+0.5)) +fixed_base::fixed_base(const double &f):_data(static_cast(f*_ONE()/*+0.5*/)) {} template -fixed_base::fixed_base(const long double &f):_data(static_cast(f*_ONE()+0.5)) +fixed_base::fixed_base(const long double &f):_data(static_cast(f*_ONE()/*+0.5*/)) {} template @@ -394,6 +396,21 @@ fixed_base::operator*(const int &rhs)const //return reinterpret_cast<_fixed>(_data*rhs); } +//! fixed * float +template fixed_base +fixed_base::operator*(const float &rhs)const +{ + return (*this)*_fixed(rhs); +} + +//! fixed * double +template fixed_base +fixed_base::operator*(const double &rhs)const +{ + return (*this)*_fixed(rhs); +} + + //! fixed / int template fixed_base fixed_base::operator/(const int &rhs)const @@ -404,7 +421,19 @@ fixed_base::operator/(const int &rhs)const //return reinterpret_cast<_fixed>(_data/rhs); } +//! float * fixed +template fixed_base +operator*(const float& lhs, const fixed_base &rhs) +{ + return rhs*lhs; +} +//! double * fixed +template fixed_base +operator*(const double& lhs, const fixed_base &rhs) +{ + return rhs*lhs; +} diff --git a/ETL/trunk/ETL/_handle.h b/ETL/trunk/ETL/_handle.h index 0cf5af2..317f6c2 100644 --- a/ETL/trunk/ETL/_handle.h +++ b/ETL/trunk/ETL/_handle.h @@ -257,14 +257,14 @@ public: operator->()const { assert(obj); return obj; } - //! static_cast<> overload -- Useful for implicit casts - template - operator handle()const - { return handle(static_cast(obj)); } + //! More explicit bool cast + operator bool()const + { return obj!=NULL; } operator handle()const { return handle(static_cast(obj)); } + //! static_cast\<\> wrapper template static handle cast_static(const handle &x) @@ -303,13 +303,14 @@ public: //! Returns pointer to the object that is being wrapped pointer get()const { return obj; } - //! More explicit bool cast - operator bool()const - { return obj!=NULL; } - bool operator!()const { return !obj; } + + //! static_cast<> overload -- Useful for implicit casts + template + operator handle()const + { return handle(static_cast(obj)); } }; // END of template class handle // ======================================================================== diff --git a/ETL/trunk/ETL/_smart_ptr.h b/ETL/trunk/ETL/_smart_ptr.h index 4609880..479c966 100644 --- a/ETL/trunk/ETL/_smart_ptr.h +++ b/ETL/trunk/ETL/_smart_ptr.h @@ -178,19 +178,6 @@ public: pointer operator->()const { assert(obj); return obj; } - //! Overloaded cast operator -- useful for implicit casts - template - operator smart_ptr() - { - // This next line should provide a syntax check - // to make sure that this cast makes sense. - // If it doesn't, this should have a compiler error. - // Otherwise, it should get optimized right out - // of the code. - //(U*)obj; - - return *reinterpret_cast*>(this); - } operator smart_ptr()const { return smart_ptr(static_cast(obj)); } @@ -217,6 +204,20 @@ public: bool operator!()const { return !obj; } + //! Overloaded cast operator -- useful for implicit casts + template + operator smart_ptr() + { + // This next line should provide a syntax check + // to make sure that this cast makes sense. + // If it doesn't, this should have a compiler error. + // Otherwise, it should get optimized right out + // of the code. + //(U*)obj; + + return *reinterpret_cast*>(this); + } + }; // END of template class smart_ptr // ======================================================================== diff --git a/ETL/trunk/Makefile.am b/ETL/trunk/Makefile.am index 69d1690..6f67533 100644 --- a/ETL/trunk/Makefile.am +++ b/ETL/trunk/Makefile.am @@ -13,7 +13,7 @@ bin_SCRIPTS=ETL-config aclocaldir = $(prefix)/share/aclocal -EXTRA_DIST=bootstrap config/depcomp config/cxx_macros.m4 ETL.pbproj/project.pbxproj ETL.pbproj/etl_profile.h ETL.pbproj/frameworkfix.cpp @PACKAGE_TARNAME@-@VERSION@.spec config/project.spec.in config/build.cfg ETL.kdevproj ETL-config.in config/ETL.m4 config/doxygen.cfg.in doxygen.cfg config/pkgconfig.pc.in @PACKAGE_TARNAME@.pc.in +EXTRA_DIST=bootstrap config/subs.m4 config/depcomp config/cxx_macros.m4 ETL.pbproj/project.pbxproj ETL.pbproj/etl_profile.h ETL.pbproj/frameworkfix.cpp @PACKAGE_TARNAME@-@VERSION@.spec config/project.spec.in config/build.cfg ETL-config.in config/ETL.m4 config/doxygen.cfg.in doxygen.cfg config/pkgconfig.pc.in @PACKAGE_TARNAME@.pc.in CVS=cvs diff --git a/ETL/trunk/config/build.cfg b/ETL/trunk/config/build.cfg index 14fc4d3..a9edf09 100644 --- a/ETL/trunk/config/build.cfg +++ b/ETL/trunk/config/build.cfg @@ -4,7 +4,7 @@ PACKAGE_BUGREPORT="darco@deepdarc.com" PACKAGE_TARNAME="ETL" VERSION_MAJ="0" VERSION_MIN="04" -VERSION_REV="06" +VERSION_REV="07" VERSION_REL="1" VERSION=$VERSION_MAJ.$VERSION_MIN.$VERSION_REV diff --git a/ETL/trunk/doxygen.cfg b/ETL/trunk/doxygen.cfg index b1adccf..776e0d7 100644 --- a/ETL/trunk/doxygen.cfg +++ b/ETL/trunk/doxygen.cfg @@ -23,7 +23,7 @@ PROJECT_NAME = "ETL" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.04.06 +PROJECT_NUMBER = 0.04.07 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/ETL/trunk/test/Makefile.am b/ETL/trunk/test/Makefile.am index 5277f51..e493c0c 100644 --- a/ETL/trunk/test/Makefile.am +++ b/ETL/trunk/test/Makefile.am @@ -3,9 +3,9 @@ MAINTAINERCLEANFILES=Makefile.in CXXFLAGS=@CXXFLAGS@ -I$(top_srcdir) -I$(top_builddir) DEFAULT_INCLUDES=-I$(top_srcdir) -I$(top_builddir) -TESTS=value fixed clock handle angle random hermite spline stringf pen surface smart_ptr benchmark +TESTS=fixed clock handle angle random hermite stringf pen surface smart_ptr benchmark -check_PROGRAMS=value fixed handle clock angle random hermite spline stringf pen surface smart_ptr benchmark smach +check_PROGRAMS=fixed handle clock angle random hermite stringf pen surface smart_ptr benchmark smach benchmark_SOURCES=benchmark.cpp smart_ptr_SOURCES=smart_ptr.cpp diff --git a/ETL/trunk/test/fixed.cpp b/ETL/trunk/test/fixed.cpp index fbdac51..030b5c7 100644 --- a/ETL/trunk/test/fixed.cpp +++ b/ETL/trunk/test/fixed.cpp @@ -100,7 +100,7 @@ struct speed_test a=value_type(0.25); b=value_type(2); c=value_type(4.5); - const value_type half(0.5); + const value_type half(static_cast(0.5)); int i; etl::clock MyTimer; MyTimer.reset(); diff --git a/ETL/trunk/test/handle.cpp b/ETL/trunk/test/handle.cpp index db7a35d..fd40e25 100644 --- a/ETL/trunk/test/handle.cpp +++ b/ETL/trunk/test/handle.cpp @@ -85,11 +85,11 @@ typedef list< robj_handle > robj_list; int handle_basic_test() { - printf("handle: Size of a handle: %d\n",sizeof(etl::handle)); - printf("handle: Size of a loose_handle: %d\n",sizeof(etl::loose_handle)); - printf("handle: Size of a rhandle: %d\n",sizeof(etl::rhandle)); - printf("handle: Size of a shared_object: %d\n",sizeof(etl::shared_object)); - printf("handle: Size of a rshared_object: %d\n",sizeof(etl::rshared_object)); + printf("handle: Size of a handle: %u\n",(unsigned int)sizeof(etl::handle)); + printf("handle: Size of a loose_handle: %u\n",(unsigned int)sizeof(etl::loose_handle)); + printf("handle: Size of a rhandle: %u\n",(unsigned int)sizeof(etl::rhandle)); + printf("handle: Size of a shared_object: %u\n",(unsigned int)sizeof(etl::shared_object)); + printf("handle: Size of a rshared_object: %u\n",(unsigned int)sizeof(etl::rshared_object)); printf("handle: Basic test: "); my_test_obj::instance_count=0; diff --git a/ETL/trunk/test/smart_ptr.cpp b/ETL/trunk/test/smart_ptr.cpp index 287ada5..e0fc8ba 100644 --- a/ETL/trunk/test/smart_ptr.cpp +++ b/ETL/trunk/test/smart_ptr.cpp @@ -86,8 +86,8 @@ typedef list< other_obj_smart_ptr > other_obj_list; int smart_ptr_basic_test(void) { - printf("smart_ptr: Size of a smart_ptr: %d\n",sizeof(obj_smart_ptr)); - printf("smart_ptr: Size of a reference_counter: %d\n",sizeof(etl::reference_counter)); + printf("smart_ptr: Size of a smart_ptr: %u\n",(unsigned int)sizeof(obj_smart_ptr)); + printf("smart_ptr: Size of a reference_counter: %u\n",(unsigned int)sizeof(etl::reference_counter)); printf("smart_ptr: Basic test: "); -- 2.7.4