Index: source/ariba/Name.cpp
===================================================================
--- source/ariba/Name.cpp	(revision 2436)
+++ source/ariba/Name.cpp	(revision 2437)
@@ -39,10 +39,129 @@
 #include "Name.h"
 
-namespace ariba {
-const Name Name::UNSPECIFIED;
-}
-
 std::ostream& operator<<( std::ostream& s, const ariba::Name& n ) {
 	return s << n.toString();
 }
 
+namespace ariba {
+
+const Name Name::UNSPECIFIED;
+
+void Name::init(const char* name, int len, bool copy, bool hreadable) {
+
+	// delete the old buffer
+	if( _bytes != NULL ) {
+		delete[] _bytes;
+		_bytes = NULL;
+		_length = 0;
+	}
+
+	// alloc new stuff
+	if (len == -1)
+		len = strlen(name);
+
+	if (copy) {
+
+		if ((name!=NULL) && (len>0)){
+			_bytes = new uint8_t[len];
+			memcpy( _bytes, name, len );
+		} else {
+			len = 0;
+			_bytes = NULL;	
+		}
+
+	} else {
+		_bytes = (uint8_t*)name;
+	}
+
+	_copy = copy;
+	_length = len;
+	_hreadable = hreadable;
+}
+
+Name::Name() 
+	: _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
+}
+
+Name::Name(const char* name, int len, bool copy) 
+	: _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
+	init(name, len, copy, len == -1);
+}
+
+Name::Name(string name) 
+	: _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
+	init(name.c_str(), name.length(), true, true);
+}
+
+Name::Name(const Name& name) 
+	: _bytes( NULL ), _length( 0 ), _copy( false ), _hreadable( false) {
+	init((const char*)name.bytes(), name.length(), true, name._hreadable);
+}
+
+Name::~Name() {
+	if (_copy && (_bytes!=NULL)){
+		delete[] _bytes;
+		_bytes = NULL;
+		_length = 0;
+	}
+}
+
+const uint8_t* Name::bytes() const {
+	return _bytes;
+}
+
+const size_t Name::length() const {
+	return _length;
+}
+
+bool Name::operator==(const Name& name) const {
+
+	// unspecified Name objects
+	if (_bytes == NULL && name._bytes == NULL &&
+		length() == name.length()) return true;
+	
+	// specified name objects
+	if (_bytes == NULL || name._bytes == NULL) return false;
+	if (name.length() != length()) return false;
+	return (memcmp(name.bytes(), bytes(), length()) == 0);
+}
+
+bool Name::operator!=(const Name& name) const {
+	return !(*this == name);
+}
+
+bool Name::isUnspecified() const {
+	return *this == UNSPECIFIED;
+}
+
+Name Name::random() {
+	char name[17];
+	for (int i=0;i<16; i++)
+		name[i] = ("abcdefghijklmnopqrstuvwxyz")[((unsigned)rand())%26];
+	name[16] = 0;
+
+	// force use of the std::string ctor with this
+	return Name( string(name) );
+}
+
+string Name::toString() const {
+	if (_hreadable) {
+		char str[256];
+		for (int i=0; i<length(); i++) str[i] = bytes()[i];
+		str[length()] = 0;
+		return string(str);
+	} else {
+		return string("<not readable>");
+	}
+}
+
+NodeID Name::toNodeId() const {
+	if( bytes()==NULL || length()==0 ) return NodeID::UNSPECIFIED;
+	return NodeID( Identifier::sha1(bytes(),length()) );
+}
+
+SpoVNetID Name::toSpoVNetId() const {
+	if( bytes()==NULL || length()==0 ) return SpoVNetID::UNSPECIFIED;
+	return SpoVNetID( Identifier::sha1(bytes(),length()) );
+}
+
+} // namespace ariba
Index: source/ariba/Name.h
===================================================================
--- source/ariba/Name.h	(revision 2436)
+++ source/ariba/Name.h	(revision 2437)
@@ -42,4 +42,7 @@
 #include <iostream>
 #include <memory.h>
+#include <string>
+
+using std::string;
 
 // forward declaration
