From e3469b0e983af7f7b0800e3cf285c3784672b3cd Mon Sep 17 00:00:00 2001
From: Rainer Kartmann <rainer.kartmann@student.kit.edu>
Date: Wed, 3 Apr 2019 13:59:55 +0200
Subject: [PATCH] Added attribute isSet()

---
 VirtualRobot/CMakeLists.txt                 | 1 +
 VirtualRobot/MJCF/elements/core/Attribute.h | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/VirtualRobot/CMakeLists.txt b/VirtualRobot/CMakeLists.txt
index 8e143a46a..64ba542d4 100644
--- a/VirtualRobot/CMakeLists.txt
+++ b/VirtualRobot/CMakeLists.txt
@@ -518,6 +518,7 @@ SET(INCLUDES
     MJCF/elements/has_member.hpp
     MJCF/elements/core/AnyElement.h
     MJCF/elements/core/Attribute.h
+    MJCF/elements/core/const_aware_ptr.hpp
     MJCF/elements/core/Element.h
     MJCF/elements/core/exceptions.h
     MJCF/elements/core/mjcf_utils.h
diff --git a/VirtualRobot/MJCF/elements/core/Attribute.h b/VirtualRobot/MJCF/elements/core/Attribute.h
index 845e0c08e..e420dcf18 100644
--- a/VirtualRobot/MJCF/elements/core/Attribute.h
+++ b/VirtualRobot/MJCF/elements/core/Attribute.h
@@ -101,6 +101,9 @@ namespace mjcf
         /// Indicate whether the attribute has a default (implies optional).
         virtual bool hasDefault() const = 0;
         
+        /// Indicate whether the attribute is set.
+        bool isSet() const { return this->owner().isAttributeSet(this->name); }
+        
         
     protected:
         
@@ -181,6 +184,7 @@ namespace mjcf
     private:
         
         AttrT defaultValue; ///< The default value.
+        
     };
     
 
-- 
GitLab