当前位置: 首页>>代码示例>>C++>>正文


C++ DynamicArray::get方法代码示例

本文整理汇总了C++中DynamicArray::get方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicArray::get方法的具体用法?C++ DynamicArray::get怎么用?C++ DynamicArray::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DynamicArray的用法示例。


在下文中一共展示了DynamicArray::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: serializeDynamicArray

 inline void serializeDynamicArray(
     RCF::TrueType *,
     Archive &ar,
     DynamicArray<T,N> &da)
 {
     if (ar.isRead())
     {
         I_Encoding &e = ar.getIstream()->getEncoding();
         DataPtr data;
         bool bRet = ar.getIstream()->get( data );
         if (bRet)
         {
             UInt32 nCount = e.getCount( data , (T *) NULL);
             da.get() = new T[ nCount ];
             da.length() = nCount;
             e.toObject(data, da.get(), nCount );
         }
     }
     else if (ar.isWrite())
     {
         if (da.length() > 0)
         {
             I_Encoding &e = ar.getOstream()->getEncoding();
             DataPtr data;
             e.toData(data, da.get(), da.length() );
             ar.getOstream()->put(data);
         }
     }
 }
开发者ID:rajkosto,项目名称:deps-rcf,代码行数:29,代码来源:SerializeDynamicArray.hpp

示例2: road

std::vector<Road> Algorithm::findShortestPath(MultiGraph<double, Station>* graph, Station* start, Station* end ,double &lenght)
{
	DynamicArray<Station> *stations = graph->getVertexs();
	std::vector<Road> result;
	if (stations->getIndex(start) != -1 && stations->getIndex(end) != -1)
	{
		DynamicArray<Station> *vertexs = graph->getVertexs();

		int size = vertexs->getSize();
		double* arr = new double[size*size];

		Graph g;
		g.resize(size);

		for (int i = 0; i < size; i++)
		{
			Station*startTemp= vertexs->get(i);
			for (int j = 0; j < size; j++)
			{
				Station*endTemp = vertexs->get(j);

				DynamicArray<double>* values = graph->getLenghtsByStation(startTemp, endTemp);
				if (values != 0 && values->getSize() > 0)
				{
					double value = Algorithm::findMin(values);
					arr[j*size + i] = value;
					g[i].push_back(std::make_pair(j, value));
				}
			}
		}
		std::vector<int> path;
		
		int startIndex = vertexs->getIndex(start);
		int endIndex = vertexs->getIndex(end);

		dijkstra(g, startIndex, endIndex, path);
		double sum = 0;
		for (int i = path.size() - 1; i >= 0; i--)
		{
			if (i - 1 >= 0)
			{
				Station * resultStart = vertexs->get(path[i]);
				Station * resultEnd = vertexs->get(path[i - 1]);
				Road road(resultStart, resultEnd);
				result.push_back(road);
				sum += arr[path[i - 1] * size + path[i]];
			}
			//std::cout << path[i] << "->";
		}
		//cout << "\n";
		//cout << sum;
		lenght = sum;
		delete[] arr;
	}
	
	return result;
}
开发者ID:ugolova,项目名称:geolocation,代码行数:57,代码来源:algorithm.cpp

示例3: setToSize

DynamicArray<T,chrunkSize>::DynamicArray(DynamicArray<T,chrunkSize> &other):items(0)
{
    setToSize(other.length());

    for(size_t i = 0; i < other.length(); i++)
        set(i, other.get(i));
}
开发者ID:enjoythelive1,项目名称:memory-manage,代码行数:7,代码来源:DynamicArray.cpp

示例4: clear

DynamicArray<T,chrunkSize> DLL_EXPORT DynamicArray<T,chrunkSize>::operator =(DynamicArray<T,chrunkSize> &other)
{
    clear();

    setToSize(other.length());

    for(size_t i = 0; i < other.length(); i++)
        set(i, other.get(i));
}
开发者ID:enjoythelive1,项目名称:memory-manage,代码行数:9,代码来源:DynamicArray.cpp

示例5: get

Building* BuildingFactory::get(std::string type, unsigned int corner1X, unsigned int corner1Y, unsigned int teamNum)
{
	unsigned int i;
	tBuildingInfo* info = *buildingInfos->get(type);
	BuildingFunction* function = NULL;
	if(type.compare("grandhall") == 0)
		function = new GrandHallFunction(corner1X + 2, corner1Y - 1, info->behavioralConfig);
	else if(type.compare("blacksmith") == 0)
		function = new BlacksmithFunction(info->behavioralConfig);
	else if(type.compare("apothecary") == 0)
		function = new ApothecaryFunction(info->behavioralConfig);
	Building* building = new Building(type, corner1X, corner1Y, teamNum, info->behavioralConfig, function);
	DynamicArray<SceneNode*>* nodes = building->getSceneNodes();
	for(i = 0; i < nodes->length(); i++)
	{
		SceneManager::getInstance()->addSceneNode(*nodes->get(i));
	}
	return building;
}
开发者ID:jgardella,项目名称:CS585,代码行数:19,代码来源:buildingfactory.cpp


注:本文中的DynamicArray::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。