2011-12-02 10:32:18 +08:00
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
|
|
|
* Atlanta, Georgia 30332-0415
|
|
|
|
* All Rights Reserved
|
|
|
|
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
|
|
|
|
|
|
|
* See LICENSE for the license information
|
|
|
|
|
|
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file StaticMethod.h
|
|
|
|
* @brief describes and generates code for static methods
|
|
|
|
* @author Frank Dellaert
|
|
|
|
* @author Alex Cunningham
|
2012-07-13 06:28:28 +08:00
|
|
|
* @author Richard Roberts
|
2011-12-02 10:32:18 +08:00
|
|
|
**/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2014-11-14 23:43:53 +08:00
|
|
|
#include "FullyOverloadedFunction.h"
|
2014-05-26 01:22:10 +08:00
|
|
|
|
2011-12-03 00:43:15 +08:00
|
|
|
namespace wrap {
|
|
|
|
|
2011-12-02 10:32:18 +08:00
|
|
|
/// StaticMethod class
|
2014-11-14 23:43:53 +08:00
|
|
|
struct StaticMethod: public FullyOverloadedFunction {
|
2011-12-02 10:32:18 +08:00
|
|
|
|
2014-11-14 00:34:33 +08:00
|
|
|
typedef const std::string& Str;
|
|
|
|
|
2014-11-14 06:21:05 +08:00
|
|
|
virtual bool isStatic() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-11-14 05:43:29 +08:00
|
|
|
// emit a list of comments, one for each overload
|
|
|
|
void comment_fragment(FileWriter& proxyFile) const {
|
2014-11-14 07:51:11 +08:00
|
|
|
SignatureOverloads::comment_fragment(proxyFile, matlabName());
|
2014-11-14 05:43:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void verifyArguments(const std::vector<std::string>& validArgs) const {
|
|
|
|
SignatureOverloads::verifyArguments(validArgs, name_);
|
|
|
|
}
|
|
|
|
|
|
|
|
void verifyReturnTypes(const std::vector<std::string>& validtypes) const {
|
|
|
|
SignatureOverloads::verifyReturnTypes(validtypes, name_);
|
|
|
|
}
|
|
|
|
|
2012-10-02 22:40:07 +08:00
|
|
|
// MATLAB code generation
|
|
|
|
// classPath is class directory, e.g., ../matlab/@Point2
|
|
|
|
void proxy_wrapper_fragments(FileWriter& proxyFile, FileWriter& wrapperFile,
|
2014-11-14 00:34:33 +08:00
|
|
|
Str cppClassName, Str matlabQualName, Str matlabUniqueName,
|
|
|
|
Str wrapperName, const TypeAttributesTable& typeAttributes,
|
2014-05-26 01:29:06 +08:00
|
|
|
std::vector<std::string>& functionNames) const;
|
2011-12-02 10:32:18 +08:00
|
|
|
|
2014-11-14 04:34:59 +08:00
|
|
|
friend std::ostream& operator<<(std::ostream& os, const StaticMethod& m) {
|
|
|
|
for (size_t i = 0; i < m.nrOverloads(); i++)
|
|
|
|
os << "static " << m.returnVals_[i] << " " << m.name_ << m.argLists_[i];
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2014-11-14 00:28:05 +08:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void proxy_header(FileWriter& proxyFile) const;
|
|
|
|
|
2014-11-14 00:34:33 +08:00
|
|
|
std::string wrapper_fragment(FileWriter& wrapperFile, Str cppClassName,
|
|
|
|
Str matlabUniqueName, int overload, int id,
|
|
|
|
const TypeAttributesTable& typeAttributes, const Qualified& instName =
|
|
|
|
Qualified()) const; ///< cpp wrapper
|
2014-11-14 00:28:05 +08:00
|
|
|
|
2014-11-14 00:34:33 +08:00
|
|
|
virtual std::string wrapper_call(FileWriter& wrapperFile, Str cppClassName,
|
|
|
|
Str matlabUniqueName, const ArgumentList& args,
|
|
|
|
const ReturnValue& returnVal, const TypeAttributesTable& typeAttributes,
|
2014-11-14 00:28:05 +08:00
|
|
|
const Qualified& instName) const;
|
2011-12-02 10:32:18 +08:00
|
|
|
};
|
|
|
|
|
2011-12-03 00:43:15 +08:00
|
|
|
} // \namespace wrap
|
|
|
|
|