bind, template member function and thread
Hi all, I would like to use thread with a member function which takes parameters. Here is the code I actually use : shared_ptr<Profile> p2 ( new Profile(origine+(double)i*width_sur_nb_fois_wdir,rect->GetHeightDirection(),MPPParameters_.ProfilesNbPoints_,MPPParameters_.ProfilesDistancePoints_ ) ); shared_ptr<Profile> p3 ( new Profile(origine+(double)(-i)*width_sur_nb_fois_wdir,rect->GetHeightDirection(),MPPParameters_.ProfilesNbPoints_,MPPParameters_.ProfilesDistancePoints_ ) ); p2->ComputeRadiometries(image_,BILINEAR); p3->ComputeRadiometries(image_,BILINEAR); ComputeRadiometries is a template member function : template <class T> bool ComputeRadiometries( boost::shared_ptr< TTImage <T>
image , const eInterpolatorType type_interpolator=BICUBIC )
This compiles fine : boost::function<bool (Profile*, boost::shared_ptr< TTImage <unsigned char>
, eInterpolatorType)> f;
But, this does not : f = &Profile::ComputeRadiometries; I would like to use boost::bind in order to call ComputeRadiometries with a thread. Can you help ? Regards -- Le temps des cerises reviendra. Dans l'immédiat, c'est le temps des noyaux. Courage.
On 11/13/07, Olivier Tournaire <olitour@gmail.com> wrote:
Hi all,
I would like to use thread with a member function which takes parameters. Here is the code I actually use :
shared_ptr<Profile> p2 ( new Profile(origine+(double)i*width_sur_nb_fois_wdir,rect->GetHeightDirection(),MPPParameters_.ProfilesNbPoints_,MPPParameters_.ProfilesDistancePoints_ ) ); shared_ptr<Profile> p3 ( new Profile(origine+(double)(-i)*width_sur_nb_fois_wdir,rect->GetHeightDirection(),MPPParameters_.ProfilesNbPoints_,MPPParameters_.ProfilesDistancePoints_ ) ); p2->ComputeRadiometries(image_,BILINEAR); p3->ComputeRadiometries(image_,BILINEAR);
ComputeRadiometries is a template member function : template <class T> bool ComputeRadiometries( boost::shared_ptr< TTImage <T> > image , const eInterpolatorType type_interpolator=BICUBIC )
This compiles fine : boost::function<bool (Profile*, boost::shared_ptr< TTImage <unsigned char>
, eInterpolatorType)> f;
But, this does not : f = &Profile::ComputeRadiometries;
This is incorrect. How should the compiler know which function address do you mean? The correct way would be: f=&Profile::template ComputeRadiometries<unsigned int>; I would like to use boost::bind in order to call ComputeRadiometries with a
thread.
Can you help ?
Regards
-- Le temps des cerises reviendra. Dans l'immédiat, c'est le temps des noyaux. Courage. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Ovanes, 2007/11/13, Ovanes Markarian <om_boost@keywallet.com>:
On 11/13/07, Olivier Tournaire <olitour@gmail.com> wrote:
Hi all,
I would like to use thread with a member function which takes parameters. Here is the code I actually use :
shared_ptr<Profile> p2 ( new Profile(origine+(double)i*width_sur_nb_fois_wdir,rect->GetHeightDirection(),MPPParameters_.ProfilesNbPoints_,MPPParameters_.ProfilesDistancePoints_ ) ); shared_ptr<Profile> p3 ( new Profile(origine+(double)(-i)*width_sur_nb_fois_wdir,rect->GetHeightDirection(),MPPParameters_.ProfilesNbPoints_,MPPParameters_.ProfilesDistancePoints_ ) ); p2->ComputeRadiometries(image_,BILINEAR); p3->ComputeRadiometries(image_,BILINEAR);
ComputeRadiometries is a template member function : template <class T> bool ComputeRadiometries( boost::shared_ptr< TTImage <T> > image , const eInterpolatorType type_interpolator=BICUBIC )
This compiles fine : boost::function<bool (Profile*, boost::shared_ptr< TTImage <unsigned char> >, eInterpolatorType)> f;
But, this does not : f = &Profile::ComputeRadiometries;
This is incorrect. How should the compiler know which function address do you mean? The correct way would be: f=&Profile::template ComputeRadiometries<unsigned int>;
This does not seem to work. The compiler error is : error C2440: '=' : impossible de convertir de 'overloaded-function' en 'boost::function<Signature>' with [ Signature=bool (Profile *,boost::shared_ptr<TTImage<UInt1>>,eInterpolatorType) ] I would like to use boost::bind in order to call ComputeRadiometries with a
thread.
Can you help ?
Regards
-- Le temps des cerises reviendra. Dans l'immédiat, c'est le temps des noyaux. Courage. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Le temps des cerises reviendra. Dans l'immédiat, c'est le temps des noyaux. Courage.
Sorry, it was my mistake. I seemed to read you used unsigned int to specialize the TTImage type. But you used the unsigend char. Therefore, the code should be: f=&Profile::template ComputeRadiometries<unsigned char>; On 11/13/07, Olivier Tournaire <olitour@gmail.com> wrote:
ComputeRadiometries is a template member function : template <class T> bool ComputeRadiometries( boost::shared_ptr< TTImage <T> > image , const eInterpolatorType type_interpolator=BICUBIC )
This compiles fine : boost::function<bool (Profile*, boost::shared_ptr< TTImage <unsigned char> >, eInterpolatorType)> f;
But, this does not : f = &Profile::ComputeRadiometries;
This is incorrect. How should the compiler know which function address do you mean? The correct way would be: f=&Profile::template ComputeRadiometries<unsigned int>;
This does not seem to work. The compiler error is : error C2440: '=' : impossible de convertir de 'overloaded-function' en 'boost::function<Signature>' with [ Signature=bool (Profile *,boost::shared_ptr<TTImage<UInt1>>,eInterpolatorType) ]
Yep, that what I tried, but it does not work. The compiler error is described below. 2007/11/13, Ovanes Markarian <om_boost@keywallet.com>:
Sorry,
it was my mistake. I seemed to read you used unsigned int to specialize the TTImage type. But you used the unsigend char. Therefore, the code should be:
f=&Profile::template ComputeRadiometries<unsigned char>;
On 11/13/07, Olivier Tournaire <olitour@gmail.com> wrote:
ComputeRadiometries is a template member function : template <class T> bool ComputeRadiometries( boost::shared_ptr< TTImage <T> > image , const eInterpolatorType type_interpolator=BICUBIC )
This compiles fine : boost::function<bool (Profile*, boost::shared_ptr< TTImage <unsigned char> >, eInterpolatorType)> f;
But, this does not : f = &Profile::ComputeRadiometries;
This is incorrect. How should the compiler know which function address do you mean? The correct way would be: f=&Profile::template ComputeRadiometries<unsigned int>;
This does not seem to work. The compiler error is : error C2440: '=' : impossible de convertir de 'overloaded-function' en 'boost::function<Signature>' with [ Signature=bool (Profile *,boost::shared_ptr<TTImage<UInt1>>,eInterpolatorType) ]
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Le temps des cerises reviendra. Dans l'immédiat, c'est le temps des noyaux. Courage.
Hi All, Boost path knows how to deal with windows short paths? E.g. In windows c:\progra~1\ is equivalent to c:\program files. Thanks. Ricardo
participants (3)
-
Olivier Tournaire
-
Ovanes Markarian
-
Ricardo Mayerhofer