Methods to check whether arguments are scalar
parent
9d9614d185
commit
5987f78be3
|
@ -44,6 +44,12 @@ string Argument::matlabClass(const string& delim) const {
|
||||||
return result + type;
|
return result + type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
bool Argument::isScalar() const {
|
||||||
|
return (type == "bool" || type == "char" || type == "unsigned char"
|
||||||
|
|| type == "int" || type == "size_t" || type == "double");
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void Argument::matlab_unwrap(FileWriter& file, const string& matlabName) const {
|
void Argument::matlab_unwrap(FileWriter& file, const string& matlabName) const {
|
||||||
file.oss << " ";
|
file.oss << " ";
|
||||||
|
@ -127,6 +133,13 @@ string ArgumentList::names() const {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
bool ArgumentList::allScalar() const {
|
||||||
|
BOOST_FOREACH(Argument arg, *this)
|
||||||
|
if (!arg.isScalar()) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void ArgumentList::matlab_unwrap(FileWriter& file, int start) const {
|
void ArgumentList::matlab_unwrap(FileWriter& file, int start) const {
|
||||||
int index = start;
|
int index = start;
|
||||||
|
|
|
@ -41,6 +41,9 @@ struct Argument {
|
||||||
/// return MATLAB class for use in isa(x,class)
|
/// return MATLAB class for use in isa(x,class)
|
||||||
std::string matlabClass(const std::string& delim = "") const;
|
std::string matlabClass(const std::string& delim = "") const;
|
||||||
|
|
||||||
|
/// Check if will be unwrapped using scalar login in wrap/matlab.h
|
||||||
|
bool isScalar() const;
|
||||||
|
|
||||||
/// adds namespaces to type
|
/// adds namespaces to type
|
||||||
std::string qualifiedType(const std::string& delim = "") const;
|
std::string qualifiedType(const std::string& delim = "") const;
|
||||||
|
|
||||||
|
@ -60,6 +63,9 @@ struct ArgumentList: public std::vector<Argument> {
|
||||||
/// create a comma-separated string listing all argument names, used in m-files
|
/// create a comma-separated string listing all argument names, used in m-files
|
||||||
std::string names() const;
|
std::string names() const;
|
||||||
|
|
||||||
|
/// Check if all arguments scalar
|
||||||
|
bool allScalar() const;
|
||||||
|
|
||||||
// MATLAB code generation:
|
// MATLAB code generation:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue