亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? catalogue.h

?? 遺傳算法做圖像的模式匹配
?? H
?? 第 1 頁 / 共 2 頁
字號:

/*! \file Catalogue.h
    \brief This file contains declaration and implementation of catalogue template class used to store genetic operations and other stateless objects.
*/

/*
 * 
 * website: http://www.coolsoft-sd.com/
 * contact: support@coolsoft-sd.com
 *
 */

/*
 * Genetic Algorithm Library
 * Copyright (C) 2007-2008 Coolsoft Software Development
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 */

#ifndef __GA_CATALOGUE_H__
#define __GA_CATALOGUE_H__

#include "Platform.h"

#if defined(GAL_STL_EXT_MSVC)

#include <hash_map>
using namespace stdext;

#elif defined(GAL_STL_EXT_STLPORT)

#include <hash_map>

#elif defined(GAL_STL_EXT_GNUC)

#include <ext/hash_map>
using namespace __gnu_cxx;

#endif

#include "Threading.h"

using namespace std;

namespace Common
{
	template <typename T>
	class GaCatalogue;

	/// <summary>This template class manages key and pointer to data of a catalogue entry.
	/// Catalogue entry stores key's string value and pointer to data. Entry stores copied string value of a key. After binding data to an entry,
	/// entry object takes over responsibility for memory occupied by data. Data must be located at heap. 
	///
	/// This class has no built-in synchronizator, so <c>LOCK_OBJECT</c> and <c>LOCK_THIS_OBJECT</c> macros cannot be used with instances of this class.
	/// No public or private methods are thread-safe.</summary>
	/// <param name="T">type of stored data in the entry.</param>
	template <typename T>
	class GaCatalogueEntry
	{
	friend class GaCatalogue<T>;

	private:

		/// <summary>Pointer to string representing key of the catalogue's entry.</summary>
		char* _name;

		/// <summary>Stores length of string (key) without null-terminating character.</summary>
		int _nameLength;

		/// <summary>Pointer to the data.</summary>
		T* _data;

	public:

		/// <summary>Constructor makes copy of key and stores pointer to copied key and pointer to user specified data.</summary>
		/// <param name="name">key of the entry (null-terminating string).</param>
		/// <param name="data">data which will be stored in the entry.</param>
		GaCatalogueEntry(const char* name,
						T* data)
		{
			if( name )
			{
				_nameLength = (int)strlen( name );

				// copy name
				_name = new char[ _nameLength + 1 ];
				strcpy( _name, name );

				_data = data;

				return;
			}

			_name = NULL;
			_nameLength = 0;
			_data = NULL;
		}

		/// <summary>Frees memory used by the data and the key.</summary>
		~GaCatalogueEntry()
		{
			if( _name )
				delete[] _name;

			if( _data )
				delete _data;
		}

		/// <summary>This method is not thread-safe.</summary>
		/// <returns>Method returns pointer to string representing key of the entry.</returns>
		inline const char* GACALL GetName() const { return _name; }

		/// <summary><c>SetName</c> method copies key's string and stores pointer to the copied string.
		///
		/// This method is not thread-safe.</summary>
		/// <param name="name">pointer to string which represents new key.</param>
		void GACALL SetName(const char* name)
		{
			if( name )
			{
				if( _name )
					delete[] _name;

				_nameLength = strlen( name );

				// copy name
				_name = new char[ _nameLength + 1 ];
				strcpy( _name, name );
			}
		}

		/// <summary>This method is not thread-safe.</summary>
		/// <returns>Method returns length of the key.</returns>
		inline int GACALL GetNameLength() const { return _nameLength; }

		/// <summary>This method is not thread-safe.</summary>
		/// <returns>Method returns reference to the data.</returns>
		inline T* GACALL GetData() const { return _data; }

		/// <summary><c>SetData</c> method stores pointer to data.
		///
		/// This method is not thread-safe.</summary>
		/// <param name="data">reference to new data.</param>
		inline void GACALL SetData(T* data) { _data = data; }

	};


