From 71cc79a54b2d06e365e6f11fa43ee79715024844 Mon Sep 17 00:00:00 2001 From: Francois Keith <keith@lirmm.fr> Date: Fri, 28 Feb 2014 09:56:27 +0100 Subject: [PATCH] Add a method to check if a signal with the given name exists. --- include/dynamic-graph/entity.h | 1 + src/dgraph/entity.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/dynamic-graph/entity.h b/include/dynamic-graph/entity.h index f0bc3e0..0b866a6 100644 --- a/include/dynamic-graph/entity.h +++ b/include/dynamic-graph/entity.h @@ -84,6 +84,7 @@ namespace dynamicgraph } virtual const std::string& getClassName () const = 0; virtual std::string getDocString () const; + bool hasSignal( const std::string & signame ) const; SignalBase<int>& getSignal (const std::string& signalName); const SignalBase<int>& getSignal (const std::string& signalName) const; std::ostream& displaySignalList(std::ostream& os) const; diff --git a/src/dgraph/entity.cpp b/src/dgraph/entity.cpp index 44c402c..adae4b6 100644 --- a/src/dgraph/entity.cpp +++ b/src/dgraph/entity.cpp @@ -149,6 +149,11 @@ std::string Entity::getDocString () const return *(sigkey ->second) ; +bool Entity:: +hasSignal( const string & signame ) const +{ + return (!(signalMap.find(signame) == signalMap.end ())); +} SignalBase<int>& Entity:: getSignal( const string & signame ) -- GitLab