* ETL
*
* Created by Robert Quattlebaum on Mon Aug 26 2002.
- * Copyright (c) 2002 __MyCompanyName__. All rights reserved.
*
*/
Name: ETL
Description: Voria Extended Class and Template Library
Requires:
-Version: 0.04.06
+Version: 0.04.07
Libs: @LIBS@
Cflags: -I${includedir}
return ret;
}
- inline timestamp &operator+(timestamp rhs)const
+ inline timestamp operator+(timestamp rhs)const
{
rhs.tv_usec+=tv_usec;
T reverse(const T &x, const T &b, const K &t)const
{
- return T( (x-b*t)*(static_cast<K>(1)/(static_cast<K>(1)-t)) );
+ return T( (x-t*b)*(static_cast<K>(1)/(static_cast<K>(1)-t)) );
}
};
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;
_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;
{}
template <class T,unsigned int FIXED_BITS>
-fixed_base<T,FIXED_BITS>::fixed_base(const float &f):_data(static_cast<value_type>(f*_ONE()+0.5f))
+fixed_base<T,FIXED_BITS>::fixed_base(const float &f):_data(static_cast<value_type>(f*_ONE()/*+0.5f*/))
{}
template <class T,unsigned int FIXED_BITS>
-fixed_base<T,FIXED_BITS>::fixed_base(const double &f):_data(static_cast<value_type>(f*_ONE()+0.5))
+fixed_base<T,FIXED_BITS>::fixed_base(const double &f):_data(static_cast<value_type>(f*_ONE()/*+0.5*/))
{}
template <class T,unsigned int FIXED_BITS>
-fixed_base<T,FIXED_BITS>::fixed_base(const long double &f):_data(static_cast<value_type>(f*_ONE()+0.5))
+fixed_base<T,FIXED_BITS>::fixed_base(const long double &f):_data(static_cast<value_type>(f*_ONE()/*+0.5*/))
{}
template <class T,unsigned int FIXED_BITS>
//return reinterpret_cast<_fixed>(_data*rhs);
}
+//! fixed * float
+template <class T,unsigned int FIXED_BITS>fixed_base<T,FIXED_BITS>
+fixed_base<T,FIXED_BITS>::operator*(const float &rhs)const
+{
+ return (*this)*_fixed(rhs);
+}
+
+//! fixed * double
+template <class T,unsigned int FIXED_BITS>fixed_base<T,FIXED_BITS>
+fixed_base<T,FIXED_BITS>::operator*(const double &rhs)const
+{
+ return (*this)*_fixed(rhs);
+}
+
+
//! fixed / int
template <class T,unsigned int FIXED_BITS>fixed_base<T,FIXED_BITS>
fixed_base<T,FIXED_BITS>::operator/(const int &rhs)const
//return reinterpret_cast<_fixed>(_data/rhs);
}
+//! float * fixed
+template <class T,unsigned int FIXED_BITS>fixed_base<T,FIXED_BITS>
+operator*(const float& lhs, const fixed_base<T,FIXED_BITS> &rhs)
+{
+ return rhs*lhs;
+}
+//! double * fixed
+template <class T,unsigned int FIXED_BITS>fixed_base<T,FIXED_BITS>
+operator*(const double& lhs, const fixed_base<T,FIXED_BITS> &rhs)
+{
+ return rhs*lhs;
+}
operator->()const
{ assert(obj); return obj; }
- //! static_cast<> overload -- Useful for implicit casts
- template <class U>
- operator handle<U>()const
- { return handle<U>(static_cast<U*>(obj)); }
+ //! More explicit bool cast
+ operator bool()const
+ { return obj!=NULL; }
operator handle<const value_type>()const
{ return handle<const value_type>(static_cast<const_pointer>(obj)); }
+
//! <tt> static_cast\<\> </tt> wrapper
template <class U> static
handle<T> cast_static(const handle<U> &x)
//! 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 <class U>
+ operator handle<U>()const
+ { return handle<U>(static_cast<U*>(obj)); }
}; // END of template class handle
// ========================================================================
pointer operator->()const { assert(obj); return obj; }
- //! Overloaded cast operator -- useful for implicit casts
- template <class U>
- operator smart_ptr<U>()
- {
- // 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<smart_ptr<U>*>(this);
- }
operator smart_ptr<const value_type>()const
{ return smart_ptr<const value_type>(static_cast<const_pointer>(obj)); }
bool operator!()const { return !obj; }
+ //! Overloaded cast operator -- useful for implicit casts
+ template <class U>
+ operator smart_ptr<U>()
+ {
+ // 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<smart_ptr<U>*>(this);
+ }
+
}; // END of template class smart_ptr
// ========================================================================
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
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
# 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.
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
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<value_type>(0.5));
int i;
etl::clock MyTimer;
MyTimer.reset();
int handle_basic_test()
{
- printf("handle: Size of a handle: %d\n",sizeof(etl::handle<int>));
- printf("handle: Size of a loose_handle: %d\n",sizeof(etl::loose_handle<int>));
- printf("handle: Size of a rhandle: %d\n",sizeof(etl::rhandle<int>));
- 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<int>));
+ printf("handle: Size of a loose_handle: %u\n",(unsigned int)sizeof(etl::loose_handle<int>));
+ printf("handle: Size of a rhandle: %u\n",(unsigned int)sizeof(etl::rhandle<int>));
+ 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;
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: ");