当前位置: 首页 > news >正文

用vs做网站教程seo平台有哪些

用vs做网站教程,seo平台有哪些,收费的网站怎么做的,用dw做音乐网站系统的代码初级代码游戏的专栏介绍与文章目录-CSDN博客 我的github:codetoys,所有代码都将会位于ctfc库中。已经放入库中我会指出在库中的位置。 这些代码大部分以Linux为目标但部分代码是纯C的,可以在任何平台上使用。 为了提高并发性,把…

初级代码游戏的专栏介绍与文章目录-CSDN博客

我的github:codetoys,所有代码都将会位于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:vector<IListSet<T_DATA, T_DATA_LIST > *> vISet;T_SHM_LIST_SET<T_DATA,PI_N  ,T_DATA_LIST,PI_N2,1> m_shmset;T_SHM_LIST_SET<T_DATA,PI_N+1,T_DATA_LIST,PI_N2+1,2> m_shmset1;T_SHM_LIST_SET<T_DATA,PI_N+2,T_DATA_LIST,PI_N2+2,3> m_shmset2;T_SHM_LIST_SET<T_DATA,PI_N+3,T_DATA_LIST,PI_N2+3,4> m_shmset3;T_SHM_LIST_SET<T_DATA,PI_N+4,T_DATA_LIST,PI_N2+4,5> m_shmset4;T_SHM_LIST_SET<T_DATA,PI_N+5,T_DATA_LIST,PI_N2+5,6> m_shmset5;T_SHM_LIST_SET<T_DATA,PI_N+6,T_DATA_LIST,PI_N2+6,7> m_shmset6;T_SHM_LIST_SET<T_DATA,PI_N+7,T_DATA_LIST,PI_N2+7,8> m_shmset7;T_SHM_LIST_SET<T_DATA,PI_N+8,T_DATA_LIST,PI_N2+8,9> m_shmset8;T_SHM_LIST_SET<T_DATA,PI_N+9,T_DATA_LIST,PI_N2+9,10> m_shmset9;enum {N_SUBTREE=10};long KeyHashToIndex(long kh)const{//thelog<<kh<<" "<<kh%N_SUBTREE<<endi;if(kh>=0)return kh%N_SUBTREE;else return (-kh)%N_SUBTREE;;}IListSet<T_DATA, T_DATA_LIST > * GetISet(long n)const{//thelog<<"GetISet "<<n<<endi;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_index==tmp.set_index && handle==tmp.handle;}bool operator != (iterator const & tmp)const{return !(*this==tmp);}};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_index==tmp.set_index && handle==tmp.handle;}bool operator != (iterator const & tmp)const{return !(*this==tmp);}};typedef sub_iterator const_sub_iterator;private:iterator _find(T_DATA const & value)const{iterator it;it.set_index=KeyHashToIndex(value.keyhash());it.handle=GetISet(it.set_index)->isetFind(value);if(it.handle<0)new(&it) iterator;return it;}pair<iterator, bool> _insert(T_DATA const & value){pair<iterator, bool> ret;pair<long,bool> tmp;ret.first.set_index=KeyHashToIndex(value.keyhash());tmp=GetISet(ret.first.set_index)->isetInsert(value);ret.first.handle=tmp.first;ret.second=tmp.second;if(ret.first.handle<0)new(&ret.first) iterator;return ret;}bool _get(T_DATA & value)const{iterator it=_find(value);if(it!=end()){value=GetByHandle(it);		return true;}else{return false;}}bool _getSub(iterator const & it,T_DATA_LIST & sub)const{if (it != end()){IListSet<T_DATA, T_DATA_LIST > * pSet = GetISet(it.set_index);T_DATA_LIST * p= pSet->ilistsetSubGet(it.handle,sub);if(NULL==p){return false;}else{sub=*p;return true;}}else{return false;}}bool _getSubAll(iterator const & it,vector<T_DATA_LIST > & vsub)const{if (it != end()){IListSet<T_DATA, T_DATA_LIST > * pSet = GetISet(it.set_index);return pSet->ilistsetSubGetAll(it.handle,vsub);}else{return false;}}bool _getSubSetAll(iterator const & it,set<T_DATA_LIST > & ssub)const{if (it != end()){IListSet<T_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{pair<iterator, bool> tmp=_insert(value);return tmp.first!=end();}}bool _updateSub(iterator const & it,T_DATA_LIST const & sub){if (it != end()){IListSet<T_DATA, T_DATA_LIST > * pSet = GetISet(it.set_index);T_DATA_LIST * p= pSet->ilistsetSubGet(it.handle,sub);if(NULL==p){pSet->ilistsetSubAdd(it.handle,sub);return true;}else{*p=sub;return true;}}else{return false;}}bool _addSub(iterator const & it,T_DATA_LIST const & sub){if (it != end()){IListSet<T_DATA, T_DATA_LIST > * pSet = GetISet(it.set_index);T_DATA_LIST * p= pSet->ilistsetSubGet(it.handle,sub);if(NULL==p){pSet->ilistsetSubAdd(it.handle,sub);return true;}else{*p=*p+sub;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 IListSet<T_DATA, T_DATA_LIST >::IlsgClear * fun){typename vector<IListSet<T_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;}//从给定位置开始清理一段数据template<typename T_FUN_B1>bool _Clear(T_FUN_B1 fun,iterator itBegin){iterator it,old_it;long count=0;thelog<<"根据规则清理......"<<endi;it=itBegin;while(it!=end()){old_it=it;MoveNext(&it);if(fun(GetByHandle(old_it))){GetISet(old_it.set_index)->isetErase(old_it.handle);++count;}else{break; //第一个不符合的跳出}if(0==count%100000)thelog<<"已清理记录:"<<count<<"条"<<endi;}thelog<<"清理完成,清理["<<count<<"]个。"<<endi;return true;}bool _ForEach(typename IListSet<T_DATA,T_DATA_LIST >::IListSetForEach * fun){typename vector<IListSet<T_DATA, T_DATA_LIST > *>::iterator it;for(it=vISet.begin();it!=vISet.end();++it){if(!(*it)->ilistsetForEach(fun))return false;}return true;}bool _ForEachSub(iterator const & it,typename IListSet<T_DATA,T_DATA_LIST >::IListSetForEachSub * fun){if (it != end()){IListSet<T_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 IListSet<T_DATA,T_DATA_LIST >::IListSetForEachShuffle * fun){typename vector<IListSet<T_DATA, T_DATA_LIST > *>::iterator it;if (iSet >= 0 && static_cast<size_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)){vector<T_DATA_LIST > subs;getSubAll(it, subs);if (0 == subs.size()){}else{for (typename vector<T_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_index=0;it.handle=GetISet(it.set_index)->isetBegin();if(it.handle<0)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_index<N_SUBTREE){			//thelog<<"当前位置:"<<p->set_index<<" "<<p->handle<<endi;//先++if(p->handle>=0){GetISet(p->set_index)->isetMoveNext(p->handle);//thelog<<"++后位置:"<<p->set_index<<" "<<p->handle<<endi;}//到了endif(p->handle<0){//thelog<<"子树结尾,指向下一个子树数begin"<<endi;++(p->set_index);//thelog<<"新子树位置:"<<p->set_index<<" "<<p->handle<<endi;if(p->set_index<N_SUBTREE){p->handle=GetISet(p->set_index)->isetBegin();//thelog<<"新子树begin位置:"<<p->set_index<<" "<<p->handle<<endi;if(p->handle>=0){break;}}else{//thelog<<"到达所有的结尾"<<endi;}}else{break;}}//仍然是endif(p->handle<0)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/(0==capacity()?1:capacity()));str+=buf;iterator it;long count;for (it = begin(), count = 0; it != end(); MoveNext(&it), ++count){if(count>100){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 count=0;if(fromEnd){table.AddLine();table.AddData("不支持倒序显示");return 0;}for (i = 0, it = begin(); it != end() && count < max_count; ++i, MoveNext(&it)){if(i<start_pos)continue;if(count>=max_count)break;vector<T_DATA_LIST > subs;getSubAll(it,subs);if(0==subs.size()){++count;table.AddLine();table.AddData(it.set_index);table.AddData(i);GetByHandle(it).AddTableData(table);}else{for (typename vector<T_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,vector<T_DATA_LIST > & vsub)const{return _getSubAll(it,vsub);}bool getSubSetAll(iterator const & it,set<T_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);//}pair<iterator, bool> insert(T_DATA const & value){return _insert(value);}bool lsgClear(typename IListSet<T_DATA, T_DATA_LIST >::IlsgClear * fun){return _lsgClear(fun);}template<typename T_FUN_B1>bool Clear(T_FUN_B1 fun,iterator itBegin){return _Clear(fun,itBegin);}bool ForEach(typename IListSet<T_DATA,T_DATA_LIST >::IListSetForEach * fun){return _ForEach(fun);}bool ForEachSub(iterator const & it,typename IListSet<T_DATA,T_DATA_LIST >::IListSetForEachSub * fun){return _ForEachSub(it,fun);}typedef typename IListSet<T_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,非标准接口template<typename T_DATA,int PI_N >class T_SHM_SET_GROUP : public CShmActiveObjects{private:vector<ISet<T_DATA > *> vISet;T_SHMSET_NO_MUTEX_ISET<T_DATA,PI_N  ,CDemoData,1> m_shmset;T_SHMSET_NO_MUTEX_ISET<T_DATA,PI_N+1,CDemoData,2> m_shmset1;T_SHMSET_NO_MUTEX_ISET<T_DATA,PI_N+2,CDemoData,3> m_shmset2;T_SHMSET_NO_MUTEX_ISET<T_DATA,PI_N+3,CDemoData,4> m_shmset3;T_SHMSET_NO_MUTEX_ISET<T_DATA,PI_N+4,CDemoData,5> m_shmset4;T_SHMSET_NO_MUTEX_ISET<T_DATA,PI_N+5,CDemoData,6> m_shmset5;T_SHMSET_NO_MUTEX_ISET<T_DATA,PI_N+6,CDemoData,7> m_shmset6;T_SHMSET_NO_MUTEX_ISET<T_DATA,PI_N+7,CDemoData,8> m_shmset7;T_SHMSET_NO_MUTEX_ISET<T_DATA,PI_N+8,CDemoData,9> m_shmset8;T_SHMSET_NO_MUTEX_ISET<T_DATA,PI_N+9,CDemoData,10> m_shmset9;enum {N_SUBTREE=10};long KeyHashToIndex(long kh)const{//thelog<<kh<<" "<<kh%N_SUBTREE<<endi;if(kh>=0)return kh%N_SUBTREE;else return (-kh)%N_SUBTREE;;}ISet<T_DATA > * GetISet(long n)const{//thelog<<"GetISet "<<n<<endi;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_index==tmp.set_index && handle==tmp.handle;}bool operator != (iterator const & tmp)const{return !(*this==tmp);}};typedef iterator const_iterator;private:iterator _find(T_DATA const & value)const{iterator it;it.set_index=KeyHashToIndex(value.keyhash());it.handle=GetISet(it.set_index)->isetFind(value);if(it.handle<0)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_index=KeyHashToIndex(value.keyhash());it.handle=GetISet(it.set_index)->isetFindLowerBound(value,less);if(it.handle<0)new(&it) iterator;return it;}pair<iterator, bool> _insert(T_DATA const & value){pair<iterator, bool> ret;pair<long,bool> tmp;ret.first.set_index=KeyHashToIndex(value.keyhash());tmp=GetISet(ret.first.set_index)->isetInsert(value);ret.first.handle=tmp.first;ret.second=tmp.second;if(ret.first.handle<0)new(&ret.first) iterator;return ret;}bool _get(T_DATA & value)const{iterator it=_find(value);if(it!=end()){value=GetByHandle(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{pair<iterator, 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;}}template<typename T_FUN_B1>bool _Clear(T_FUN_B1 fun){iterator it,old_it;long count_all=0;long count=0;thelog<<"根据规则清理......"<<endi;it=begin();while(it!=end()){old_it=it;MoveNext(&it);if(fun(GetByHandle(old_it))){GetISet(old_it.set_index)->isetErase(old_it.handle);++count;}++count_all;if(0==count_all%10000)thelog<<count_all<<" "<<count<<endi;}thelog<<"清理完成,清理["<<count<<"]个。"<<endi;return true;}//从给定位置开始清理一段数据template<typename T_FUN_B1>bool _Clear(T_FUN_B1 fun,iterator itBegin){iterator it,old_it;long count=0;thelog<<"根据规则清理......"<<endi;it=itBegin;while(it!=end()){old_it=it;MoveNext(&it);if(fun(GetByHandle(old_it))){GetISet(old_it.set_index)->isetErase(old_it.handle);++count;}else{break; //第一个不符合的跳出}if(0==count%100000)thelog<<"已清理记录:"<<count<<"条"<<endi;}thelog<<"清理完成,清理["<<count<<"]个。"<<endi;return true;}template<typename T_FUN_B1>bool _ForEach(T_FUN_B1 fun){iterator it;long count_all=0;long count=0;thelog << "开始处理。。。" << endi;for(it=begin();it!=end();MoveNext(&it)){if(fun(&GetByHandle(it))){++count;}++count_all;if(0==count_all%10000)thelog<<count_all<<" "<<count<<endi;}thelog << "处理完成,共[" << count_all << "]个,处理[" << count << "]个。" << endi;return true;}bool _ForEachShuffle(long iSet, long handle, typename ISet<T_DATA >::ISetForEach * fun){typename vector<ISet<T_DATA > *>::iterator it;if (iSet >= 0 && static_cast<size_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_index=0;it.handle=GetISet(it.set_index)->isetBegin();if(it.handle<0)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_index<N_SUBTREE){			//thelog<<"当前位置:"<<p->set_index<<" "<<p->handle<<endi;//先++if(p->handle>=0){GetISet(p->set_index)->isetMoveNext(p->handle);//thelog<<"++后位置:"<<p->set_index<<" "<<p->handle<<endi;}//到了endif(p->handle<0){//thelog<<"子树结尾,指向下一个子树数begin"<<endi;++(p->set_index);//thelog<<"新子树位置:"<<p->set_index<<" "<<p->handle<<endi;if(p->set_index<N_SUBTREE){p->handle=GetISet(p->set_index)->isetBegin();//thelog<<"新子树begin位置:"<<p->set_index<<" "<<p->handle<<endi;if(p->handle>=0){break;}}else{//thelog<<"到达所有的结尾"<<endi;}}else{break;}}//仍然是endif(p->handle<0)new(p) iterator;return *p;}//报告内容,调试用string & Report(string & str)const{string tmp;str="";//str+=m_shmset.Report(tmp);//str+=m_shmset1.Report(tmp);//str+=m_shmset2.Report(tmp);//str+=m_shmset3.Report(tmp);//str+=m_shmset4.Report(tmp);//str+=m_shmset5.Report(tmp);//str+=m_shmset6.Report(tmp);//str+=m_shmset7.Report(tmp);//str+=m_shmset8.Report(tmp);//str+=m_shmset9.Report(tmp);char buf[2048];sprintf(buf,"\n总容量 %ld 总大小 %ld (%ld%%)",capacity(),size(),size()*100/(0==capacity()?1:capacity()));str+=buf;iterator it;long count;for (it = begin(), count = 0; it != end(); MoveNext(&it), ++count){if(count>100){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 count=0;if(fromEnd){table.AddLine();table.AddData("不支持倒序显示");return 0;}for (i = 0, it = begin(); it != end() && count < max_count; ++i, MoveNext(&it)){if(i<start_pos)continue;if(count>=max_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);}pair<iterator, bool> insert(T_DATA const & value){return _insert(value);}template<typename T_FUN_B1>bool Clear(T_FUN_B1 fun){return _Clear(fun);}template<typename T_FUN_B1>bool Clear(T_FUN_B1 fun,iterator itBegin){return _Clear(fun,itBegin);}template<typename T_FUN_B1>bool ForEach(T_FUN_B1 fun){return _ForEach(fun);}typedef typename ISet<T_DATA >::ISetForEach T_FOR_EACH_SHUFFLE;bool ForEachShuffle(long iSet, long handle, typename ISet<T_DATA >::ISetForEach * fun){return _ForEachShuffle(iSet, handle, fun);}};

(这里是结束)


文章转载自:
http://avens.c7513.cn
http://postie.c7513.cn
http://luminism.c7513.cn
http://tambour.c7513.cn
http://bookman.c7513.cn
http://noumena.c7513.cn
http://gymnastics.c7513.cn
http://sertoman.c7513.cn
http://steeplebush.c7513.cn
http://marcato.c7513.cn
http://spongiopiline.c7513.cn
http://ferdinanda.c7513.cn
http://monogenism.c7513.cn
http://arrivederci.c7513.cn
http://affix.c7513.cn
http://mucosa.c7513.cn
http://basicity.c7513.cn
http://hydrophobic.c7513.cn
http://investigative.c7513.cn
http://bateleur.c7513.cn
http://singhalese.c7513.cn
http://arabia.c7513.cn
http://nightlong.c7513.cn
http://rabbinical.c7513.cn
http://shortwave.c7513.cn
http://hearthrug.c7513.cn
http://unfenced.c7513.cn
http://xl.c7513.cn
http://sugarbush.c7513.cn
http://phycology.c7513.cn
http://sirgang.c7513.cn
http://ministate.c7513.cn
http://bedarken.c7513.cn
http://belat.c7513.cn
http://replete.c7513.cn
http://shoulder.c7513.cn
http://lyricism.c7513.cn
http://beetlehead.c7513.cn
http://dyspnoea.c7513.cn
http://rediscovery.c7513.cn
http://sponsor.c7513.cn
http://septilateral.c7513.cn
http://alarum.c7513.cn
http://stephanotis.c7513.cn
http://scobs.c7513.cn
http://sanctimony.c7513.cn
http://limnologist.c7513.cn
http://lugworm.c7513.cn
http://vibratiuncle.c7513.cn
http://weedy.c7513.cn
http://handshake.c7513.cn
http://waughian.c7513.cn
http://mestizo.c7513.cn
http://gamblesome.c7513.cn
http://pdp.c7513.cn
http://jurassic.c7513.cn
http://orthopraxis.c7513.cn
http://carburetion.c7513.cn
http://kaka.c7513.cn
http://photogenic.c7513.cn
http://wonderland.c7513.cn
http://spandril.c7513.cn
http://havel.c7513.cn
http://checktaker.c7513.cn
http://plumbago.c7513.cn
http://gaiety.c7513.cn
http://endosternite.c7513.cn
http://prominently.c7513.cn
http://gerodontics.c7513.cn
http://branchiae.c7513.cn
http://folkmoot.c7513.cn
http://prodigality.c7513.cn
http://costean.c7513.cn
http://keck.c7513.cn
http://whitish.c7513.cn
http://arts.c7513.cn
http://prolapsus.c7513.cn
http://scorper.c7513.cn
http://elegiast.c7513.cn
http://diester.c7513.cn
http://mystically.c7513.cn
http://artillerist.c7513.cn
http://feoff.c7513.cn
http://excrescency.c7513.cn
http://talaria.c7513.cn
http://bowel.c7513.cn
http://seignorial.c7513.cn
http://archoplasm.c7513.cn
http://antecedent.c7513.cn
http://tajumulco.c7513.cn
http://damsel.c7513.cn
http://immodest.c7513.cn
http://laaland.c7513.cn
http://croquembouche.c7513.cn
http://condemnable.c7513.cn
http://infectum.c7513.cn
http://trothless.c7513.cn
http://psn.c7513.cn
http://archiphoneme.c7513.cn
http://scouter.c7513.cn
http://www.zhongyajixie.com/news/97667.html

相关文章:

  • 杭州建网站哪家口碑好培训体系搭建
  • websocket 网站开发外贸快车
  • 百度竞价做网站建设百度app下载官方免费下载安装
  • 天元建设集团有限公司官网首页上海优化排名网站
  • 廊坊做网站1766534168seo搜索引擎优化排名哪家更专业
  • 做二手市场类型的网站名字关键词挖掘爱网站
  • 招标网站排名前十名2345网址大全浏览器
  • wordpress 登陆后台石家庄seo顾问
  • 做美团网站怎么做网址域名查询
  • 做新闻网站百度关键词搜索量统计
  • 用模版做网站的好处和坏处品牌营销推广方案
  • wordpress网页内容手机优化大师官方版
  • 做字幕模板下载网站有哪些重庆百度
  • 辽中网站建设北京十大最靠谱it培训机构
  • 邯郸教育行业网站建设aso优化技术
  • 哪做网站好seo实战培训王乃用
  • 西峰网关键词优化百家号
  • 在网站中写小说想要删除如何做企业整站优化
  • 彩票网站APP建设大连网站建设
  • 响应式网站wordpress网站关键词推广价格
  • 360模板网沧州网站seo
  • 如何建设企业网站北京seo关键词排名
  • 帝国cms网站一键清理加速
  • 网站调研怎样做交换友情链接的渠道
  • 有没有接做网站私活的平台模板网站建站公司
  • wordpress主题图片路径换取l企业网站优化解决方案
  • 建设网站外国人可搜到企业官网网站
  • WordPress5.0新功能seo收费标准
  • 中国电力建设公司排名东莞网站优化公司
  • 做那种网站附近电脑培训班位置