	/// <summary><C>GaCatalogue</c> template class stores and manages catalogue (directory) for genetic operations.
	/// Data can be accessed by its key (name). When user adds new data into catalogue, catalogue takes over responsibility for memory
	/// allocated by the data. Data must come from heap. Key/data combination is stored in <see cref="GaCatalogueEntry" /> object.
	/// Duplicates of key in catalogue are not allowed.
	///
	/// All public methods are thread-safe except <c>MakeInstance</c> and <c>FreeInstance</c>. This class has built-in synchronizator so
	/// it is allowed to use <c>LOCK_OBJECT</c> and <c>LOCK_THIS_OBJECT</c> macros with instances of this class.</summary>
	/// <param name="T">type of stored data in catalogue.</param>
	template <typename T>
	class GaCatalogue
	{
		DEFINE_SYNC_CLASS

	private:

		// String comparator
		struct GaStringComparator
		{

		public:

			// Compare
			inline bool GACALL operator()(const char* left, const char* right) const
			{
				#if defined(GAL_STL_EXT_MSVC)

				return strcmp( left, right ) == -1;

				#elif defined(GAL_STL_EXT_GNUC) || defined (GAL_STL_EXT_STLPORT)

				return strcmp( left, right ) == 0;

				#endif
			}

		};

		// Comarator for catalogue's hash map
		class GaCataolgueHashMapComparator
		{

		public:

			// Parameters for hash table
			enum
			{
				bucket_size = 4,
				min_buckets = 8
			};	

			// Construct with default comparator
			GaCataolgueHashMapComparator() : _comparator() { }

			// Construct with _Pred comparator
			GaCataolgueHashMapComparator(GaStringComparator pred) : _comparator( pred ) { }

			// Hash function
			size_t GACALL operator()(const char* key) const
			{
				if( key == NULL )
					return 0;

				size_t t = 0;
				while( *key )
					t += *( key++ );

				ldiv_t rem = ldiv((long)t, 127773);
				rem.rem = 16807 * rem.rem - 2836 * rem.quot;
				if (rem.rem < 0)
					rem.rem += 2147483647;

				return ((size_t)rem.rem);
			}

