mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 12:56:26 +00:00
Added swig support for templates with array parameters (#1742)
* Added support for templates with array parameters * Added test case for array templates
This commit is contained in:
parent
f2e93ac490
commit
7b4253d703
@ -97,7 +97,7 @@ my $template_def = qr/template\s* # keyword template
|
||||
\s+[_A-Za-z]\w*\s* # class name
|
||||
/sx ;
|
||||
my $template_var_def = qr/(?:\:\:)?[_A-Za-z][:\w]*\s* # template name
|
||||
<[\w\s\*,:<>]*>\s* # template parameters
|
||||
<[\w\s\*,:<>\[\]]*>\s* # template parameters
|
||||
[_A-Za-z]\w*\s*(?:[{=].*?)?; # var name ;
|
||||
/sx ;
|
||||
|
||||
|
@ -9,8 +9,25 @@ LIBRARY DEPENDENCIES:
|
||||
#include "sim_objects/default_trick_sys.sm"
|
||||
|
||||
##include "test_ip/include/ClassOfEverything.hh"
|
||||
##include "test_ip/include/ArrayTemplate.hh"
|
||||
##include "test_ip/include/OverloadedVariable.hh"
|
||||
|
||||
class ArrayTemplateSimObject : public Trick::SimObject
|
||||
{
|
||||
public:
|
||||
ArrayTemplateSimObject(const ArrayTemplateSimObject&) = delete;
|
||||
ArrayTemplateSimObject& operator=(const ArrayTemplateSimObject&) = delete;
|
||||
|
||||
double a[3];
|
||||
ArrayTemplate<double[3]> arryTemp;
|
||||
|
||||
ArrayTemplateSimObject()
|
||||
: arryTemp(a)
|
||||
{
|
||||
}
|
||||
};
|
||||
ArrayTemplateSimObject arry_temp_object;
|
||||
|
||||
class testSimObject : public Trick::SimObject {
|
||||
|
||||
public:
|
||||
|
37
test/SIM_test_ip/models/test_ip/include/ArrayTemplate.hh
Normal file
37
test/SIM_test_ip/models/test_ip/include/ArrayTemplate.hh
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
@file
|
||||
|
||||
@verbatim
|
||||
PURPOSE:
|
||||
(Test if we can build with arrays as template parameters)
|
||||
@endverbatim
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef ARRAY_TEMPLATE_TESTS_HH
|
||||
#define ARRAY_TEMPLATE_TESTS_HH
|
||||
|
||||
// System include files.
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
template <class SourceType>
|
||||
class ArrayTemplate
|
||||
{
|
||||
public:
|
||||
ArrayTemplate(const SourceType& source)
|
||||
: source(source)
|
||||
{
|
||||
}
|
||||
|
||||
ArrayTemplate(const ArrayTemplate&) = delete;
|
||||
ArrayTemplate& operator=(const ArrayTemplate&) = delete;
|
||||
|
||||
private:
|
||||
const SourceType& source;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user