Scilab: rollback, support of container<class*> only (not <class>)
This commit is contained in:
parent
077e69a851
commit
255603639f
6 changed files with 11 additions and 77 deletions
|
|
@ -75,34 +75,6 @@ std::vector<bool> concat_bool_vector(const std::vector<bool> vector, const std::
|
|||
return concat_vector<bool>(vector, other_vector);
|
||||
}
|
||||
|
||||
// object vectors
|
||||
|
||||
std::vector<classA> create_classA_vector(const int size, const int value)
|
||||
{
|
||||
std::vector<classA> out_vector;
|
||||
for (int i=0; i<size; i++)
|
||||
{
|
||||
classA objA(value);
|
||||
out_vector.push_back(objA);
|
||||
}
|
||||
return out_vector;
|
||||
}
|
||||
|
||||
void print_classA_vector(const std::vector<classA>& vector)
|
||||
{
|
||||
std::vector<classA>::const_iterator it;
|
||||
std::cout << std::endl;
|
||||
for (it = vector.begin(); it != vector.end(); ++it)
|
||||
{
|
||||
std::cout << "<classA a:" << it->a << ">" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<classA> concat_classA_vector(const std::vector<classA> vector, const std::vector<classA> other_vector)
|
||||
{
|
||||
return concat_vector<classA>(vector, other_vector);
|
||||
}
|
||||
|
||||
// pointer (on objects) vectors
|
||||
|
||||
std::vector<classA*> create_classAPtr_vector(const int size, const int value)
|
||||
|
|
|
|||
|
|
@ -22,23 +22,16 @@ std::vector<std::string> concat_string_vector(const std::vector<std::string> vec
|
|||
std::vector<bool> create_bool_vector(const int size, const bool value);
|
||||
std::vector<bool> concat_bool_vector(const std::vector<bool> vector, const std::vector<bool> other_vector);
|
||||
|
||||
|
||||
// pointer (on object) vectors
|
||||
class classA
|
||||
{
|
||||
public:
|
||||
classA() : a(0) {}
|
||||
classA(int _a) : a(_a) {}
|
||||
classA(const classA& c) : a(c.a) {}
|
||||
int a;
|
||||
};
|
||||
|
||||
// object vectors
|
||||
|
||||
std::vector<classA> create_classA_vector(const int size, const int value);
|
||||
void print_classA_vector(const std::vector<classA>& pvector);
|
||||
std::vector<classA> concat_classA_vector(const std::vector<classA> vector, const std::vector<classA> other_vector);
|
||||
|
||||
// pointer (on objects) vectors
|
||||
|
||||
std::vector<classA*> create_classAPtr_vector(const int size, const int value);
|
||||
void print_classAPtr_vector(const std::vector<classA*>& pvector);
|
||||
std::vector<classA*> concat_classAPtr_vector(const std::vector<classA*> vector, const std::vector<classA*> other_vector);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace std
|
|||
%template(DoubleVector) vector<double>;
|
||||
%template(StringVector) vector<std::string>;
|
||||
%template(BoolVector) vector<bool>;
|
||||
%template(ClassAVector) vector<classA>;
|
||||
%template(ClassAPtrVector) vector<classA*>;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ SWIG_Init();
|
|||
// This example shows how to use C++ fonctions with STL vectors arguments
|
||||
// Here, STL vectors are converted from/to Scilab matrices (SWIG_SCILAB_EXTRA_NATIVE_CONTAINERS is not defined)
|
||||
|
||||
|
||||
// double vectors
|
||||
|
||||
disp("Example of passing matrices of double as vector arguments of C++ functions.");
|
||||
|
|
@ -55,17 +54,6 @@ disp("concat this vector with the vector of bool {false, false, false} with conc
|
|||
bv3 = concat_bool_vector(bv, bv2);
|
||||
disp(bv3);
|
||||
|
||||
// object vectors
|
||||
|
||||
disp("Example of passing lists of pointer on object as vector of objects arguments of C++ functions.");
|
||||
disp("get a vector of objects {<classA a:1>, <classA a:1>, <classA a:1>} with create_classA_vector():");
|
||||
pv = create_classA_vector(3, 1);
|
||||
print_classA_vector(pv);
|
||||
pv2 = create_classA_vector(2, 5);
|
||||
disp("concat this vector with the vector of objects {<classA a:5>, <classA a:5>} with concat_classA_vector():");
|
||||
pv3 = concat_classA_vector(pv, pv2);
|
||||
print_classA_vector(pv3);
|
||||
|
||||
// pointer (on object) vectors
|
||||
|
||||
disp("Example of passing lists of pointers on object as vector of pointers on objects arguments of C++ functions.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue