From: Thomas Pietrzak Date: Wed, 3 Aug 2011 18:23:21 +0000 (+0000) Subject: const parameter in contructors X-Git-Url: https://git.thomaspietrzak.com/?a=commitdiff_plain;h=1cf527cefc2eeeb1b2fc4aa5e4b15d596c5e9d4d;p=tactonlibrary.git const parameter in contructors git-svn-id: svn+ssh://thomaspietrzak.com/var/svn/rep@40 47cf9a05-e0a8-4ed5-9e9b-101a649bc004 --- diff --git a/TactonPlayer/Serial.cpp b/TactonPlayer/Serial.cpp index e527263..6474450 100644 --- a/TactonPlayer/Serial.cpp +++ b/TactonPlayer/Serial.cpp @@ -1,6 +1,6 @@ #include "Serial.hpp" -Serial::Serial(char *) +Serial::Serial(const char *) :_connected(false) { } diff --git a/TactonPlayer/Serial.hpp b/TactonPlayer/Serial.hpp index f306af7..4ee686d 100644 --- a/TactonPlayer/Serial.hpp +++ b/TactonPlayer/Serial.hpp @@ -7,7 +7,7 @@ class Serial { public: //Initialize Serial communication with the given COM port - Serial(char *portName); + Serial(const char *portName); //Close the connection //NOTA: for some reason you can't connect again before exiting diff --git a/TactonPlayer/SerialWindows.cpp b/TactonPlayer/SerialWindows.cpp index 38806ef..251f9bd 100644 --- a/TactonPlayer/SerialWindows.cpp +++ b/TactonPlayer/SerialWindows.cpp @@ -7,7 +7,7 @@ using namespace std; #include #endif -SerialWindows::SerialWindows(char *portName) +SerialWindows::SerialWindows(const char *portName) :Serial(portName) { //Try to connect to the given port throuh CreateFile diff --git a/TactonPlayer/SerialWindows.hpp b/TactonPlayer/SerialWindows.hpp index 28eb1af..a7e5c16 100644 --- a/TactonPlayer/SerialWindows.hpp +++ b/TactonPlayer/SerialWindows.hpp @@ -9,7 +9,7 @@ class SerialWindows : public Serial { public: //Initialize Serial communication with the given COM port - SerialWindows(char *portName); + SerialWindows(const char *portName); //Close the connection //NOTA: for some reason you can't connect again before exiting //the program and running it again diff --git a/TactonPlayer/TactonPlayer.cpp b/TactonPlayer/TactonPlayer.cpp index b739d6e..3e8fa2c 100644 --- a/TactonPlayer/TactonPlayer.cpp +++ b/TactonPlayer/TactonPlayer.cpp @@ -4,7 +4,7 @@ #include -TactonPlayer::TactonPlayer(char *port) +TactonPlayer::TactonPlayer(const char *port) :_comport(new SerialWindows(port)) { } diff --git a/TactonPlayer/TactonPlayer.hpp b/TactonPlayer/TactonPlayer.hpp index 49621a7..bb77e14 100644 --- a/TactonPlayer/TactonPlayer.hpp +++ b/TactonPlayer/TactonPlayer.hpp @@ -5,7 +5,7 @@ class TactonPlayer { public: - __declspec(dllexport) TactonPlayer(char *port = "COM5"); + __declspec(dllexport) TactonPlayer(const char *port = "COM5"); __declspec(dllexport) ~TactonPlayer(); //set the timestamp to 0, and watch for scheduled tactons