做推广网站,怎么制作gif动图,wordpress手机验证码注册,木兰姐网站建设初级代码游戏的专栏介绍与文章目录-CSDN博客
我的github#xff1a;codetoys#xff0c;所有代码都将会位于ctfc库中。已经放入库中我会指出在库中的位置。
这些代码大部分以Linux为目标但部分代码是纯C的#xff0c;可以在任何平台上使用。 为了提高并发性#xff0c;把…初级代码游戏的专栏介绍与文章目录-CSDN博客
我的githubcodetoys所有代码都将会位于ctfc库中。已经放入库中我会指出在库中的位置。
这些代码大部分以Linux为目标但部分代码是纯C的可以在任何平台上使用。 为了提高并发性把每个结构改成十个同样的结构是一个可行的办法。
目录
一、set-list的分块版本
二、更基础的set的分块版本 当然从技术角度我们程序员一般不应该谈论“十个”程序员眼里应该只有“一和多”。 不过由于写成固定个数比较简单而且已经达到较好性能所以就沿用下来。
一、set-list的分块版本 这是基于上一篇介绍的set-list结构 //分为N个子树的SET非标准接口template typename T_DATA, int PI_N, typename T_DATA_LIST, int PI_N2 class T_SHM_LIST_SET_GROUP : public CShmActiveObjects{private:vectorIListSetT_DATA, T_DATA_LIST * vISet;T_SHM_LIST_SETT_DATA,PI_N ,T_DATA_LIST,PI_N2,1 m_shmset;T_SHM_LIST_SETT_DATA,PI_N1,T_DATA_LIST,PI_N21,2 m_shmset1;T_SHM_LIST_SETT_DATA,PI_N2,T_DATA_LIST,PI_N22,3 m_shmset2;T_SHM_LIST_SETT_DATA,PI_N3,T_DATA_LIST,PI_N23,4 m_shmset3;T_SHM_LIST_SETT_DATA,PI_N4,T_DATA_LIST,PI_N24,5 m_shmset4;T_SHM_LIST_SETT_DATA,PI_N5,T_DATA_LIST,PI_N25,6 m_shmset5;T_SHM_LIST_SETT_DATA,PI_N6,T_DATA_LIST,PI_N26,7 m_shmset6;T_SHM_LIST_SETT_DATA,PI_N7,T_DATA_LIST,PI_N27,8 m_shmset7;T_SHM_LIST_SETT_DATA,PI_N8,T_DATA_LIST,PI_N28,9 m_shmset8;T_SHM_LIST_SETT_DATA,PI_N9,T_DATA_LIST,PI_N29,10 m_shmset9;enum {N_SUBTREE10};long KeyHashToIndex(long kh)const{//thelogkh kh%N_SUBTREEendi;if(kh0)return kh%N_SUBTREE;else return (-kh)%N_SUBTREE;;}IListSetT_DATA, T_DATA_LIST * GetISet(long n)const{//thelogGetISet nendi;return vISet[n];}public:struct iterator{long set_index;T_SHM_SIZE handle;iterator():set_index(-1),handle(-1){}bool operator (iterator const tmp)const{return set_indextmp.set_index handletmp.handle;}bool operator ! (iterator const tmp)const{return !(*thistmp);}};typedef iterator const_iterator;struct sub_iterator{long set_index;T_SHM_SIZE handle;sub_iterator():set_index(-1),handle(-1){}bool operator (iterator const tmp)const{return set_indextmp.set_index handletmp.handle;}bool operator ! (iterator const tmp)const{return !(*thistmp);}};typedef sub_iterator const_sub_iterator;private:iterator _find(T_DATA const value)const{iterator it;it.set_indexKeyHashToIndex(value.keyhash());it.handleGetISet(it.set_index)-isetFind(value);if(it.handle0)new(it) iterator;return it;}pairiterator, bool _insert(T_DATA const value){pairiterator, bool ret;pairlong,bool tmp;ret.first.set_indexKeyHashToIndex(value.keyhash());tmpGetISet(ret.first.set_index)-isetInsert(value);ret.first.handletmp.first;ret.secondtmp.second;if(ret.first.handle0)new(ret.first) iterator;return ret;}bool _get(T_DATA value)const{iterator it_find(value);if(it!end()){valueGetByHandle(it); return true;}else{return false;}}bool _getSub(iterator const it,T_DATA_LIST sub)const{if (it ! end()){IListSetT_DATA, T_DATA_LIST * pSet GetISet(it.set_index);T_DATA_LIST * p pSet-ilistsetSubGet(it.handle,sub);if(NULLp){return false;}else{sub*p;return true;}}else{return false;}}bool _getSubAll(iterator const it,vectorT_DATA_LIST vsub)const{if (it ! end()){IListSetT_DATA, T_DATA_LIST * pSet GetISet(it.set_index);return pSet-ilistsetSubGetAll(it.handle,vsub);}else{return false;}}bool _getSubSetAll(iterator const it,setT_DATA_LIST ssub)const{if (it ! end()){IListSetT_DATA, T_DATA_LIST * pSet GetISet(it.set_index);return pSet-ilistsetSubGetSetAll(it.handle,ssub);}else{return false;}}bool _update(T_DATA const value){iterator it_find(value);if(it!end()){GetByHandle(it)value;return true;}else{pairiterator, bool tmp_insert(value);return tmp.first!end();}}bool _updateSub(iterator const it,T_DATA_LIST const sub){if (it ! end()){IListSetT_DATA, T_DATA_LIST * pSet GetISet(it.set_index);T_DATA_LIST * p pSet-ilistsetSubGet(it.handle,sub);if(NULLp){pSet-ilistsetSubAdd(it.handle,sub);return true;}else{*psub;return true;}}else{return false;}}bool _addSub(iterator const it,T_DATA_LIST const sub){if (it ! end()){IListSetT_DATA, T_DATA_LIST * pSet GetISet(it.set_index);T_DATA_LIST * p pSet-ilistsetSubGet(it.handle,sub);if(NULLp){pSet-ilistsetSubAdd(it.handle,sub);return true;}else{*p*psub;return true;}}else{return false;}}//bool _erase(T_DATA const value)//{// iterator it_find(value);// if(it!end())// {// GetISet(it.set_index)-isetErase(it.handle);// return true;// }// else// {// return false;// }//}bool _lsgClear(typename IListSetT_DATA, T_DATA_LIST ::IlsgClear * fun){typename vectorIListSetT_DATA, T_DATA_LIST *::iterator it;long count_main 0;long count_second 0;thelog 根据规则清理...... endi;for (it vISet.begin(); it ! vISet.end(); it){if (!(*it)-ilistsetClear(fun, count_main, count_second))return false;}thelog 清理完成 清理主数据 count_main 个 子数据 count_second 个 endi;return true;}//从给定位置开始清理一段数据templatetypename T_FUN_B1bool _Clear(T_FUN_B1 fun,iterator itBegin){iterator it,old_it;long count0;thelog根据规则清理......endi;ititBegin;while(it!end()){old_itit;MoveNext(it);if(fun(GetByHandle(old_it))){GetISet(old_it.set_index)-isetErase(old_it.handle);count;}else{break; //第一个不符合的跳出}if(0count%100000)thelog已清理记录:count条endi;}thelog清理完成清理[count]个。endi;return true;}bool _ForEach(typename IListSetT_DATA,T_DATA_LIST ::IListSetForEach * fun){typename vectorIListSetT_DATA, T_DATA_LIST *::iterator it;for(itvISet.begin();it!vISet.end();it){if(!(*it)-ilistsetForEach(fun))return false;}return true;}bool _ForEachSub(iterator const it,typename IListSetT_DATA,T_DATA_LIST ::IListSetForEachSub * fun){if (it ! end()){IListSetT_DATA, T_DATA_LIST * pSet GetISet(it.set_index);return pSet-ilistsetForEachSub(it.handle,fun);}else{return false;}}bool _ForEachShuffle(long iSet, long handle, typename IListSetT_DATA,T_DATA_LIST ::IListSetForEachShuffle * fun){typename vectorIListSetT_DATA, T_DATA_LIST *::iterator it;if (iSet 0 static_castsize_t(iSet) vISet.size()){thelog 续传模式 iSet handle endi;it vISet.begin() iSet;}else{thelog 全量模式 iSet handle endi;it vISet.begin();}for(;it!vISet.end();it){fun-iSet it - vISet.begin();//设置iSetif (iSet fun-iSet){if (!(*it)-ilistsetForEachShuffle(handle, fun))return false;}else{if (!(*it)-ilistsetForEachShuffle(-1, fun))return false;}}return true;}public:virtual char const * GetName()const{return m_shmset.GetName();}virtual bool ReportData()const{//m_shmset.Report();//m_shmset1.Report();//m_shmset2.Report();//m_shmset3.Report();//m_shmset4.Report();//m_shmset5.Report();//m_shmset6.Report();//m_shmset7.Report();//m_shmset8.Report();//m_shmset9.Report();CHtmlDoc::CHtmlTable2 table;ReportHtmlTable(table, false, 0, 20);thelog endl table.MakeTextTable() endi;return true;}virtual bool ExportTextToDir(char const * dir_name)const{string file dir_name;if (file.size()0 file[file.size() - 1] ! /)file /;file this-GetName();file .txt;ofstream f;f.open(file.c_str());if (!f.good()){thelog 打开文件失败 file ende;return false;}string str;long count 0;thelog 开始导出... endi;for (const_iterator it begin(); it ! end(); MoveNext(it)){vectorT_DATA_LIST subs;getSubAll(it, subs);if (0 subs.size()){}else{for (typename vectorT_DATA_LIST ::iterator sub_it subs.begin(); sub_it ! subs.end(); sub_it){count;GetByHandle(it).toString(str);str ;f.write(str.c_str(), str.size());(*sub_it).toString(str);str \n;f.write(str.c_str(), str.size());if (0 count % 100000)thelog 导出 count 条 endi;}}}thelog 导出完成共 count 条 endi;f.close();return true;}T_SHM_LIST_SET_GROUP(char const * name,char const * name2,int version):m_shmset(name,name2,version),m_shmset1(name,name2,version),m_shmset2(name,name2,version),m_shmset3(name,name2,version),m_shmset4(name,name2,version),m_shmset5(name,name2,version),m_shmset6(name,name2,version),m_shmset7(name,name2,version),m_shmset8(name,name2,version),m_shmset9(name,name2,version){vISet.reserve(N_SUBTREE);vISet.push_back(m_shmset);vISet.push_back(m_shmset1);vISet.push_back(m_shmset2);vISet.push_back(m_shmset3);vISet.push_back(m_shmset4);vISet.push_back(m_shmset5);vISet.push_back(m_shmset6);vISet.push_back(m_shmset7);vISet.push_back(m_shmset8);vISet.push_back(m_shmset9);if(vISet.size()!N_SUBTREE)throw 内存不足;if(!AddTable(m_shmset))throw 内存不足;if(!AddTable(m_shmset1))throw 内存不足;if(!AddTable(m_shmset2))throw 内存不足;if(!AddTable(m_shmset3))throw 内存不足;if(!AddTable(m_shmset4))throw 内存不足;if(!AddTable(m_shmset5))throw 内存不足;if(!AddTable(m_shmset6))throw 内存不足;if(!AddTable(m_shmset7))throw 内存不足;if(!AddTable(m_shmset8))throw 内存不足;if(!AddTable(m_shmset9))throw 内存不足;}//根据配置的大小创建共享内存仅供管理员使用bool adminRatableCreateShm(){return CreateShm();}bool adminCreateShm(){return CreateShm();}//清理全部数据bool Destroy(){return clear();}//连接和断开管理员和一般使用者使用bool init(bool isReadOnly){if(!Attach(isReadOnly)){thelog连接到共享内存失败ende;return false;}return true;}bool uninit(){return Detach();}//遍历iterator begin()const{iterator it;it.set_index0;it.handleGetISet(it.set_index)-isetBegin();if(it.handle0)MoveNext(it);return it;}iterator end()const{iterator it;new(it) iterator;return it;}T_DATA GetByHandle(iterator const it)const{return *GetISet(it.set_index)-isetGet(it.handle);}iterator MoveNext(iterator * p)const{while(p-set_indexN_SUBTREE){ //thelog当前位置p-set_index p-handleendi;//先if(p-handle0){GetISet(p-set_index)-isetMoveNext(p-handle);//thelog后位置p-set_index p-handleendi;}//到了endif(p-handle0){//thelog子树结尾指向下一个子树数beginendi;(p-set_index);//thelog新子树位置p-set_index p-handleendi;if(p-set_indexN_SUBTREE){p-handleGetISet(p-set_index)-isetBegin();//thelog新子树begin位置p-set_index p-handleendi;if(p-handle0){break;}}else{//thelog到达所有的结尾endi;}}else{break;}}//仍然是endif(p-handle0)new(p) iterator;return *p;}//报告内容调试用string Report(string str)const{string tmp;str;char buf[2048];sprintf(buf,\n总容量 %ld 总大小 %ld (%ld%%),capacity(),size(),size()*100/(0capacity()?1:capacity()));strbuf;iterator it;long count;for (it begin(), count 0; it ! end(); MoveNext(it), count){if(count100){str\n......;break;}sprintf(buf, \n%ld , it.set_index);str buf;str GetByHandle(it).toString(tmp);}return str;}//输出数据到表格formEnd倒序start_pos起始位置倒序时最后一个为0返回输出的行数long ReportHtmlTable(CHtmlDoc::CHtmlTable2 table,bool fromEnd,long start_pos,long max_count)const{table.Clear();table.AddCol(PART,CHtmlDoc::CHtmlDoc_DATACLASS_RIGHT);table.AddCol(i,CHtmlDoc::CHtmlDoc_DATACLASS_RIGHT);T_DATA::AddTableColumns(table);T_DATA_LIST::AddTableColumns(table);const_iterator it;long i;long count0;if(fromEnd){table.AddLine();table.AddData(不支持倒序显示);return 0;}for (i 0, it begin(); it ! end() count max_count; i, MoveNext(it)){if(istart_pos)continue;if(countmax_count)break;vectorT_DATA_LIST subs;getSubAll(it,subs);if(0subs.size()){count;table.AddLine();table.AddData(it.set_index);table.AddData(i);GetByHandle(it).AddTableData(table);}else{for (typename vectorT_DATA_LIST ::iterator sub_it subs.begin(); sub_it ! subs.end(); sub_it){count;table.AddLine();table.AddData(it.set_index);table.AddData(i);GetByHandle(it).AddTableData(table);sub_it-AddTableData(table);}}}return count;}//直接存取bool get(T_DATA * value)const{return get(*value);}bool get(T_DATA value)const{return _get(value);}bool getSub(iterator const it,T_DATA_LIST sub)const{return _getSub(it,sub);}bool getSubAll(iterator const it,vectorT_DATA_LIST vsub)const{return _getSubAll(it,vsub);}bool getSubSetAll(iterator const it,setT_DATA_LIST ssub)const{return _getSubSetAll(it,ssub);}//直接查找iterator find(T_DATA const value) const{return _find(value);}bool update(T_DATA const value){return _update(value);}bool updateSub(iterator const it,T_DATA_LIST const sub){return _updateSub(it,sub);}bool addSub(iterator const it,T_DATA_LIST const sub){return _addSub(it,sub);}//bool erase(T_DATA const value)//{// return _erase(value);//}pairiterator, bool insert(T_DATA const value){return _insert(value);}bool lsgClear(typename IListSetT_DATA, T_DATA_LIST ::IlsgClear * fun){return _lsgClear(fun);}templatetypename T_FUN_B1bool Clear(T_FUN_B1 fun,iterator itBegin){return _Clear(fun,itBegin);}bool ForEach(typename IListSetT_DATA,T_DATA_LIST ::IListSetForEach * fun){return _ForEach(fun);}bool ForEachSub(iterator const it,typename IListSetT_DATA,T_DATA_LIST ::IListSetForEachSub * fun){return _ForEachSub(it,fun);}typedef typename IListSetT_DATA,T_DATA_LIST ::IListSetForEachShuffle T_FOR_EACH_SHUFFLE;bool ForEachShuffle(long iSet, long handle, T_FOR_EACH_SHUFFLE * fun){return _ForEachShuffle(iSet, handle, fun);}//编译测试void test(){m_shmset.test();}};二、更基础的set的分块版本 这是set结构的分块版本 //分为N个子树的SET非标准接口templatetypename T_DATA,int PI_N class T_SHM_SET_GROUP : public CShmActiveObjects{private:vectorISetT_DATA * vISet;T_SHMSET_NO_MUTEX_ISETT_DATA,PI_N ,CDemoData,1 m_shmset;T_SHMSET_NO_MUTEX_ISETT_DATA,PI_N1,CDemoData,2 m_shmset1;T_SHMSET_NO_MUTEX_ISETT_DATA,PI_N2,CDemoData,3 m_shmset2;T_SHMSET_NO_MUTEX_ISETT_DATA,PI_N3,CDemoData,4 m_shmset3;T_SHMSET_NO_MUTEX_ISETT_DATA,PI_N4,CDemoData,5 m_shmset4;T_SHMSET_NO_MUTEX_ISETT_DATA,PI_N5,CDemoData,6 m_shmset5;T_SHMSET_NO_MUTEX_ISETT_DATA,PI_N6,CDemoData,7 m_shmset6;T_SHMSET_NO_MUTEX_ISETT_DATA,PI_N7,CDemoData,8 m_shmset7;T_SHMSET_NO_MUTEX_ISETT_DATA,PI_N8,CDemoData,9 m_shmset8;T_SHMSET_NO_MUTEX_ISETT_DATA,PI_N9,CDemoData,10 m_shmset9;enum {N_SUBTREE10};long KeyHashToIndex(long kh)const{//thelogkh kh%N_SUBTREEendi;if(kh0)return kh%N_SUBTREE;else return (-kh)%N_SUBTREE;;}ISetT_DATA * GetISet(long n)const{//thelogGetISet nendi;return vISet[n];}public:struct iterator{long set_index;T_SHM_SIZE handle;iterator():set_index(-1),handle(-1){}bool operator (iterator const tmp)const{return set_indextmp.set_index handletmp.handle;}bool operator ! (iterator const tmp)const{return !(*thistmp);}};typedef iterator const_iterator;private:iterator _find(T_DATA const value)const{iterator it;it.set_indexKeyHashToIndex(value.keyhash());it.handleGetISet(it.set_index)-isetFind(value);if(it.handle0)new(it) iterator;return it;}iterator _find_lower_bound(T_DATA const value, bool(*less)(T_DATA const , T_DATA const ))const{iterator it;it.set_indexKeyHashToIndex(value.keyhash());it.handleGetISet(it.set_index)-isetFindLowerBound(value,less);if(it.handle0)new(it) iterator;return it;}pairiterator, bool _insert(T_DATA const value){pairiterator, bool ret;pairlong,bool tmp;ret.first.set_indexKeyHashToIndex(value.keyhash());tmpGetISet(ret.first.set_index)-isetInsert(value);ret.first.handletmp.first;ret.secondtmp.second;if(ret.first.handle0)new(ret.first) iterator;return ret;}bool _get(T_DATA value)const{iterator it_find(value);if(it!end()){valueGetByHandle(it); return true;}else{return false;}}bool _update(T_DATA const value){iterator it_find(value);if(it!end()){GetByHandle(it)value;return true;}else{pairiterator, bool tmp_insert(value);return tmp.first!end();}}bool _erase(T_DATA const value){iterator it_find(value);if(it!end()){GetISet(it.set_index)-isetErase(it.handle);return true;}else{return false;}}templatetypename T_FUN_B1bool _Clear(T_FUN_B1 fun){iterator it,old_it;long count_all0;long count0;thelog根据规则清理......endi;itbegin();while(it!end()){old_itit;MoveNext(it);if(fun(GetByHandle(old_it))){GetISet(old_it.set_index)-isetErase(old_it.handle);count;}count_all;if(0count_all%10000)thelogcount_all countendi;}thelog清理完成清理[count]个。endi;return true;}//从给定位置开始清理一段数据templatetypename T_FUN_B1bool _Clear(T_FUN_B1 fun,iterator itBegin){iterator it,old_it;long count0;thelog根据规则清理......endi;ititBegin;while(it!end()){old_itit;MoveNext(it);if(fun(GetByHandle(old_it))){GetISet(old_it.set_index)-isetErase(old_it.handle);count;}else{break; //第一个不符合的跳出}if(0count%100000)thelog已清理记录:count条endi;}thelog清理完成清理[count]个。endi;return true;}templatetypename T_FUN_B1bool _ForEach(T_FUN_B1 fun){iterator it;long count_all0;long count0;thelog 开始处理。。。 endi;for(itbegin();it!end();MoveNext(it)){if(fun(GetByHandle(it))){count;}count_all;if(0count_all%10000)thelogcount_all countendi;}thelog 处理完成共[ count_all ]个处理[ count ]个。 endi;return true;}bool _ForEachShuffle(long iSet, long handle, typename ISetT_DATA ::ISetForEach * fun){typename vectorISetT_DATA *::iterator it;if (iSet 0 static_castsize_t(iSet) vISet.size()){thelog 续传模式 iSet handle endi;it vISet.begin() iSet;}else{thelog 全量模式 iSet handle endi;it vISet.begin();}for (; it ! vISet.end(); it){fun-iSet it - vISet.begin();if (iSet fun-iSet){if (!(*it)-isetForEachShuffle(handle, fun))return false;}else{if (!(*it)-isetForEachShuffle(-1, fun))return false;}}return true;}public:virtual char const * GetName()const{return m_shmset.GetName();}virtual bool ReportData()const{CHtmlDoc::CHtmlTable2 table;ReportHtmlTable(table, false, 0, 20);thelog endl table.MakeTextTable() endi;return true;}T_SHM_SET_GROUP(char const * name,int version):m_shmset(name,version),m_shmset1(name,version),m_shmset2(name,version),m_shmset3(name,version),m_shmset4(name,version),m_shmset5(name,version),m_shmset6(name,version),m_shmset7(name,version),m_shmset8(name,version),m_shmset9(name,version){vISet.reserve(N_SUBTREE);vISet.push_back(m_shmset);vISet.push_back(m_shmset1);vISet.push_back(m_shmset2);vISet.push_back(m_shmset3);vISet.push_back(m_shmset4);vISet.push_back(m_shmset5);vISet.push_back(m_shmset6);vISet.push_back(m_shmset7);vISet.push_back(m_shmset8);vISet.push_back(m_shmset9);if(vISet.size()!N_SUBTREE)throw 内存不足;if(!AddTable(m_shmset))throw 内存不足;if(!AddTable(m_shmset1))throw 内存不足;if(!AddTable(m_shmset2))throw 内存不足;if(!AddTable(m_shmset3))throw 内存不足;if(!AddTable(m_shmset4))throw 内存不足;if(!AddTable(m_shmset5))throw 内存不足;if(!AddTable(m_shmset6))throw 内存不足;if(!AddTable(m_shmset7))throw 内存不足;if(!AddTable(m_shmset8))throw 内存不足;if(!AddTable(m_shmset9))throw 内存不足;}//根据配置的大小创建共享内存仅供管理员使用bool adminRatableCreateShm(){return CreateShm();}bool adminCreateShm(){return CreateShm();}//清理全部数据bool Destroy(){return clear();}//连接和断开管理员和一般使用者使用bool init(bool isReadOnly){if(!Attach(isReadOnly)){thelog连接到共享内存失败ende;return false;}return true;}bool uninit(){return Detach();}//遍历iterator begin()const{iterator it;it.set_index0;it.handleGetISet(it.set_index)-isetBegin();if(it.handle0)MoveNext(it);return it;}iterator end()const{iterator it;new(it) iterator;return it;}T_DATA GetByHandle(iterator const it)const{return *GetISet(it.set_index)-isetGet(it.handle);}iterator MoveNext(iterator * p)const{while(p-set_indexN_SUBTREE){ //thelog当前位置p-set_index p-handleendi;//先if(p-handle0){GetISet(p-set_index)-isetMoveNext(p-handle);//thelog后位置p-set_index p-handleendi;}//到了endif(p-handle0){//thelog子树结尾指向下一个子树数beginendi;(p-set_index);//thelog新子树位置p-set_index p-handleendi;if(p-set_indexN_SUBTREE){p-handleGetISet(p-set_index)-isetBegin();//thelog新子树begin位置p-set_index p-handleendi;if(p-handle0){break;}}else{//thelog到达所有的结尾endi;}}else{break;}}//仍然是endif(p-handle0)new(p) iterator;return *p;}//报告内容调试用string Report(string str)const{string tmp;str;//strm_shmset.Report(tmp);//strm_shmset1.Report(tmp);//strm_shmset2.Report(tmp);//strm_shmset3.Report(tmp);//strm_shmset4.Report(tmp);//strm_shmset5.Report(tmp);//strm_shmset6.Report(tmp);//strm_shmset7.Report(tmp);//strm_shmset8.Report(tmp);//strm_shmset9.Report(tmp);char buf[2048];sprintf(buf,\n总容量 %ld 总大小 %ld (%ld%%),capacity(),size(),size()*100/(0capacity()?1:capacity()));strbuf;iterator it;long count;for (it begin(), count 0; it ! end(); MoveNext(it), count){if(count100){str\n......;break;}sprintf(buf, \n%ld , it.set_index);str buf;str GetByHandle(it).toString(tmp);}return str;}//输出数据到表格formEnd倒序start_pos起始位置倒序时最后一个为0返回输出的行数long ReportHtmlTable(CHtmlDoc::CHtmlTable2 table,bool fromEnd,long start_pos,long max_count)const{table.Clear();table.AddCol(PART,CHtmlDoc::CHtmlDoc_DATACLASS_RIGHT);table.AddCol(i,CHtmlDoc::CHtmlDoc_DATACLASS_RIGHT);T_DATA::AddTableColumns(table);const_iterator it;long i;long count0;if(fromEnd){table.AddLine();table.AddData(不支持倒序显示);return 0;}for (i 0, it begin(); it ! end() count max_count; i, MoveNext(it)){if(istart_pos)continue;if(countmax_count)break;count;table.AddLine();table.AddData(it.set_index);table.AddData(i);GetByHandle(it).AddTableData(table);}return count;}//直接存取bool get(T_DATA * value)const{return get(*value);}bool get(T_DATA value)const{return _get(value);}//直接查找iterator find(T_DATA const value) const{return _find(value);}iterator lower_bound(T_DATA * value, bool(*less)(T_DATA const , T_DATA const ))const{return lower_bound(*value,less);}iterator lower_bound(T_DATA value, bool(*less)(T_DATA const , T_DATA const ))const{return _find_lower_bound(value,less);}bool update(T_DATA const value){return _update(value);}bool erase(T_DATA const value){return _erase(value);}pairiterator, bool insert(T_DATA const value){return _insert(value);}templatetypename T_FUN_B1bool Clear(T_FUN_B1 fun){return _Clear(fun);}templatetypename T_FUN_B1bool Clear(T_FUN_B1 fun,iterator itBegin){return _Clear(fun,itBegin);}templatetypename T_FUN_B1bool ForEach(T_FUN_B1 fun){return _ForEach(fun);}typedef typename ISetT_DATA ::ISetForEach T_FOR_EACH_SHUFFLE;bool ForEachShuffle(long iSet, long handle, typename ISetT_DATA ::ISetForEach * fun){return _ForEachShuffle(iSet, handle, fun);}};这里是结束