本文整理汇总了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);
}
}
}
示例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;
}
示例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));
}
示例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));
}
示例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;
}