]> ruin.nu Git - germs.git/blobdiff - src/sortaction.h
toString for actions
[germs.git] / src / sortaction.h
index d1a3f7bca68e3fe5a11c94631f117123c10295fe..66c337ca625cac468b113debc86c1cd224029a76 100644 (file)
@@ -22,6 +22,7 @@
 #define __SORTACTION_H__
 
 #include <tr1/memory>
+#include <string>
 class GeneOrder;
 /**
  * Abstraction of a sort action, all child actions has to be immutable.
@@ -38,6 +39,15 @@ class SortAction{
                 */
                SortAction(SortAction* sa): _action(sa){
                }
+
+               SortAction(const SortAction& sa): _action(sa._action){
+               }
+
+               virtual const SortAction& operator=(const SortAction& sa){
+                       if (this != &sa)
+                               _action = sa._action;
+                       return *this;
+               }
                
                virtual ~SortAction(){};
 
@@ -54,6 +64,13 @@ class SortAction{
                virtual bool operator==(const SortAction& sa) const{
                        return (*_action) == (sa._action.get() == 0 ? sa : *sa._action);
                }
+               
+               /**
+                * Gives a string representation of the action, for output
+                */
+               virtual std::string toString() const{
+                       return _action->toString();
+               }
        private:
                ActionPointer _action;