summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2009-11-09 03:25:52 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2009-11-09 03:25:52 +0000
commit22f3879e0f771689a774dad0aa8ad461bdd7b6ee (patch)
treeaaff791684d838673ac5a2e2b82dd076fcbc8702
parentfd88be66e2ad7aa5f04006f8ef887031d9880aa2 (diff)
downloadATCD-22f3879e0f771689a774dad0aa8ad461bdd7b6ee.tar.gz
Mon Nov 9 00:49:19 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
-rw-r--r--SA_POP/ChangeLog13
-rw-r--r--SA_POP/SA_POP_Types.h18
-rw-r--r--SA_POP/SA_POP_Utils.cpp22
-rw-r--r--SA_POP/SA_POP_Utils.h15
-rw-r--r--SA_POP/SA_PlanHeuristics.cpp6
-rw-r--r--SA_POP/SA_PlanStrategy.cpp8
-rw-r--r--SA_POP/SA_WorkingPlan.cpp6
-rw-r--r--SA_POP/SA_WorkingPlan.h2
-rw-r--r--SA_POP/WorkingPlan.h2
9 files changed, 61 insertions, 31 deletions
diff --git a/SA_POP/ChangeLog b/SA_POP/ChangeLog
index 345f5020ffd..c697c630ddb 100644
--- a/SA_POP/ChangeLog
+++ b/SA_POP/ChangeLog
@@ -1,3 +1,16 @@
+Mon Nov 9 00:49:19 UTC 2009 William R. Otte <wotte@dre.vanderbilt.edu>
+
+ * SA_POP_Types.h:
+ * SA_POP_Utils.h:
+ * SA_POP_Utils.cpp:
+ * SA_PlanHeuristics.cpp:
+ * SA_PlanStrategy.cpp:
+ * SA_WorkingPlan.h:
+ * SA_WorkingPlan.cpp:
+ * WorkingPlan.h:
+
+ Portablility fixes.
+
Wed Nov 4 22:47:08 UTC 2009 John S. Kinnebrew <john.s.kinnebrew@vanderbilt.edu>
diff --git a/SA_POP/SA_POP_Types.h b/SA_POP/SA_POP_Types.h
index 662bbb95192..705a63fced4 100644
--- a/SA_POP/SA_POP_Types.h
+++ b/SA_POP/SA_POP_Types.h
@@ -223,13 +223,13 @@ namespace SA_POP {
}
// IS THE LESS THAN OPERATOR REALLY SUPPOSED TO COMPARE INSTANCES BY GREATER THAN?
- bool operator<(const SortTaskByTime & s) {
+ bool operator<(const SortTaskByTime & s) const {
return this->last_instance > s.last_instance;
}
- bool operator!=(const SortTaskByTime & s) {
+ bool operator!=(const SortTaskByTime & s) const {
return this->last_instance != s.last_instance;
}
- bool operator==(const SortTaskByTime & s) {
+ bool operator==(const SortTaskByTime & s) const {
return this->last_instance == s.last_instance;
}
};
@@ -626,8 +626,12 @@ namespace SA_POP {
struct StoredConditionEvaluator{
StoredConditionMap condition_map;
- std::pair<bool, CommandID> should_continue(CommandID cur_cmd, Condition satisfied_cond,
- TaskID satisfying_task, OpenCondMap & open_conds, InstToTaskMap & task_insts){
+ std::pair<bool, CommandID> should_continue (CommandID cur_cmd,
+ Condition satisfied_cond,
+ TaskID satisfying_task,
+ OpenCondMap &open_conds,
+ InstToTaskMap &task_insts)
+ {
StoredConditionKey stored_cond (satisfied_cond, satisfying_task, cur_cmd);
@@ -738,10 +742,10 @@ namespace SA_POP {
//Map from a causal link to the suspended conditions that are waiting for something to come
//between them and the orig. condition so they can be unsuspended
- typedef std::multimap<CausalLink, std::pair<Condition, TaskInstID>> SuspendedConditionListenerMap;
+ typedef std::multimap<CausalLink, std::pair<Condition, TaskInstID> > SuspendedConditionListenerMap;
//List of all condition/task insts that are suspended
- typedef std::set<std::pair<Condition, TaskInstID>> SuspendedConditionSet;
+ typedef std::set<std::pair<Condition, TaskInstID> > SuspendedConditionSet;
inline std::string to_string(int x)
{
diff --git a/SA_POP/SA_POP_Utils.cpp b/SA_POP/SA_POP_Utils.cpp
index e018ccc3109..b5123c4a5f5 100644
--- a/SA_POP/SA_POP_Utils.cpp
+++ b/SA_POP/SA_POP_Utils.cpp
@@ -60,9 +60,9 @@ typename SA_POP::ListMultiMap<L,T>::size_type SA_POP::ListMultiMap<L,T>::erase(c
//Removal all list items with matching key in the pair
- for(SA_POP::ListMultiMap<L,T>::list_iterator l_iter = list_.begin(); l_iter != list_.end();)
+ for(typename SA_POP::ListMultiMap<L,T>::list_iterator l_iter = list_.begin(); l_iter != list_.end();)
{
- SA_POP::ListMultiMap<L,T>::list_iterator prev_iter = l_iter;
+ typename SA_POP::ListMultiMap<L,T>::list_iterator prev_iter = l_iter;
l_iter++;
if((*prev_iter).first == key)
{
@@ -82,9 +82,9 @@ void SA_POP::ListMultiMap<L,T>::erase(typename SA_POP::ListMultiMap<L,T>::iterat
//Removal first or last list items with matching key in the pair
if(remove_dir_ == SA_POP::FRONT)
{
- for(SA_POP::ListMultiMap<L,T>::list_iterator l_iter = list_.begin(); l_iter != list_.end();)
+ for(typename SA_POP::ListMultiMap<L,T>::list_iterator l_iter = list_.begin(); l_iter != list_.end();)
{
- SA_POP::ListMultiMap<L,T>::list_iterator prev_iter = l_iter;
+ typename SA_POP::ListMultiMap<L,T>::list_iterator prev_iter = l_iter;
l_iter++;
if((*prev_iter).first == _Where->first && (*prev_iter).second == _Where->second )
{
@@ -95,8 +95,8 @@ void SA_POP::ListMultiMap<L,T>::erase(typename SA_POP::ListMultiMap<L,T>::iterat
}
else if(remove_dir_ == SA_POP::BACK)
{
- SA_POP::ListMultiMap<L,T>::list_iterator last_iter = list_.end();
- for(SA_POP::ListMultiMap<L,T>::list_iterator l_iter = list_.begin(); l_iter != list_.end();l_iter++)
+ typename SA_POP::ListMultiMap<L,T>::list_iterator last_iter = list_.end();
+ for(typename SA_POP::ListMultiMap<L,T>::list_iterator l_iter = list_.begin(); l_iter != list_.end();l_iter++)
{
if((*l_iter).first == _Where->first && (*l_iter).second == _Where->second)
{
@@ -127,9 +127,9 @@ void SA_POP::ListMultiMap<L,T>::erase(typename SA_POP::ListMultiMap<L,T>::iterat
//iterate through the range [_First, _Last) and erasing each iterator in turn
if(_First != this->end())
{
- for(SA_POP::ListMultiMap<L,T>::iterator m_iter = _First; m_iter != _Last;)
+ for(typename SA_POP::ListMultiMap<L,T>::iterator m_iter = _First; m_iter != _Last;)
{
- SA_POP::ListMultiMap<L,T>::iterator prev_iter = m_iter;
+ typename SA_POP::ListMultiMap<L,T>::iterator prev_iter = m_iter;
m_iter++;
this->erase(prev_iter);
}
@@ -266,9 +266,9 @@ typename SA_POP::ListMultiMap<L,T>::list_iterator SA_POP::ListMultiMap<L,T>::era
if(_Where != list_.end())
{
- for (std::multimap<L, T>::iterator m_iter = multimap_.lower_bound ((*_Where).first);m_iter != multimap_.upper_bound ((*_Where).first);)
+ for (typename std::multimap<L, T>::iterator m_iter = multimap_.lower_bound ((*_Where).first);m_iter != multimap_.upper_bound ((*_Where).first);)
{
- std::multimap<L, T>::iterator prev_iter = m_iter;
+ typename std::multimap<L, T>::iterator prev_iter = m_iter;
m_iter++;
if(prev_iter->second == (*_Where).second)
@@ -344,7 +344,7 @@ template<typename L, typename T>
void SA_POP::ListMultiMap<L,T>::pop_back()
{
//This will erase the back item in both list and multimap.
- SA_POP::ListMultiMap<L,T>::list_iterator l_iter= -- this->list_.end();
+ typename SA_POP::ListMultiMap<L,T>::list_iterator l_iter= -- this->list_.end();
this->erase(l_iter);
};
diff --git a/SA_POP/SA_POP_Utils.h b/SA_POP/SA_POP_Utils.h
index 95476087956..95973e0b548 100644
--- a/SA_POP/SA_POP_Utils.h
+++ b/SA_POP/SA_POP_Utils.h
@@ -41,7 +41,10 @@ namespace SA_POP {
typedef typename _multimap::key_type key_type;
typedef typename _multimap::mapped_type mapped_type;
+#ifdef _MSC_VER
typedef typename _multimap::referent_type referent_type; // retained
+#else
+#endif
typedef typename _multimap::key_compare key_compare;
typedef typename _multimap::value_compare value_compare;
@@ -58,9 +61,15 @@ namespace SA_POP {
typedef typename _multimap::const_reverse_iterator
const_reverse_iterator;
typedef typename _multimap::value_type value_type;
+
+#ifdef _MSC_VER
typedef typename _multimap::_Pairib _Pairib;
typedef typename _multimap::_Pairii _Pairii;
- typedef typename _multimap::_Paircc _Paircc;
+ typedef typename _multimap::_Paircc _Paircc;
+#else
+ typedef typename std::pair< typename _multimap::iterator, typename _multimap::iterator > _Pairii;
+ typedef typename std::pair< typename _multimap::const_iterator, typename _multimap::const_iterator > _Paircc;
+#endif
///TypeDefs for the List
@@ -127,7 +136,7 @@ namespace SA_POP {
///Clear
void clear();
-
+
///Equal Range
_Pairii equal_range(const key_type& _Keyval);
_Paircc equal_range(const key_type& _Keyval) const;
@@ -174,4 +183,4 @@ namespace SA_POP {
#include "SA_POP_Utils.cpp"
-#endif /* SA_POP_UTILS_H_ */ \ No newline at end of file
+#endif /* SA_POP_UTILS_H_ */
diff --git a/SA_POP/SA_PlanHeuristics.cpp b/SA_POP/SA_PlanHeuristics.cpp
index 3fdfc2fc3db..88bd07bee3a 100644
--- a/SA_POP/SA_PlanHeuristics.cpp
+++ b/SA_POP/SA_PlanHeuristics.cpp
@@ -98,7 +98,7 @@ Condition SA_CondStrategy::choose_cond_suspension_most_constrained (const OpenCo
return iter->first;
}
- std::map<int, std::pair<Condition, TaskInstID>> by_num_satisfying;
+ std::map<int, std::pair<Condition, TaskInstID> > by_num_satisfying;
for(OpenCondMap::const_iterator iter = open_conds.begin();
iter != open_conds.end(); iter++){
@@ -106,12 +106,12 @@ Condition SA_CondStrategy::choose_cond_suspension_most_constrained (const OpenCo
int num_sat = this->planner_->get_satisfying_tasks(iter->first).size();
- by_num_satisfying.insert(std::pair<int, std::pair<Condition, TaskInstID>>(num_sat, *iter));
+ by_num_satisfying.insert(std::pair<int, std::pair<Condition, TaskInstID> >(num_sat, *iter));
}
SA_WorkingPlan* working_plan = (SA_WorkingPlan*)this->planner_->get_working_plan();
- for(std::map<int, std::pair<Condition, TaskInstID>>::iterator it = by_num_satisfying.begin(); it != by_num_satisfying.end(); it++){
+ for(std::map<int, std::pair<Condition, TaskInstID> >::iterator it = by_num_satisfying.begin(); it != by_num_satisfying.end(); it++){
if(!working_plan->condition_in_suspended(it->second.first, it->second.second)){
diff --git a/SA_POP/SA_PlanStrategy.cpp b/SA_POP/SA_PlanStrategy.cpp
index bd2de962fcd..6f3fe552835 100644
--- a/SA_POP/SA_PlanStrategy.cpp
+++ b/SA_POP/SA_PlanStrategy.cpp
@@ -201,8 +201,12 @@ bool SA_PlanStrategy::satisfy_open_conds (void)
}
//Do not execute if the condition has been noted before and not helped
- std::pair<bool, CommandID> return_data = this->store_map.should_continue(add_task_cmd->get_id(), add_task_cmd->get_condition(),
- stored_task, this->open_conds_, this->planner_->get_working_plan()->get_task_insts());
+ std::pair<bool, CommandID> return_data =
+ this->store_map.should_continue(add_task_cmd->get_id(),
+ add_task_cmd->get_condition(),
+ stored_task,
+ this->open_conds_,
+ this->planner_->get_working_plan()->get_task_insts());
if(return_data.first)
{
diff --git a/SA_POP/SA_WorkingPlan.cpp b/SA_POP/SA_WorkingPlan.cpp
index b619a1e6d0f..540f09d03d5 100644
--- a/SA_POP/SA_WorkingPlan.cpp
+++ b/SA_POP/SA_WorkingPlan.cpp
@@ -761,7 +761,7 @@ void SA_WorkingPlan::unsuspend_listeners_aux(CausalLink link, TaskInstID excepti
void SA_WorkingPlan::suspend_condition(Condition cond, TaskInstID required_by, CausalLink suspended_by){
std::pair<Condition, TaskInstID> require_set (cond, required_by);
- std::pair<CausalLink, std::pair<Condition, TaskInstID>> to_insert (suspended_by, require_set);
+ std::pair<CausalLink, std::pair<Condition, TaskInstID> > to_insert (suspended_by, require_set);
this->suspended_listener_map.insert(to_insert);
this->suspended_conditions.insert(require_set);
@@ -770,9 +770,9 @@ void SA_WorkingPlan::suspend_condition(Condition cond, TaskInstID required_by, C
//Note that a condition should be removed from the suspend map
void SA_WorkingPlan::resume_condition(Condition cond, TaskInstID required_by, CausalLink suspended_by){
std::pair<Condition, TaskInstID> require_set (cond, required_by);
- std::pair<CausalLink, std::pair<Condition, TaskInstID>> to_insert (suspended_by, require_set);
+ std::pair<CausalLink, std::pair<Condition, TaskInstID> > to_insert (suspended_by, require_set);
- std::multimap<CausalLink, std::pair<Condition, TaskInstID>> ::iterator it;
+ std::multimap<CausalLink, std::pair<Condition, TaskInstID> > ::iterator it;
for(it = suspended_listener_map.lower_bound(suspended_by);
it != suspended_listener_map.upper_bound(suspended_by); it++){
diff --git a/SA_POP/SA_WorkingPlan.h b/SA_POP/SA_WorkingPlan.h
index a5b0a6c20bd..ed7c766386c 100644
--- a/SA_POP/SA_WorkingPlan.h
+++ b/SA_POP/SA_WorkingPlan.h
@@ -332,7 +332,7 @@ namespace SA_POP {
virtual void generate_all_threats(void);
- virtual InstToTaskMap get_task_insts(void){return task_insts_;};
+ virtual InstToTaskMap & get_task_insts(void){return task_insts_;};
virtual bool inst_has_impl(TaskInstID inst_id);
diff --git a/SA_POP/WorkingPlan.h b/SA_POP/WorkingPlan.h
index 31f19c14a27..1e10a977a11 100644
--- a/SA_POP/WorkingPlan.h
+++ b/SA_POP/WorkingPlan.h
@@ -196,7 +196,7 @@ namespace SA_POP {
virtual void generate_all_threats(void) = 0;
- virtual InstToTaskMap get_task_insts(void) = 0;
+ virtual InstToTaskMap & get_task_insts(void) = 0;
protected:
/// Pointer to Planner object.