does not commit yet, but getting close
authorArthur Wolf <wolf.arthur@gmail.com>
Wed, 6 Mar 2013 22:25:21 +0000 (23:25 +0100)
committerArthur Wolf <wolf.arthur@gmail.com>
Wed, 6 Mar 2013 22:25:21 +0000 (23:25 +0100)
src/modules/communication/utils/Gcode.cpp
src/modules/communication/utils/Gcode.h
src/modules/robot/Robot.cpp

index 949370c..679c693 100644 (file)
@@ -20,6 +20,32 @@ Gcode::Gcode(const string& command, StreamOutput* stream) : command(command), m(
     this->millimeters_of_travel = 0L;
 }
 
+Gcode::Gcode(const Gcode& to_copy){
+    this->command.assign( to_copy.command );
+    this->millimeters_of_travel = to_copy.millimeters_of_travel;
+    this->has_m                 = to_copy.has_m;
+    this->has_g                 = to_copy.has_g;
+    this->m                     = to_copy.m;
+    this->g                     = to_copy.g;
+    this->add_nl                = to_copy.add_nl;
+    this->stream                = to_copy.stream;
+}
+
+Gcode& Gcode::operator= (const Gcode& to_copy){
+    if( this != &to_copy ){
+        this->command.assign( to_copy.command );
+        this->millimeters_of_travel = to_copy.millimeters_of_travel;
+        this->has_m                 = to_copy.has_m;
+        this->has_g                 = to_copy.has_g;
+        this->m                     = to_copy.m;
+        this->g                     = to_copy.g;
+        this->add_nl                = to_copy.add_nl;
+        this->stream                = to_copy.stream;
+    }
+    return *this;
+}
+
+
 // Whether or not a Gcode has a letter
 bool Gcode::has_letter( char letter ){
     //return ( this->command->find( letter ) != string::npos );
index 3d3d4d0..a9112b5 100644 (file)
@@ -17,7 +17,9 @@ using std::string;
 class Gcode {
     public:
         Gcode(const string&, StreamOutput*);
-
+        Gcode(const Gcode& to_copy); 
+        Gcode& operator= (const Gcode& to_copy);
+        
         bool   has_letter ( char letter );
 
         double get_value  ( char letter );
@@ -30,8 +32,6 @@ class Gcode {
 
         const string command;
         double millimeters_of_travel;
-        bool call_on_gcode_execute_event_immediatly;
-        bool on_gcode_execute_event_called;
 
         bool has_m;
         bool has_g;
index 026332f..d46a998 100644 (file)
@@ -266,11 +266,6 @@ void Robot::append_line(Gcode* gcode, double target[], double rate ){
 
     gcode->millimeters_of_travel = sqrt( pow( target[X_AXIS]-this->current_position[X_AXIS], 2 ) +  pow( target[Y_AXIS]-this->current_position[Y_AXIS], 2 ) +  pow( target[Z_AXIS]-this->current_position[Z_AXIS], 2 ) );
 
-    //if( gcode->call_on_gcode_execute_event_immediatly == true ){
-            //printf("GCODE B: %s \r\n", gcode->command.c_str() );
-    //        this->kernel->call_event(ON_GCODE_EXECUTE, gcode );
-    //        gcode->on_gcode_execute_event_called = true;
-    //}
     this->distance_in_gcode_is_known( gcode );
 
 
@@ -328,12 +323,6 @@ void Robot::append_arc(Gcode* gcode, double target[], double offset[], double ra
 
     gcode->millimeters_of_travel = hypot(angular_travel*radius, fabs(linear_travel));
 
-    //if( gcode->call_on_gcode_execute_event_immediatly == true ){
-            //printf("GCODE C: %s \r\n", gcode->command.c_str() );
-    //        this->kernel->call_event(ON_GCODE_EXECUTE, gcode );
-    //        gcode->on_gcode_execute_event_called = true;
-    //}
-
     this->distance_in_gcode_is_known( gcode );
     
     /*