本文整理汇总了C++中MyVector类的典型用法代码示例。如果您正苦于以下问题:C++ MyVector类的具体用法?C++ MyVector怎么用?C++ MyVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MyVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ()
{
//Remove shared memory on construction and destruction
struct shm_remove
{
//<-
#if 1
shm_remove() { shared_memory_object::remove(test::get_process_id_name()); }
~shm_remove(){ shared_memory_object::remove(test::get_process_id_name()); }
#else
//->
shm_remove() { shared_memory_object::remove("MySharedMemory"); }
~shm_remove(){ shared_memory_object::remove("MySharedMemory"); }
//<-
#endif
//->
} remover;
//<-
#if 1
managed_shared_memory segment(
create_only,
test::get_process_id_name(), //segment name
65536); //segment size in bytes
#else
//->
managed_shared_memory segment(
create_only,
"MySharedMemory", //segment name
65536); //segment size in bytes
//<-
#endif
//->
//Construct shared memory vector
MyVector *myvector =
segment.construct<MyVector>("MyVector")
(IntAllocator(segment.get_segment_manager()));
//Fill vector
myvector->reserve(100);
for(int i = 0; i < 100; ++i){
myvector->push_back(i);
}
//Create the vectorstream. To create the internal shared memory
//basic_string we need to pass the shared memory allocator as
//a constructor argument
MyVectorStream myvectorstream(CharAllocator(segment.get_segment_manager()));
//Reserve the internal string
myvectorstream.reserve(100*5);
//Write all vector elements as text in the internal string
//Data will be directly written in shared memory, because
//internal string's allocator is a shared memory allocator
for(std::size_t i = 0, max = myvector->size(); i < max; ++i){
myvectorstream << (*myvector)[i] << std::endl;
}
//Auxiliary vector to compare original data
MyVector *myvector2 =
segment.construct<MyVector>("MyVector2")
(IntAllocator(segment.get_segment_manager()));
//Avoid reallocations
myvector2->reserve(100);
//Extract all values from the internal
//string directly to a shared memory vector.
std::istream_iterator<int> it(myvectorstream), itend;
std::copy(it, itend, std::back_inserter(*myvector2));
//Compare vectors
assert(std::equal(myvector->begin(), myvector->end(), myvector2->begin()));
//Create a copy of the internal string
MyString stringcopy (myvectorstream.vector());
//Now we create a new empty shared memory string...
MyString *mystring =
segment.construct<MyString>("MyString")
(CharAllocator(segment.get_segment_manager()));
//...and we swap vectorstream's internal string
//with the new one: after this statement mystring
//will be the owner of the formatted data.
//No reallocations, no data copies
myvectorstream.swap_vector(*mystring);
//Let's compare both strings
assert(stringcopy == *mystring);
//Done, destroy and delete vectors and string from the segment
segment.destroy_ptr(myvector2);
segment.destroy_ptr(myvector);
segment.destroy_ptr(mystring);
return 0;
}
示例2: main
int main()
{
// Create a default vector
MyVector sam;
// push some data into sam
cout << "\nPushing three values into sam";
sam.push_back(TEST_VALUE1);
sam.push_back(TEST_VALUE2);
sam.push_back(TEST_VALUE3);
cout << "\nThe values in sam are: ";
// test for out of bounds condition here
// and test exception
for (int i = 0; i < sam.size() + 1; i++)
{
try
{
cout << sam.at(i) << " ";
}
catch (int badIndex)
{
cout << "\nOut of bounds at index " << badIndex << endl;
}
}
cout << "\n--------------\n";
// clear sam and display its size and capacity
sam.clear();
cout << "\nsam has been cleared.";
cout << "\nSam's size is now " << sam.size();
cout << "\nSam's capacity is now " << sam.capacity() << endl;
cout << "---------------\n";
// Push 12 values into the vector - it should grow
cout << "\nPush 12 values into sam.";
for (int i = 0; i < MAX; i++)
sam.push_back(i);
cout << "\nSam's size is now " << sam.size();
cout << "\nSam's capcacity is now " << sam.capacity() << endl;
cout << "---------------\n";
cout << "\nTest to see if contents are correct...";
// display the values in the vector
for (int i = 0; i < sam.size(); i++)
{
cout << sam.at(i) << " ";
}
cout << "\n--------------\n";
cout << "\n\nTest Complete...";
cout << endl;
system("PAUSE");
return 0;
}
示例3: main
//Main function. For parent process argc == 1, for child process argc == 2
int main(int argc, char *argv[])
{
if(argc == 1){ //Parent process
//Remove shared memory on construction and destruction
struct shm_remove
{
//<-
#if 1
shm_remove() { shared_memory_object::remove(test::get_process_id_name()); }
~shm_remove(){ shared_memory_object::remove(test::get_process_id_name()); }
#else
//->
shm_remove() { shared_memory_object::remove("MySharedMemory"); }
~shm_remove(){ shared_memory_object::remove("MySharedMemory"); }
//<-
#endif
//->
} remover;
//<-
(void)remover;
//->
//Create a new segment with given name and size
//<-
#if 1
managed_shared_memory segment(create_only, test::get_process_id_name(), 65536);
#else
//->
managed_shared_memory segment(create_only, "MySharedMemory", 65536);
//<-
#endif
//->
//Initialize shared memory STL-compatible allocator
const ShmemAllocator alloc_inst (segment.get_segment_manager());
//Construct a vector named "MyVector" in shared memory with argument alloc_inst
MyVector *myvector = segment.construct<MyVector>("MyVector")(alloc_inst);
for(int i = 0; i < 100; ++i) //Insert data in the vector
myvector->push_back(i);
//Launch child process
std::string s(argv[0]); s += " child ";
//<-
s += test::get_process_id_name();
//->
if(0 != std::system(s.c_str()))
return 1;
//Check child has destroyed the vector
if(segment.find<MyVector>("MyVector").first)
return 1;
}
else{ //Child process
//Open the managed segment
//<-
#if 1
managed_shared_memory segment(open_only, argv[2]);
#else
//->
managed_shared_memory segment(open_only, "MySharedMemory");
//<-
#endif
//->
//Find the vector using the c-string name
MyVector *myvector = segment.find<MyVector>("MyVector").first;
//Use vector in reverse order
std::sort(myvector->rbegin(), myvector->rend());
//When done, destroy the vector from the segment
segment.destroy<MyVector>("MyVector");
}
return 0;
};
示例4: main
int main() {
const std::string Help =
"-------------------------------------------------------------------------\n"
"TestComputeAKV: \n"
"-------------------------------------------------------------------------\n"
"OPTIONS: \n"
"Nth=<int> theta resolution [default 3] \n"
"Nph=<int> phi resolution [default 4] \n"
"Radius=<double> radius of sphere. [default 1.0] \n"
"AKVGuess=MyVector<double> a guess for the values of THETA, thetap, phip \n"
" [default (0.,0.,0.)] \n"
"L_resid_tol=<double> tolerance for L residuals when finding approximate \n"
" Killing vectors. [default 1.e-12] \n"
"v_resid_tol=<double> tolerance for v residuals when finding approximate \n"
" Killing vectors. [default 1.e-12] \n"
"min_thetap = for values less than this, thetap is considered close to \n"
" zero. [default 1.e-5] \n"
"symmetry_tol=<double> abs(THETA) must be less than this value to be \n"
" considered an exact symmetry. [default 1.e-11] \n"
"ResidualSize=<double> determines the tolerance for residuals from the \n"
" multidimensional root finder. [default to 1.e-11] \n"
"Solver = <std::string> which gsl multidimensional root finding algorith \n"
" should be used. [default Newton] \n"
"Verbose=<bool> Print spectral coefficients and warnings if true \n"
" [default false] \n"
;
std::string Options = ReadFileIntoString("Test.input");
OptionParser op(Options,Help);
const int Nth = op.Get<int>("Nth", 3);
const int Nph = op.Get<int>("Nph", 4);
const double rad = op.Get<double>("Radius",1.0);
MyVector<double> AKVGuess =
op.Get<MyVector<double> >("AKVGuess",MyVector<double>(MV::Size(3),0.0));
//must be three-dimensional
REQUIRE(AKVGuess.Size()==3,"AKVGuess has Size " << AKVGuess.Size()
<< ", should be 3.");
const double L_resid_tol = op.Get<double>("L_resid_tol", 1.e-12);
const double v_resid_tol = op.Get<double>("L_resid_tol", 1.e-12);
const double residualSize = op.Get<double>("ResidualSize", 1.e-11);
const double min_thetap = op.Get<double>("min_theta",1.e-5);
const double symmetry_tol = op.Get<double>("symmetry_tol",1.e-11);
const std::string solver = op.Get<std::string>("Solver","Newton");
const bool verbose = op.Get<bool>("Verbose", false);
const MyVector<bool> printDiagnostic = MyVector<bool>(MV::Size(6), true);
//create skm
const StrahlkorperMesh skm(Nth, Nph);
//create surface basis
const SurfaceBasis sb(skm);
//get theta, phi
const DataMesh theta(skm.SurfaceCoords()(0));
const DataMesh phi(skm.SurfaceCoords()(1));
//set the initial guesses to be along particular axes
const int axes = 3; //the number of perpendicular axes
//create conformal factors for every rotation
const int syms = 5; //the number of axisymmetries we are testing
for(int s=4; s<5; s++) { //index over conformal factor symmetries
//for(int s=0; s<syms; s++){//index over conformal factor symmetries
//create conformal factor
const DataMesh Psi = ConstructConformalFactor(theta, phi, s);
//set the initial guesses
double THETA[3] = {AKVGuess[0],0.,0.};
double thetap[3] = {AKVGuess[1],0.,0.};
double phip[3] = {AKVGuess[2],0.,0.};
//save the v, xi solutions along particular axes
MyVector<DataMesh> v(MV::Size(3),DataMesh::Empty);
MyVector<DataMesh> rotated_v(MV::Size(3),DataMesh::Empty);
MyVector<Tensor<DataMesh> > xi(MV::Size(axes),Tensor<DataMesh>(2,"1",DataMesh::Empty));
//save the <v_i|v_j> inner product solutions
double v0v0 = 0.;
double v1v1 = 0.;
double v2v2 = 0.;
double v0v1 = 0.;
double v0v2 = 0.;
double v1v2 = 0.;
//int symmetries[3] = 0; //counts the number of symmetries
//compute some useful quantities
const DataMesh rp2 = rad * Psi * Psi;
const DataMesh r2p4 = rp2*rp2;
const DataMesh llncf = sb.ScalarLaplacian(log(Psi));
const DataMesh Ricci = 2.0 * (1.0-2.0*llncf) / r2p4;
const Tensor<DataMesh> GradRicci = sb.Gradient(Ricci);
for(int a=0; a<axes; a++) { //index over perpendicular axes to find AKV solutions
//if the diagnostics below decide that there is a bad solution for v[a]
//(usually a repeated solution), this flag will indicate that the
//solver should be run again
bool badAKVSolution = false;
//generate a guess for the next axis of symmetry based on prior solutions.
//.........这里部分代码省略.........
示例5: count64
uint64_t count64() {
MessageHandler mh;
mh.begin("counting") << " paths of " << typenameof(spec);
std::vector<Word> tmp(stateWords + 1);
Word* ptmp = tmp.data();
int const n = spec.get_root(state(ptmp));
if (n <= 0) {
mh << " ...";
mh.end(0);
return (n == 0) ? 0 : 1;
}
mh << "\n";
uint64_t total = 0;
size_t maxWidth = 0;
//std::cerr << "\nLevel,Width\n";
std::vector<MemoryPool> pools(n + 1);
MyVector<MyList<Word> > vnodeTable(n + 1);
MyVector<UniqTable> uniqTable;
uniqTable.reserve(n + 1);
for (int i = 0; i <= n; ++i) {
uniqTable.push_back(UniqTable(hasher, hasher));
}
Word* p0 = vnodeTable[n].alloc_front(stateWords + 1);
spec.get_copy(state(p0), state(ptmp));
spec.destruct(state(ptmp));
number64(p0) = 1;
for (int i = n; i > 0; --i) {
MyList<Word>& vnodes = vnodeTable[i];
size_t m = vnodes.size();
//std::cerr << i << "," << m << "\n";
maxWidth = std::max(maxWidth, m);
MyList<Word>& nextVnodes = vnodeTable[i - 1];
UniqTable& nextUniq = uniqTable[i - 1];
Word* pp = nextVnodes.alloc_front(stateWords + 1);
//if (nextUniq.size() < m) nextUniq.rehash(m);
for (; !vnodes.empty(); vnodes.pop_front()) {
Word* p = vnodes.front();
if (number64(p) == 0) {
spec.destruct(state(p));
continue;
}
for (int b = 0; b <= 1; ++b) {
spec.get_copy(state(pp), state(p));
int ii = spec.get_child(state(pp), i, b);
if (ii <= 0) {
spec.destruct(state(pp));
if (ii != 0) {
total += number64(p);
}
}
else if (ii < i - 1) {
Word* qq = vnodeTable[ii].alloc_front(stateWords + 1);
spec.get_copy(state(qq), state(pp));
spec.destruct(state(pp));
Word* qqq = uniqTable[ii].add(qq);
if (qqq == qq) {
number64(qqq) = number64(p);
}
else {
spec.destruct(state(qq));
number64(qqq) += number64(p);
vnodeTable[ii].pop_front();
}
}
else {
assert(ii == i - 1);
Word* ppp = nextUniq.add(pp);
if (ppp == pp) {
number64(ppp) = number64(p);
pp = nextVnodes.alloc_front(stateWords + 1);
}
else {
spec.destruct(state(pp));
number64(ppp) += number64(p);
}
}
}
spec.destruct(state(p));
}
nextVnodes.pop_front();
nextUniq.clear();
pools[i].clear();
spec.destructLevel(i);
mh << ".";
}
//.........这里部分代码省略.........
示例6: count
std::string count() {
MessageHandler mh;
mh.begin("counting") << " paths of " << typenameof(spec);
std::vector<Word> tmp(stateWords + 1);
Word* ptmp = tmp.data();
int const n = spec.get_root(state(ptmp));
if (n <= 0) {
mh << " ...";
mh.end(0);
return (n == 0) ? "0" : "1";
}
uint64_t totalStorage[n / 63 + 1];
BigNumber total(totalStorage);
total.store(0);
size_t maxWidth = 0;
//std::cerr << "\nLevel,Width\n";
std::vector<MemoryPool> pools(n + 1);
MyVector<MyList<Word> > vnodeTable(n + 1);
MyVector<UniqTable> uniqTable;
uniqTable.reserve(n + 1);
for (int i = 0; i <= n; ++i) {
uniqTable.push_back(UniqTable(hasher, hasher));
}
int numberWords = 1;
Word* p0 = vnodeTable[n].alloc_front(stateWords + 1);
spec.get_copy(state(p0), state(ptmp));
spec.destruct(state(ptmp));
number(p0).store(1);
mh.setSteps(n);
for (int i = n; i > 0; --i) {
MyList<Word>& vnodes = vnodeTable[i];
size_t m = vnodes.size();
//std::cerr << i << "," << m << "\n";
maxWidth = std::max(maxWidth, m);
MyList<Word>& nextVnodes = vnodeTable[i - 1];
UniqTable& nextUniq = uniqTable[i - 1];
int const nextWords = stateWords + numberWords + 1;
Word* pp = nextVnodes.alloc_front(nextWords);
//if (nextUniq.size() < m) nextUniq.rehash(m);
for (; !vnodes.empty(); vnodes.pop_front()) {
Word* p = vnodes.front();
if (number(p).equals(0)) {
spec.destruct(state(p));
continue;
}
for (int b = 0; b <= 1; ++b) {
spec.get_copy(state(pp), state(p));
int ii = spec.get_child(state(pp), i, b);
if (ii <= 0) {
spec.destruct(state(pp));
if (ii != 0) {
total.add(number(p));
}
}
else if (ii < i - 1) {
Word* qq = vnodeTable[ii].alloc_front(
nextWords + (i - ii) / 63);
spec.get_copy(state(qq), state(pp));
spec.destruct(state(pp));
Word* qqq = uniqTable[ii].add(qq);
if (qqq == qq) {
number(qqq).store(number(p));
}
else {
spec.destruct(state(qq));
int w = number(qqq).add(number(p));
if (numberWords < w) {
numberWords = w; //FIXME might be broken at long skip
}
vnodeTable[ii].pop_front();
}
}
else {
assert(ii == i - 1);
Word* ppp = nextUniq.add(pp);
if (ppp == pp) {
number(ppp).store(number(p));
pp = nextVnodes.alloc_front(nextWords);
}
else {
spec.destruct(state(pp));
int w = number(ppp).add(number(p));
if (numberWords < w) {
numberWords = w; //FIXME might be broken at long skip
}
}
}
//.........这里部分代码省略.........
示例7: DrawMissiles
void DrawMissiles(vector<missile*> missiles, myVertex* terrainVertex, Spiders* spiders){
vector<missile*>::iterator it;
vector<int> needToExit;
int i = 0, j = 0;
float tmpSize;
for (it = missiles.begin(); it != missiles.end(); it++){
if ((*it)->needToExit()){
continue;
}
float terrainY = getYFromXZ ((*it)->getX(), (*it)->getZ(), terrainVertex);
if ((*it)->isColliding(terrainY)){
//Utilize "explode XX.tga"
if (explodeModeFlag){
if (!(*it)->tgaNeedToExit()){
(*it)->tgaExplode();
}
else{
needToExit.push_back(i);
}
}
//Utilize "fire1.bmp"
else{
if (!(*it)->needToExit()){
(*it)->explode();
}
else{
needToExit.push_back(i);
}
}
tmpSize = 0;
MyVector tmpPos = MyVectorBuilder::createMyVectorBuilder()
.withX((*it)->getX())
.withY(0)
.withZ((*it)->getZ())
.build();
if ((*it)->getExplodeFrame() == 2){
for (j = 0; j<(int)spiders->getSpiderList().size();j++){
tmpSize = spiders->getSpiderList().at(i).getSize();
if (abs((*it)->getX() - spiders->getSpiderList().at(j).getPosition().getX()) > tmpSize + 20){
continue;
}
if (abs((*it)->getZ() - spiders->getSpiderList().at(j).getPosition().getZ()) > tmpSize + 20){
continue;
}
if (tmpPos.distance(spiders->getSpiderList().at(j).getPosition()) < tmpSize + 20){
spiders->die(j, 1);
}
}
}
}
else{
(*it)->drawMissile();
(*it)->forward();
}
i++;
}
//clear missiles that already exit
//sort (needToExit.begin(), needToExit.end(), myfunction);
//for (i = 0; i < needToExit.size(); i++){
// missiles.erase(missiles.begin()+needToExit.at(i)-i);
//}
//needToExit.clear();
}
示例8: TestBasics
// This tests basic segmented vector construction and iteration.
void TestBasics()
{
// A SegmentedVector with a POD element type.
typedef SegmentedVector<int, 1024, InfallibleAllocPolicy> MyVector;
MyVector v;
int i, n;
MOZ_RELEASE_ASSERT(v.IsEmpty());
// Add 100 elements, then check various things.
i = 0;
for ( ; i < 100; i++) {
gDummy = v.Append(mozilla::Move(i));
}
MOZ_RELEASE_ASSERT(!v.IsEmpty());
MOZ_RELEASE_ASSERT(v.Length() == 100);
n = 0;
for (auto iter = v.Iter(); !iter.Done(); iter.Next()) {
MOZ_RELEASE_ASSERT(iter.Get() == n);
n++;
}
MOZ_RELEASE_ASSERT(n == 100);
// Add another 900 elements, then re-check.
for ( ; i < 1000; i++) {
v.InfallibleAppend(mozilla::Move(i));
}
MOZ_RELEASE_ASSERT(!v.IsEmpty());
MOZ_RELEASE_ASSERT(v.Length() == 1000);
n = 0;
for (auto iter = v.Iter(); !iter.Done(); iter.Next()) {
MOZ_RELEASE_ASSERT(iter.Get() == n);
n++;
}
MOZ_RELEASE_ASSERT(n == 1000);
// Pop off all of the elements.
MOZ_RELEASE_ASSERT(v.Length() == 1000);
for (int len = (int)v.Length(); len > 0; len--) {
MOZ_RELEASE_ASSERT(v.GetLast() == len - 1);
v.PopLast();
}
MOZ_RELEASE_ASSERT(v.IsEmpty());
MOZ_RELEASE_ASSERT(v.Length() == 0);
// Fill the vector up again to prepare for the clear.
for (i = 0; i < 1000; i++) {
v.InfallibleAppend(mozilla::Move(i));
}
MOZ_RELEASE_ASSERT(!v.IsEmpty());
MOZ_RELEASE_ASSERT(v.Length() == 1000);
v.Clear();
MOZ_RELEASE_ASSERT(v.IsEmpty());
MOZ_RELEASE_ASSERT(v.Length() == 0);
}
示例9:
// no need for origin but here to remind that this will give X and Y offset to the point from
// the same center used as polar origin
// <!> have to make it consistent with (i,j) orientation (computer graphics window basis orientation) <!>
MyVector <float> Util::fromPolarToCartesian(MyVector <float> origin, MyVector <float> v)
{
return MyVector <float> (v.getX() * std::cos(v.getY()), v.getX() * std::sin(v.getY()));
}
示例10: norm
float Util::norm(MyVector <float> v1, MyVector <float> v2)
{
return norm(v1.getX(), v1.getY(), v2.getX(), v2.getY());
}
示例11: RenderSpan
/**********************************************************
*
* RenderSpan
*
* parameters IN:
* int y
* EdgeBox ** edgeBox1
* EdgeBox ** edgeBox2
*
*********************************************************/
void RenderSpan (int y, EdgeBox ** edgeBox1, EdgeBox ** edgeBox2)
{
EdgeBox * tempEdgeBox;
int x, z;
double dz, di;
MyVector dw;
if ((*edgeBox1)->x > (*edgeBox2)->x) {
tempEdgeBox = *edgeBox1;
*edgeBox1 = *edgeBox2;
*edgeBox2 = tempEdgeBox;
}
int x1 = (int)(*edgeBox1)->x;
int x2 = (int)(*edgeBox2)->x;
if (x1 != x2) {
int dx = x2 - x1;
double currZ = (*edgeBox1)->z;
double currI = (*edgeBox1)->i;
MyVector currW = (*edgeBox1)->w;
dz = ((*edgeBox2)->z - currZ) / dx;
di = ((*edgeBox2)->i - currI) / dx;
dw.SetX( ((*edgeBox2)->w.GetX() - currW.GetX()) / dx);
dw.SetY( ((*edgeBox2)->w.GetY() - currW.GetY()) / dx);
dw.SetZ( ((*edgeBox2)->w.GetZ() - currW.GetZ()) / dx);
for (x = x1; x <= x2 - 1; x++) {
z = (int)currZ;
if (z < zBufferAt[x][y]) {
zBufferAt[x][y] = z;
RenderPixel (x, y, currI, currW);
}
currZ += dz;
currI += di;
currW.SetX( currW.GetX() + dw.GetX());
currW.SetY( currW.GetY() + dw.GetY());
currW.SetZ( currW.GetZ() + dw.GetZ());
}
}
}
示例12: AddEdgeToList
/**********************************************************
*
* AddEdgeToList
*
* parameters IN:
* VertexCell * vertex1
* VertexCell * vertex2
*
*********************************************************/
void AddEdgeToList (VertexCell * vertex1, VertexCell * vertex2)
{
VertexCell * tempVertex;
MyVector dw;
EdgeBox * edgeBox;
if (vertex1->screenPos.GetY() > vertex2->screenPos.GetY()) {
tempVertex = vertex1;
vertex1 = vertex2;
vertex2 = tempVertex;
}
int y1 = vertex1->screenPos.GetY();
int y2 = vertex2->screenPos.GetY();
if (y1 != y2) {
int dy = y2 - y1;
double currX = vertex1->screenPos.GetX();
double currZ = vertex1->screenPos.GetZ();
double currI = lightVector.DotProduct (vertex1->vertexNormal);
MyVector currW = vertex1->worldPos;
double dx = (vertex2->screenPos.GetX() - currX) / dy;
double dz = (vertex2->screenPos.GetZ() - currZ) / dy;
double di = (lightVector.DotProduct (vertex2->vertexNormal) - currI) / dy;
dw.SetX( (vertex2->worldPos.GetX() - currW.GetX()) / dy);
dw.SetY( (vertex2->worldPos.GetY() - currW.GetY()) / dy);
dw.SetZ( (vertex2->worldPos.GetZ() - currW.GetZ()) / dy);
for (int y = y1; y <= y2 - 1; y++) {
edgeBox = new EdgeBox;
edgeBox->x = currX;
edgeBox->z = (int)currZ;
edgeBox->i = currI;
edgeBox->w = currW;
edgeBox->next = edgeListAt[y];
edgeListAt[y] = edgeBox;
currX += dx;
currZ += dz;
currI += di;
currW.SetX( currW.GetX() + dw.GetX());
currW.SetY( currW.GetY() + dw.GetY());
currW.SetZ( currW.GetZ() + dw.GetZ());
}
}
}
示例13: setNumRows
/**
* Resizes the table rows.
* @param n the number of rows.
*/
void setNumRows(int n) {
table.resize(n);
}
示例14: init
/**
* Clears and initializes the table.
* @param n the number of rows.
*/
void init(int n = 0) {
table.clear();
table.resize(n);
}
示例15: numRows
/**
* Gets the number of rows.
* @return the number of rows.
*/
int numRows() const {
return table.size();
}