---
rtt/internal/DataSources.hpp | 10 ++++++++--
rtt/internal/Reference.hpp | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/rtt/internal/DataSources.hpp b/rtt/internal/DataSources.hpp
index 2939e32..1734b32 100644
--- a/rtt/internal/DataSources.hpp
+++ b/rtt/internal/DataSources.hpp
@@ -226,10 +226,16 @@ namespace RTT
{
mptr = static_cast<T*>(ref);
}
- void setReference(base::DataSourceBase::shared_ptr dsb)
+ bool setReference(base::DataSourceBase::shared_ptr dsb)
{
typename AssignableDataSource<T>::shared_ptr ads = boost::dynamic_pointer_cast<AssignableDataSource
+ if (ads) {
+ ads->evaluate();
+ mptr = &ads->set();
+ return true;
+ } else {
+ return false;
+ }
}
typename DataSource<T>::result_t get() const
diff --git a/rtt/internal/Reference.hpp b/rtt/internal/Reference.hpp
index 45b0dc9..6c9471b 100644
--- a/rtt/internal/Reference.hpp
+++ b/rtt/internal/Reference.hpp
@@ -28,7 +28,7 @@ namespace RTT
* keep track of the lifetime of \a dsb, that it lives longer
* than this object.
*/
- virtual void setReference(base::DataSourceBase::shared_ptr dsb) = 0;
+ virtual bool setReference(base::DataSourceBase::shared_ptr dsb) = 0;
};
}
}
[PATCH] ReferenceDSB, setReference returns bool success status
Hi Markus,
On Thu, Oct 13, 2011 at 7:19 PM, Markus Klotzbuecher <
markus [dot] klotzbuecher [..] ...> wrote:
> ---
> - if (ads) mptr = &ads->set();
> rtt/internal/DataSources.hpp | 10 ++++++++--
> rtt/internal/Reference.hpp | 2 +-
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/rtt/internal/DataSources.hpp b/rtt/internal/DataSources.hpp
> index 2939e32..1734b32 100644
> --- a/rtt/internal/DataSources.hpp
> +++ b/rtt/internal/DataSources.hpp
> @@ -226,10 +226,16 @@ namespace RTT
> {
> mptr = static_cast<T*>(ref);
> }
> - void setReference(base::DataSourceBase::shared_ptr dsb)
> + bool setReference(base::DataSourceBase::shared_ptr dsb)
> {
> typename AssignableDataSource<T>::shared_ptr ads =
> boost::dynamic_pointer_cast<AssignableDataSource
> + if (ads) {
> + ads->evaluate();
> + mptr = &ads->set();
> + return true;
> + } else {
> + return false;
> + }
> }
>
> typename DataSource<T>::result_t get() const
> diff --git a/rtt/internal/Reference.hpp b/rtt/internal/Reference.hpp
> index 45b0dc9..6c9471b 100644
> --- a/rtt/internal/Reference.hpp
> +++ b/rtt/internal/Reference.hpp
> @@ -28,7 +28,7 @@ namespace RTT
> * keep track of the lifetime of \a dsb, that it lives longer
> * than this object.
> */
> - virtual void setReference(base::DataSourceBase::shared_ptr
> dsb) = 0;
> + virtual bool setReference(base::DataSourceBase::shared_ptr
> dsb) = 0;
>
Please document the meaning of the return value and also that dsb may be
evaluated before the reference is taken.
Peter
[PATCH] v2 ReferenceDSB, setReference returns bool success statu
Also call evaluate on argument dsb before taking reference.
---
rtt/internal/DataSources.hpp | 10 ++++++++--
rtt/internal/Reference.hpp | 7 ++++++-
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/rtt/internal/DataSources.hpp b/rtt/internal/DataSources.hpp
- if (ads) mptr = &ads->set();
index 2939e32..1734b32 100644
--- a/rtt/internal/DataSources.hpp
+++ b/rtt/internal/DataSources.hpp
@@ -226,10 +226,16 @@ namespace RTT
{
mptr = static_cast<T*>(ref);
}
- void setReference(base::DataSourceBase::shared_ptr dsb)
+ bool setReference(base::DataSourceBase::shared_ptr dsb)
{
typename AssignableDataSource<T>::shared_ptr ads = boost::dynamic_pointer_cast<AssignableDataSource
+ if (ads) {
+ ads->evaluate();
+ mptr = &ads->set();
+ return true;
+ } else {
+ return false;
+ }
}
typename DataSource<T>::result_t get() const
diff --git a/rtt/internal/Reference.hpp b/rtt/internal/Reference.hpp
index 45b0dc9..e004587 100644
--- a/rtt/internal/Reference.hpp
+++ b/rtt/internal/Reference.hpp
@@ -27,8 +27,13 @@ namespace RTT
* of the data. The shared pointer is not necessarily stored, so
* keep track of the lifetime of \a dsb, that it lives longer
* than this object.
+ * @return false if setting failed. More precisely
+ * this might fail if dynamic_cast'ing the argument to the
+ * Reference DataSource fails.
+ * @note This method will also call evaluate on the dsb to
+ * assure the correct value is used.
*/
- virtual void setReference(base::DataSourceBase::shared_ptr dsb) = 0;
+ virtual bool setReference(base::DataSourceBase::shared_ptr dsb) = 0;
};
}
}
[PATCH] v2 ReferenceDSB, setReference returns bool success statu
I've pushed this to toolchain-2.5 and merged the lua branches in ocl's
toolchain-2.5 branch too.
I also fixed the search path for OCL in the ROS Debian builds.
We need a new release for the ROS packages...
Peter
On Fri, Oct 14, 2011 at 8:15 AM, Markus Klotzbuecher
> - if (ads) mptr = &ads->set();
<markus [dot] klotzbuecher [..] ...> wrote:
> Also call evaluate on argument dsb before taking reference.
> ---
> rtt/internal/DataSources.hpp | 10 ++++++++--
> rtt/internal/Reference.hpp | 7 ++++++-
> 2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/rtt/internal/DataSources.hpp b/rtt/internal/DataSources.hpp
> index 2939e32..1734b32 100644
> --- a/rtt/internal/DataSources.hpp
> +++ b/rtt/internal/DataSources.hpp
> @@ -226,10 +226,16 @@ namespace RTT
> {
> mptr = static_cast<T*>(ref);
> }
> - void setReference(base::DataSourceBase::shared_ptr dsb)
> + bool setReference(base::DataSourceBase::shared_ptr dsb)
> {
> typename AssignableDataSource<T>::shared_ptr ads = boost::dynamic_pointer_cast<AssignableDataSource
> + if (ads) {
> + ads->evaluate();
> + mptr = &ads->set();
> + return true;
> + } else {
> + return false;
> + }
> }
>
> typename DataSource<T>::result_t get() const
> diff --git a/rtt/internal/Reference.hpp b/rtt/internal/Reference.hpp
> index 45b0dc9..e004587 100644
> --- a/rtt/internal/Reference.hpp
> +++ b/rtt/internal/Reference.hpp
> @@ -27,8 +27,13 @@ namespace RTT
> * of the data. The shared pointer is not necessarily stored, so
> * keep track of the lifetime of \a dsb, that it lives longer
> * than this object.
> + * @return false if setting failed. More precisely
> + * this might fail if dynamic_cast'ing the argument to the
> + * Reference DataSource fails.
> + * @note This method will also call evaluate on the dsb to
> + * assure the correct value is used.
> */
> - virtual void setReference(base::DataSourceBase::shared_ptr dsb) = 0;
> + virtual bool setReference(base::DataSourceBase::shared_ptr dsb) = 0;
> };
> }
> }
> --
> 1.7.5.4
>
>
--
Orocos-Dev mailing list
Orocos-Dev [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
[PATCH] v2 ReferenceDSB, setReference returns bool success statu
On Sun, Oct 16, 2011 at 04:15:54PM +0200, Peter Soetens wrote:
> I've pushed this to toolchain-2.5 and merged the lua branches in ocl's
> toolchain-2.5 branch too.
>
> I also fixed the search path for OCL in the ROS Debian builds.
>
> We need a new release for the ROS packages...
Thanks Peter!
Markus