Index: trunk/ab5.0/jenga/include/common/BoostSerializationSupport.h
===================================================================
--- trunk/ab5.0/jenga/include/common/BoostSerializationSupport.h	(revision 520)
+++ trunk/ab5.0/jenga/include/common/BoostSerializationSupport.h	(revision 520)
@@ -0,0 +1,47 @@
+#pragma once
+
+#include <vector>
+#include <string>
+#include <fstream>
+#include <sstream>
+
+#include <boost/serialization/serialization.hpp>
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/export.hpp>
+
+namespace Jenga{
+namespace Common{
+
+using namespace std;
+
+template<class T_xml_schema> class BoostSerializationSupport{
+	virtual const char *RootTagName() const = 0;
+
+	void echo( const char *msg ) const;
+
+public:
+	bool ReadXml( istream& ifs, bool isShowExceptionMessage = true );
+	bool WriteXml( ostream& ofs, bool isShowExceptionMessage = true ) const;
+	bool ReadXml( const std::string &xmlFilePath, bool isShowExceptionMessage = true );
+	bool WriteXml( const std::string &xmlFilePath, bool isShowExceptionMessage = true ) const;
+	bool ReadXmlString( const std::string &xmlString );
+	bool WriteXmlString( std::string &xmlString ) const;
+
+	bool ReadBinaryFile( const std::string &filePath, bool isShowExceptionMessage = true );
+	bool WriteBinaryFile( const std::string &filePath, bool isShowExceptionMessage = true ) const;
+	bool ReadBinaryString( const std::string &binaryString );
+	bool WriteBinaryString( std::string &binaryString ) const;
+
+/*
+ビルドに時間がかかるので外しておく
+	bool ReadText( const std::string &filePath, bool isShowExceptionMessage = true );
+	bool WriteText( const std::string &filePath, bool isShowExceptionMessage = true ) const;
+	bool ReadTextString( const std::string &textString );
+	bool WriteTextString( std::string &textString ) const;
+
+	bool ReadXmlFromString( const std::string &xmlBuffer );
+*/
+};
+
+
+}}
Index: trunk/ab5.0/jenga/include/common/Hashmap.h
===================================================================
--- trunk/ab5.0/jenga/include/common/Hashmap.h	(revision 520)
+++ trunk/ab5.0/jenga/include/common/Hashmap.h	(revision 520)
@@ -0,0 +1,236 @@
+#pragma once
+
+
+namespace Jenga{
+namespace Common{
+
+
+#define MAX_HASHMAP 65535
+template<class T> class Hashmap
+{
+	T* hashArray[MAX_HASHMAP];
+
+public:
+	virtual int GetHash( const char *keyName ) const
+	{
+		int key;
+		for(key=0;*keyName!='\0';keyName++){
+			key=((key<<8)+ *keyName )%MAX_HASHMAP;
+		}
+		return key;
+	}
+
+	Hashmap()
+		: isIteratorReady( false )
+	{
+		memset( hashArray, 0, MAX_HASHMAP*sizeof(T*) );
+	}
+	~Hashmap()
+	{
+		Clear();
+	}
+	void Clear()
+	{
+		for( int i=0; i<MAX_HASHMAP; i++ )
+		{
+			T* temp = hashArray[i];
+			if( temp )
+			{
+				delete temp;
+			}
+		}
+		memset( hashArray, 0, MAX_HASHMAP*sizeof(T*) );
+	}
+
+	// 内容を破棄せずにすべて抜き取る
+	void PullOutAll()
+	{
+		memset( hashArray, 0, MAX_HASHMAP*sizeof(T*) );
+	}
+
+	bool Put( T* value )
+	{
+		int key = GetHash( value->GetKeyName().c_str() );
+
+		if(hashArray[key]){
+			T *temp = hashArray[key];
+			while( true ){
+				if( temp->IsDuplication( value ) )
+				{
+					// 重複している
+					return false;
+				}
+
+				if( temp->GetChainNext() == NULL )
+				{
+					break;
+				}
+				temp = temp->GetChainNext();
+			}
+			temp->SetChainNext( value );
+		}
+		else{
+			hashArray[key] = value;
+		}
+
+		return true;
+	}
+
+	T* GetHashArrayElement( const char *keyName )
+	{
+		return hashArray[GetHash(keyName)];
+	}
+	const T* GetHashArrayElement( const char *keyName ) const
+	{
+		return hashArray[GetHash(keyName)];
+	}
+
+	bool IsExist( const std::string &keyName ) const
+	{
+		int key = GetHash( keyName.c_str() );
+
+		if(hashArray[key]){
+			T *temp = hashArray[key];
+			while( true ){
+				if( temp->IsDuplication( keyName ) )
+				{
+					// 重複している
+					return true;
+				}
+
+				if( temp->GetChainNext() == NULL )
+				{
+					break;
+				}
+				temp = temp->GetChainNext();
+			}
+		}
+
+		return false;
+	}
+
+
+	/////////////////////////////////////////////////////////////////
+	// イテレータ
+	/////////////////////////////////////////////////////////////////
+private:
+	mutable std::vector<T*> iterator_Objects;
+	mutable int iterator_CurrentNext;
+	mutable bool isIteratorReady;
+public:
+	void Iterator_Init() const
+	{
+		iterator_Objects.clear();
+		iterator_CurrentNext = 0;
+
+		for( int i=0; i<MAX_HASHMAP; i++ ){
+			if( hashArray[i] ){
+				T* temp = hashArray[i];
+				while( temp )
+				{
+					iterator_Objects.push_back( temp );
+
+					temp = (T*)temp->GetChainNext();
+				}
+			}
+		}
+
+		isIteratorReady = true;
+	}
+	void Iterator_Reset() const
+	{
+		if( !isIteratorReady )
+		{
+			Jenga::Throw( "イテレータの準備ができていない" );
+		}
+		iterator_CurrentNext = 0;
+	}
+	bool Iterator_HasNext() const
+	{
+		return ( iterator_CurrentNext < (int)iterator_Objects.size() );
+	}
+	T *Iterator_GetNext() const
+	{
+		return iterator_Objects[iterator_CurrentNext++];
+	}
+	int Iterator_GetMaxCount() const
+	{
+		return (int)iterator_Objects.size();
+	}
+
+
+	// XMLシリアライズ用
+private:
+	friend class boost::serialization::access;
+	BOOST_SERIALIZATION_SPLIT_MEMBER();
+	template<class Archive> void load(Archive& ar, const unsigned int version)
+	{
+		std::vector<T *> objects;
+		ar & BOOST_SERIALIZATION_NVP( objects );
+
+		// 読み込み後の処理
+		Clear();
+		BOOST_FOREACH( T *object, objects )
+		{
+			Put( object );
+		}
+		Iterator_Init();
+	}
+	template<class Archive> void save(Archive& ar, const unsigned int version) const
+	{
+		// 保存準備
+		std::vector<T *> objects;
+		objects.clear();
+		Iterator_Reset();
+		while( Iterator_HasNext() )
+		{
+			objects.push_back( Iterator_GetNext() );
+		}
+
+		ar & BOOST_SERIALIZATION_NVP( objects );
+	}
+};
+
+template<class T> class ObjectInHashmap
+{
+	T *pNextObject;
+public:
+
+	ObjectInHashmap()
+		: pNextObject( NULL )
+	{
+	}
+	~ObjectInHashmap()
+	{
+		if( pNextObject )
+		{
+			delete pNextObject;
+		}
+	}
+
+	virtual const std::string &GetKeyName() const = 0;
+	virtual bool IsDuplication( const T *value ) const
+	{
+		return ( GetKeyName() == value->GetName() );
+	}
+	virtual bool IsDuplication( const std::string &keyName ) const
+	{
+		return ( GetKeyName() == keyName );
+	}
+
+	T *GetChainNext()
+	{
+		return pNextObject;
+	}
+	const T *GetChainNext() const
+	{
+		return pNextObject;
+	}
+	void SetChainNext( T *pNextObject )
+	{
+		this->pNextObject = pNextObject;
+	}
+};
+
+
+}}
