[Fawkes Git] branch/bschaepers/asp-aspect: ASP-Aspect: Added external handling.

Bjoern Schaepers bjoern.schaepers at rwth-aachen.de
Mon Oct 31 17:04:33 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, bschaepers/asp-aspect has been updated
        to  14251eb0b2849c52128d21c0abaeea632d8f035c (commit)
      from  050cadb8d8438039009e4606ffcb993d1c977f9d (commit)

http://git.fawkesrobotics.org/fawkes.git/bschaepers/asp-aspect

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- *Log* ---------------------------------------------------------------
commit 14251eb0b2849c52128d21c0abaeea632d8f035c
Author:     Bjoern Schaepers <bjoern.schaepers at rwth-aachen.de>
AuthorDate: Mon Oct 31 17:04:05 2016 +0100
Commit:     Bjoern Schaepers <bjoern.schaepers at rwth-aachen.de>
CommitDate: Mon Oct 31 17:04:05 2016 +0100

    ASP-Aspect: Added external handling.

http://git.fawkesrobotics.org/fawkes.git/commit/14251eb
http://trac.fawkesrobotics.org/changeset/14251eb

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 src/plugins/asp/aspect/clingo_access.cpp |   55 ++++++++++++++++++++++++++++++
 src/plugins/asp/aspect/clingo_access.h   |    3 ++
 2 files changed, 58 insertions(+), 0 deletions(-)


- *Diffs* -------------------------------------------------------------

- *commit* 14251eb0b2849c52128d21c0abaeea632d8f035c - - - - - - - - - -
Author:  Bjoern Schaepers <bjoern.schaepers at rwth-aachen.de>
Date:    Mon Oct 31 17:04:05 2016 +0100
Subject: ASP-Aspect: Added external handling.

 src/plugins/asp/aspect/clingo_access.cpp |   55 ++++++++++++++++++++++++++++++
 src/plugins/asp/aspect/clingo_access.h   |    3 ++
 2 files changed, 58 insertions(+), 0 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/asp/aspect/clingo_access.cpp b/src/plugins/asp/aspect/clingo_access.cpp
index 5d7b822..fd4a60e 100644
--- a/src/plugins/asp/aspect/clingo_access.cpp
+++ b/src/plugins/asp/aspect/clingo_access.cpp
@@ -353,4 +353,59 @@ ClingoAccess::ground(const Clingo::PartSpan& parts)
 	return true;
 }
 
+/**
+ * @brief Assigns an external value.
+ * @param[in] atom The atom to assign.
+ * @param[in] value The assigned value.
+ * @return If it could be assigned.
+ */
+bool
+ClingoAccess::assign_external(const Clingo::Symbol atom, const Clingo::TruthValue value)
+{
+	MutexLocker locker(&ControlMutex);
+	if ( Solving )
+	{
+		return false;
+	} //if ( Solving )
+
+	if ( Debug )
+	{
+		Log->log_info(LogComponent.c_str(), "Assigning %s to %s.", [value](void)
+			{
+				const char *ret = "Unknown Value";
+				switch ( value )
+				{
+					case Clingo::TruthValue::Free  : ret = "Free";  break;
+					case Clingo::TruthValue::True  : ret = "True";  break;
+					case Clingo::TruthValue::False : ret = "False"; break;
+				} //switch ( value )
+				return ret;
+			}, atom.string());
+	} //if ( Debug )
+	Control.assign_external(atom, value);
+	return true;
+}
+
+/**
+ * @brief Releases an external value.
+ * @param[in] atom The atom to release.
+ * @return If it could be released.
+ */
+bool
+ClingoAccess::release_external(const Clingo::Symbol atom)
+{
+	MutexLocker locker(&ControlMutex);
+	if ( Solving )
+	{
+		return false;
+	} //if ( Solving )
+
+	if ( Debug )
+	{
+		Log->log_info(LogComponent.c_str(), "Releasing %s.", atom.string());
+	} //if ( Debug )
+	Control.release_external(atom);
+	return true;
+}
+
 } // end namespace fawkes
diff --git a/src/plugins/asp/aspect/clingo_access.h b/src/plugins/asp/aspect/clingo_access.h
index 6f6ed18..ebeb189 100644
--- a/src/plugins/asp/aspect/clingo_access.h
+++ b/src/plugins/asp/aspect/clingo_access.h
@@ -75,6 +75,9 @@ class ClingoAccess
 	bool loadFile(const std::string& path);
 
 	bool ground(const Clingo::PartSpan& parts);
+
+	bool assign_external(const Clingo::Symbol atom, const Clingo::TruthValue value);
+	bool release_external(const Clingo::Symbol atom);
 };
 
 } // end namespace fawkes




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list