|
From: <gb...@us...> - 2010-08-04 04:48:07
|
Revision: 504
http://gearbox.svn.sourceforge.net/gearbox/?rev=504&view=rev
Author: gbiggs
Date: 2010-08-04 04:48:00 +0000 (Wed, 04 Aug 2010)
Log Message:
-----------
Fixed linker errors
Modified Paths:
--------------
gearbox/trunk/src/hokuyo_aist/CMakeLists.txt
gearbox/trunk/src/hokuyo_aist/sensor.cpp
gearbox/trunk/src/hokuyo_aist/utils.h
Removed Paths:
-------------
gearbox/trunk/src/hokuyo_aist/utils.cpp
Modified: gearbox/trunk/src/hokuyo_aist/CMakeLists.txt
===================================================================
--- gearbox/trunk/src/hokuyo_aist/CMakeLists.txt 2010-08-04 04:25:13 UTC (rev 503)
+++ gearbox/trunk/src/hokuyo_aist/CMakeLists.txt 2010-08-04 04:48:00 UTC (rev 504)
@@ -21,8 +21,7 @@
set (srcs hokuyo_errors.cpp
sensor_info.cpp
scan_data.cpp
- sensor.cpp
- utils.cpp)
+ sensor.cpp)
if (WIN32)
if (GBX_DEFAULT_LIB_TYPE STREQUAL SHARED)
Modified: gearbox/trunk/src/hokuyo_aist/sensor.cpp
===================================================================
--- gearbox/trunk/src/hokuyo_aist/sensor.cpp 2010-08-04 04:25:13 UTC (rev 503)
+++ gearbox/trunk/src/hokuyo_aist/sensor.cpp 2010-08-04 04:48:00 UTC (rev 504)
@@ -36,8 +36,6 @@
#include <sstream>
#include <iostream>
-using namespace flexiport;
-
#if defined(WIN32)
#define __func__ __FUNCTION__
#endif
@@ -171,6 +169,55 @@
*/
///////////////////////////////////////////////////////////////////////////////
+// Utility functions
+///////////////////////////////////////////////////////////////////////////////
+
+unsigned int decode_2_byte_value(char *data)
+{
+ unsigned int byte1, byte2;
+
+ byte1 = data[0] - 0x30;
+ byte2 = data[1] - 0x30;
+
+ return (byte1 << 6) + (byte2);
+}
+
+unsigned int decode_3_byte_value(char *data)
+{
+ unsigned int byte1, byte2, byte3;
+
+ byte1 = data[0] - 0x30;
+ byte2 = data[1] - 0x30;
+ byte3 = data[2] - 0x30;
+
+ return (byte1 << 12) + (byte2 << 6) + (byte3);
+}
+
+unsigned int decode_4_byte_value(char *data)
+{
+ unsigned int byte1, byte2, byte3, byte4;
+
+ byte1 = data[0] - 0x30;
+ byte2 = data[1] - 0x30;
+ byte3 = data[2] - 0x30;
+ byte4 = data[3] - 0x30;
+
+ return (byte1 << 18) + (byte2 << 12) + (byte3 << 6) + (byte4);
+}
+
+void number_to_string(unsigned int num, char *dest, int length)
+{
+#if defined(WIN32)
+ _snprintf(dest, length + 1, "%*d", length, num);
+#else
+ snprintf(dest, length + 1, "%*d", length, num);
+#endif
+ // Replace all leading spaces with '0'
+ for (int ii = 0; ii < length && dest[ii] == ' '; ii++)
+ dest[ii] = '0';
+}
+
+///////////////////////////////////////////////////////////////////////////////
// Sensor class
///////////////////////////////////////////////////////////////////////////////
@@ -268,7 +315,7 @@
const unsigned int numBauds = 5;
for (unsigned int ii = 0; ii < numBauds; ii++)
{
- reinterpret_cast<SerialPort*>(_port)->SetBaudRate(bauds[ii]);
+ reinterpret_cast<flexiport::SerialPort*>(_port)->SetBaudRate(bauds[ii]);
try
{
_get_and_set_scip_version();
@@ -310,7 +357,7 @@
}
if (_port->GetPortType() == "serial")
- return reinterpret_cast<SerialPort*>(_port)->GetBaudRate();
+ return reinterpret_cast<flexiport::SerialPort*>(_port)->GetBaudRate();
else
return 0;
}
@@ -399,7 +446,7 @@
_send_command("S", newBaud, 13, NULL);
_skip_lines(1);
// Change the port's baud rate
- reinterpret_cast<SerialPort*>(_port)->SetBaudRate(baud);
+ reinterpret_cast<flexiport::SerialPort*>(_port)->SetBaudRate(baud);
}
else if (_scip_version == 2)
{
@@ -407,7 +454,7 @@
_send_command("SS", newBaud, 6, "03");
_skip_lines(1);
// Change the port's baud rate
- reinterpret_cast<SerialPort*>(_port)->SetBaudRate(baud);
+ reinterpret_cast<flexiport::SerialPort*>(_port)->SetBaudRate(baud);
}
else
throw UnknownScipVersionError();
Deleted: gearbox/trunk/src/hokuyo_aist/utils.cpp
===================================================================
--- gearbox/trunk/src/hokuyo_aist/utils.cpp 2010-08-04 04:25:13 UTC (rev 503)
+++ gearbox/trunk/src/hokuyo_aist/utils.cpp 2010-08-04 04:48:00 UTC (rev 504)
@@ -1,70 +0,0 @@
-/*
- * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
- * http://gearbox.sf.net/
- * Copyright (c) 2008 Geoffrey Biggs
- *
- * hokuyo_aist Hokuyo laser scanner driver.
- *
- * This distribution is licensed to you under the terms described in the
- * LICENSE file included in this distribution.
- *
- * This work is a product of the National Institute of Advanced Industrial
- * Science and Technology, Japan. Registration number: H22PRO-1086.
- *
- * This file is part of hokuyo_aist.
- *
- * This software is licensed under the Eclipse Public License -v 1.0 (EPL). See
- * http://www.opensource.org/licenses/eclipse-1.0.txt
- */
-
-#include "utils.h"
-
-#include <cstdio>
-
-using namespace hokuyo_aist;
-
-unsigned int decode_2_byte_value(char *data)
-{
- unsigned int byte1, byte2;
-
- byte1 = data[0] - 0x30;
- byte2 = data[1] - 0x30;
-
- return (byte1 << 6) + (byte2);
-}
-
-unsigned int decode_3_byte_value(char *data)
-{
- unsigned int byte1, byte2, byte3;
-
- byte1 = data[0] - 0x30;
- byte2 = data[1] - 0x30;
- byte3 = data[2] - 0x30;
-
- return (byte1 << 12) + (byte2 << 6) + (byte3);
-}
-
-unsigned int decode_4_byte_value(char *data)
-{
- unsigned int byte1, byte2, byte3, byte4;
-
- byte1 = data[0] - 0x30;
- byte2 = data[1] - 0x30;
- byte3 = data[2] - 0x30;
- byte4 = data[3] - 0x30;
-
- return (byte1 << 18) + (byte2 << 12) + (byte3 << 6) + (byte4);
-}
-
-void number_to_string(unsigned int num, char *dest, int length)
-{
-#if defined(WIN32)
- _snprintf(dest, length + 1, "%*d", length, num);
-#else
- snprintf(dest, length + 1, "%*d", length, num);
-#endif
- // Replace all leading spaces with '0'
- for (int ii = 0; ii < length && dest[ii] == ' '; ii++)
- dest[ii] = '0';
-}
-
Modified: gearbox/trunk/src/hokuyo_aist/utils.h
===================================================================
--- gearbox/trunk/src/hokuyo_aist/utils.h 2010-08-04 04:25:13 UTC (rev 503)
+++ gearbox/trunk/src/hokuyo_aist/utils.h 2010-08-04 04:48:00 UTC (rev 504)
@@ -63,15 +63,6 @@
}
#endif
-/// Decode a 2 byte encoded value
-unsigned int decode_2_byte_value(char *data);
-/// Decode a 3 byte encoded value
-unsigned int decode_3_byte_value(char *data);
-/// Decode a 4 byte encoded value
-unsigned int decode_4_byte_value(char *data);
-/// Convert a number to a string
-void number_to_string(unsigned int num, char *dest, int length);
-
} // namespace hokuyo_aist
/** @} */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|