			// Comparison
			inline bool GACALL operator()(const char* value1, const char* value2) const { return _comparator( value1, value2 ); }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
jiyouzz国产精品久久| av不卡一区二区三区| 亚洲一区二区三区中文字幕| 国产精品萝li| 欧美国产精品专区| 亚洲国产精品国自产拍av| 久久久久久夜精品精品免费| 欧美tickle裸体挠脚心vk| 欧美成人a在线| 日韩免费一区二区| 精品成a人在线观看| 精品国产乱码久久久久久免费| 日韩欧美一区二区视频| 欧美电影免费观看高清完整版| 在线观看91av| 欧美一区二区女人| 日韩精品在线一区| 337p粉嫩大胆色噜噜噜噜亚洲 | 日韩小视频在线观看专区| 777久久久精品| 日韩精品一区二区三区中文精品| 91精品国产色综合久久不卡蜜臀 | 日韩精品电影在线| 日韩激情一区二区| 久久99精品久久久久久动态图| 精品综合免费视频观看| 国产一区二区三区蝌蚪| 成人sese在线| 91久久国产最好的精华液| 欧美熟乱第一页| 91精品国产91久久久久久一区二区| 欧美大片拔萝卜| 欧美激情在线一区二区三区| 国产目拍亚洲精品99久久精品| 国产精品久久久久久福利一牛影视| 亚洲三级小视频| 香蕉影视欧美成人| 欧美一区二区三区喷汁尤物| 日韩精品综合一本久道在线视频| 精品国产三级a在线观看| 日本一区二区三区高清不卡 | 亚洲视频免费在线观看| 亚洲综合免费观看高清在线观看| 日韩电影在线一区二区三区| 国产一区二区电影| 91在线观看一区二区| 欧美日本一区二区三区| 欧美精品一区二区三区在线| 亚洲欧洲日产国产综合网| 亚洲一区二区三区小说| 精品中文字幕一区二区| av资源网一区| 7777精品伊人久久久大香线蕉超级流畅 | 777午夜精品视频在线播放| 久久久久9999亚洲精品| 亚洲无线码一区二区三区| 奇米色777欧美一区二区| 成人一道本在线| 欧美日韩午夜在线| 国产精品午夜春色av| 日本三级亚洲精品| 99精品国产热久久91蜜凸| 一区二区三区免费在线观看| 久久国产生活片100| 色综合天天综合| 精品久久久久久久久久久久久久久 | 欧美视频一二三区| 国产欧美综合在线| 三级影片在线观看欧美日韩一区二区| 国产成人综合亚洲网站| 欧美日韩高清影院| 国产精品蜜臀在线观看| 美女免费视频一区| 欧美性受极品xxxx喷水| 国产嫩草影院久久久久| 日本午夜精品一区二区三区电影| 97久久超碰国产精品| 精品国产一区二区三区av性色| 夜夜嗨av一区二区三区中文字幕| 国产精品一区久久久久| 欧美肥胖老妇做爰| 依依成人综合视频| 成人av影视在线观看| 欧美精品一区二区三区一线天视频 | 亚洲日本va在线观看| 精东粉嫩av免费一区二区三区| 欧美在线观看18| 中文字幕色av一区二区三区| 国产制服丝袜一区| 日韩欧美国产三级| 天天色图综合网| 日本电影亚洲天堂一区| 国产精品久久久久婷婷| 国产剧情一区二区| 欧美成人a∨高清免费观看| 日本中文一区二区三区| 欧美色网站导航| 亚洲欧美另类综合偷拍| 成人午夜视频网站| 国产亚洲精品bt天堂精选| 精品一二线国产| 欧美大肚乱孕交hd孕妇| 青青草伊人久久| 欧美年轻男男videosbes| 亚洲一区二区在线观看视频| 色av成人天堂桃色av| 中文字幕一区二区三区乱码在线| 国产91精品入口| 亚洲国产精品t66y| 国产丶欧美丶日本不卡视频| 2023国产精品自拍| 国模娜娜一区二区三区| 2020国产精品自拍| 国产精品白丝av| 国产欧美日韩在线| www.欧美色图| 国产精品国模大尺度视频| 99久久免费视频.com| 一区精品在线播放| 色激情天天射综合网| 一区二区三区免费网站| 欧美日韩在线亚洲一区蜜芽| 亚洲大片精品永久免费| 欧美精品在线观看播放| 亚洲精品久久嫩草网站秘色| 日韩国产在线观看一区| 国产片一区二区三区| 国产成人无遮挡在线视频| 国产女人aaa级久久久级| 成人av电影在线播放| 国产精品嫩草影院com| 91丨porny丨中文| 亚洲午夜视频在线观看| 欧美电影影音先锋| 久88久久88久久久| 国产女主播视频一区二区| 色综合久久久久久久久久久| 亚洲综合无码一区二区| 91精品国产综合久久久蜜臀图片| 蜜桃一区二区三区在线观看| 国产丝袜在线精品| 日本乱人伦一区| 免费在线成人网| 日本一区二区免费在线| 色爱区综合激月婷婷| 蜜臀av一区二区三区| 欧美激情艳妇裸体舞| 色吊一区二区三区| 免费看日韩精品| 中文字幕 久热精品 视频在线| 91麻豆成人久久精品二区三区| 三级成人在线视频| 欧美激情一区二区三区蜜桃视频| 一本色道久久综合精品竹菊| 奇米综合一区二区三区精品视频 | 欧美激情一区三区| 欧美午夜片在线观看| 国精产品一区一区三区mba桃花| 中文字幕亚洲在| 欧美一级欧美三级| www.99精品| 这里只有精品电影| 大尺度一区二区| 午夜电影网亚洲视频| 国产目拍亚洲精品99久久精品| 欧美日韩中字一区| 成人免费视频视频| 青青草原综合久久大伊人精品优势| 国产亚洲精品资源在线26u| 欧美日韩国产一级二级| 粉嫩av一区二区三区| 视频一区在线视频| 亚洲视频1区2区| 久久久亚洲欧洲日产国码αv| 欧美性生活久久| 国产成人精品亚洲777人妖| 水蜜桃久久夜色精品一区的特点| 日本一区二区三区国色天香| 在线成人免费观看| 91视频免费播放| 国产精品一区一区三区| 日本中文字幕不卡| 亚洲综合图片区| 国产精品超碰97尤物18| 精品国产sm最大网站| 欧美绝品在线观看成人午夜影视 | 久久久久久久综合日本| 欧美日韩视频在线观看一区二区三区 | 欧美性感一类影片在线播放| 成人中文字幕在线| 久久精品久久精品| 亚洲www啪成人一区二区麻豆| 国产精品乱人伦| 久久久久国产精品麻豆ai换脸| 这里只有精品视频在线观看| 欧美视频精品在线观看| 色综合av在线| 91污在线观看| 成人精品国产免费网站| 国产精品888|