Vector Management Code Snippet

This code snippet shows how to create a vector, fill it and retrieve the value of a given element.

C++

#include <eVision/Easy/EBW8Vector.h>
using namespace eVision;
// EBW8Vector constructor
EBW8Vector ramp;
// Clear the vector
ramp.Empty();
// Fill the vector with increasing values
for (int i = 0; i < 128; i++)
{
  ramp.AddElement((EBW8)i);
}
// Retrieve the 10th element value
EBW8 value = ramp[9];

C#

using eVision;
// EBW8Vector constructor
EBW8Vector ramp = new EBW8Vector();
EBW8 bw8 = new EBW8();
// Clear the vector
ramp.Empty();
// Fill the vector with increasing values
for (int i = 0; i < 128; i++)
{
  bw8.Value = (byte)i;
  ramp.AddElement(bw8);
}
// Retrieve the 10th element value
EBW8 value = ramp.GetElement(9);

Python

import eVision
# EBW8Vector constructor
ramp = eVision.EBW8Vector()
bw8 = eVision.EBW8()
# Clear the vector
ramp.Empty()
# Fill the vector with increasing values
for i in range(128):
    bw8.Value = i
    ramp.AddElement(bw8)
# Retrieve the 10th element value
value = ramp.GetElement(9)