jar ming / Mbed 2 deprecated Gcodetest1

Dependencies:   mbed

Committer:
jarming
Date:
Wed May 14 10:34:11 2014 +0000
Revision:
0:1d67da0805fd
jhgjhgjkgkljgi

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jarming 0:1d67da0805fd 1 #include"Gcode.h"
jarming 0:1d67da0805fd 2 #include <string>
jarming 0:1d67da0805fd 3 using std::string;
jarming 0:1d67da0805fd 4 #include"mbed.h"
jarming 0:1d67da0805fd 5 Gcode::Gcode(const string& command, Serial* stream):command(command),m(0),g(0),stream(stream),add_nl(false)
jarming 0:1d67da0805fd 6 {
jarming 0:1d67da0805fd 7 prepare_cached_values();
jarming 0:1d67da0805fd 8 this->millimeters_of_travel = 0.0F;
jarming 0:1d67da0805fd 9 this->accepted_by_module = false;
jarming 0:1d67da0805fd 10 }
jarming 0:1d67da0805fd 11
jarming 0:1d67da0805fd 12 Gcode::Gcode(const Gcode& to_copy)
jarming 0:1d67da0805fd 13 {
jarming 0:1d67da0805fd 14
jarming 0:1d67da0805fd 15 this->command.assign( to_copy.command );
jarming 0:1d67da0805fd 16 this->millimeters_of_travel = to_copy.millimeters_of_travel;
jarming 0:1d67da0805fd 17 this->has_m = to_copy.has_m;
jarming 0:1d67da0805fd 18 this->has_g = to_copy.has_g;
jarming 0:1d67da0805fd 19 this->m = to_copy.m;
jarming 0:1d67da0805fd 20 this->g = to_copy.g;
jarming 0:1d67da0805fd 21 this->add_nl = to_copy.add_nl;
jarming 0:1d67da0805fd 22 this->stream = to_copy.stream;
jarming 0:1d67da0805fd 23 this->accepted_by_module=false;
jarming 0:1d67da0805fd 24 this->txt_after_ok.assign( to_copy.txt_after_ok );
jarming 0:1d67da0805fd 25
jarming 0:1d67da0805fd 26 }
jarming 0:1d67da0805fd 27
jarming 0:1d67da0805fd 28 Gcode& Gcode::operator=(const Gcode& to_copy)
jarming 0:1d67da0805fd 29 {
jarming 0:1d67da0805fd 30 if(this != &to_copy)
jarming 0:1d67da0805fd 31 {
jarming 0:1d67da0805fd 32 this->command.assign( to_copy.command );
jarming 0:1d67da0805fd 33 this->millimeters_of_travel = to_copy.millimeters_of_travel;
jarming 0:1d67da0805fd 34 this->has_m = to_copy.has_m;
jarming 0:1d67da0805fd 35 this->has_g = to_copy.has_g;
jarming 0:1d67da0805fd 36 this->m = to_copy.m;
jarming 0:1d67da0805fd 37 this->g = to_copy.g;
jarming 0:1d67da0805fd 38 this->add_nl = to_copy.add_nl;
jarming 0:1d67da0805fd 39 this->stream = to_copy.stream;
jarming 0:1d67da0805fd 40 this->txt_after_ok.assign( to_copy.txt_after_ok );
jarming 0:1d67da0805fd 41 }
jarming 0:1d67da0805fd 42 this->accepted_by_module = false;
jarming 0:1d67da0805fd 43 return *this;
jarming 0:1d67da0805fd 44 }
jarming 0:1d67da0805fd 45
jarming 0:1d67da0805fd 46
jarming 0:1d67da0805fd 47
jarming 0:1d67da0805fd 48 bool Gcode::has_letter(char letter)
jarming 0:1d67da0805fd 49 {
jarming 0:1d67da0805fd 50 for(std::string::iterator c = this->command.begin(); c != this->command.end(); c++) //iterator const_iterator not support why?
jarming 0:1d67da0805fd 51 {
jarming 0:1d67da0805fd 52 if(*c == letter)
jarming 0:1d67da0805fd 53 {
jarming 0:1d67da0805fd 54 return true;
jarming 0:1d67da0805fd 55 }
jarming 0:1d67da0805fd 56 }
jarming 0:1d67da0805fd 57
jarming 0:1d67da0805fd 58 return false;
jarming 0:1d67da0805fd 59 }
jarming 0:1d67da0805fd 60
jarming 0:1d67da0805fd 61 //
jarming 0:1d67da0805fd 62 float Gcode::get_float(char letter)
jarming 0:1d67da0805fd 63 {
jarming 0:1d67da0805fd 64
jarming 0:1d67da0805fd 65
jarming 0:1d67da0805fd 66 }
jarming 0:1d67da0805fd 67 void Gcode::prepare_cached_values(){
jarming 0:1d67da0805fd 68
jarming 0:1d67da0805fd 69
jarming 0:1d67da0805fd 70 }