@@ -60,40 +63,11 @@
 class Name {
 	friend std::ostream& operator<<( std::ostream&, const ::ariba::Name& );
-
-private:
-	bool _hreadable;
-	bool _copy;
-	int _length;
-	uint8_t* _bytes;
-
-	inline void init(const char* name, int len, bool copy, bool hreadable) {
-		if (len == -1)
-			len = strlen(name);
-
-		if (copy) {
-			_bytes = new uint8_t[len];
-			memcpy(_bytes, name, len);
-		} else {
-			_bytes = (uint8_t*)name;
-		}
-
-		_copy = copy;
-		_length = len;
-		_hreadable = hreadable;
-	}
-
 public:
 	static const Name UNSPECIFIED;
 
-public:
 	/**
 	 * Constructs a new, yet unspecified name.
 	 */
-	inline Name() {
-		_bytes = NULL;
-		_length = 0;
-		_copy = false;
-		_hreadable = false;
-	}
+	Name();
 
 	/**
@@ -105,7 +79,5 @@
 	 * @param copy A flag, whether the name's memory needs to be copied
 	 */
-	inline Name(const char* name, int len = -1, bool copy = false) {
-		init(name, len, copy, len == -1);
-	}
+	Name(const char* name, int len = -1, bool copy = false);
 
 	/**
@@ -114,21 +86,15 @@
 	 * @param name A human readable name
 	 */
-	inline Name(std::string name) {
-		init(name.c_str(), -1, true, true);
-	}
+	Name(string name);
 
 	/**
 	 * The copy constructor.
 	 */
-	inline Name(const Name& name) {
-		init((const char*)name.bytes(), name.length(), true, name._hreadable);
-	}
+	Name(const Name& name);
 
 	/**
 	 * Destroys the name and releases underlying memory if this name is a copy.
 	 */
-	inline ~Name() {
-		if (_copy) delete _bytes;
-	}
+	virtual ~Name();
 
 	/**
@@ -137,7 +103,5 @@
 	 * @return The binary data
 	 */
-	inline const uint8_t* bytes() const {
-		return _bytes;
-	}
+	const uint8_t* bytes() const;
 
 	/**
@@ -146,65 +110,44 @@
 	 * @return The length of the name
 	 */
-	inline const size_t length() const {
-		return _length;
-	}
+	const size_t length() const;
 
 	/**
 	 * The common implementation of the "equal" operator.
 	 */
-	inline bool operator==(const Name& name) const {
-		if (_bytes == NULL || name._bytes == NULL) return false;
-		if (name.length() != length()) return false;
-		return (memcmp(name.bytes(), bytes(), length()) == 0);
-	}
+	bool operator==(const Name& name) const;
 
 	/**
 	 * The common implementation of the "unequal" operator.
 	 */
-	inline bool operator!=(const Name& name) const {
-		return !(*this == name);
-	}
+	bool operator!=(const Name& name) const;
 
 	/**
 	 * Returns true, if the name is yet unspecified
 	 */
-	inline bool isUnspecified() {
-		return *this == UNSPECIFIED;
-	}
+	bool isUnspecified() const;
 
 	/**
 	 * Returns a random name.
 	 */
-	inline static Name random() {
-		char name[17];
-		for (int i=0;i<16; i++)
-			name[i] = ("abcdefghijklmnopqrstuvwxyz")[((unsigned)rand())%26];
-		name[16] = 0;
-		return Name(name);
-	}
+	static Name random();
 
 	/**
 	 * Returns a human-readable representation of this name
 	 */
-	inline std::string toString() const {
-		if (_hreadable) {
-			char str[256];
-			for (int i=0; i<length(); i++) str[i] = bytes()[i];
-			str[length()] = 0;
-			return std::string(str);
-		} else {
-			return std::string("<not readable>");
-		}
-	}
+	string toString() const;
 
 	// hack: to be changed!
-	inline NodeID toNodeId() const {
-		return NodeID::sha1( bytes(), length() );
-	}
+	NodeID toNodeId() const;
 
 	// hack: to be changed!
-	inline SpoVNetID toSpoVNetId() const {
-		return SpoVNetID::sha1(bytes(), length() );
-	}
+	SpoVNetID toSpoVNetId() const;
+
+private:
+	bool _hreadable;
+	bool _copy;
+	int _length;
+	uint8_t* _bytes;
+
+	void init(const char* name, int len, bool copy, bool hreadable);
 };
 
