Zervox
Member
|
Code Editor #define
using #define in code editor even in separate code element it gets added to cpp file, is it possible to add a separate define or alter the define add to .h?
at the same time, I would like to have added the possibility to have template assignment
T1(TYPE=BaseClass)
or atleast have the support for doing it manually like
template<typename=BaseClass>
as is supported in VS.
atleast so far I have been unable to assign template
(This post was last modified: 12-01-2016 04:09 PM by Zervox.)
|
|
12-01-2016 04:05 PM |
|
Esenthel
Administrator
|
RE: Code Editor #define
Currently the only way to do custom defines, is to list them in a regular *.h file, and then include that file in your project through application properties (double click App element in EE).
I've just tried this in EE:
T1(TYPE=Int) TYPE f(){return 0;}
and it works OK.
Although this:
<TYPE=Int> TYPE f(){return 0;}
doesn't work, I will try to make it work too.
|
|
12-01-2016 10:51 PM |
|
Esenthel
Administrator
|
RE: Code Editor #define
<TYPE=Int> TYPE f(){return 0;}
will work OK in the next release.
|
|
12-01-2016 11:35 PM |
|
Zervox
Member
|
RE: Code Editor #define
I am unable to get this to work
which compiles and runs just fine in Visual Studio.
Code:
T1( TYPE=NoClass)
struct FltCondition
{
BH_STATUS execute(void* agent){
Flt objVal = getObjVal(agent);
return BT_FAILURE;
};
void init(void* agent){};
FltCondition(Flt(TYPE::* C _func)() C, FLT_TEST _test, Flt _val,Flt epsilon=EPS) : func(reinterpret_cast<Flt(TYPE::* C)()>(_func)), func2(NULL){
test = _test;
val = _val;
eps = epsilon;
}
FltCondition(Flt(TYPE::*_func)(), FLT_TEST _test, Flt _val,Flt epsilon=EPS): func(_func), func2(NULL){
test = _test;
val = _val;
eps = epsilon;
}
FltCondition(Flt(*_func)(), FLT_TEST _test, Flt _val,Flt epsilon=EPS) : func2(_func), func(NULL){
test = _test;
val = _val;
eps = epsilon;
}
private:
Flt (TYPE::* C func)();
Flt (* C func2)();
FLT_TEST test;
Flt val;
Flt eps;
Flt getObjVal(void* agent){
TYPE* obj = (TYPE*) agent;
return (obj->*func)();
}
};
template<>
Flt FltCondition<NoClass>::getObjVal(void* agent){return (*func2)();}
Code:
stdafx.cpp
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(20): warning C4348: 'BHT::FltConditionA': redefinition of default parameter: parameter 1 [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(65): error C2955: 'BHT::FltConditionA': use of class template requires template argument list [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(65): error C2509: 'execute': member function not declared in 'BHT::FltConditionA' [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(81): error C2955: 'BHT::FltConditionA': use of class template requires template argument list [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(81): error C2509: 'init': member function not declared in 'BHT::FltConditionA' [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(82): error C2955: 'BHT::FltConditionA': use of class template requires template argument list [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(82): error C2653: 'TYPE': is not a class or namespace name [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
Source\BehaviorTree\FltCondition.cpp(82): error C2645: no qualified name for pointer to member (found ':: *') [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
Source\BehaviorTree\FltCondition.cpp(82): error C2269: cannot create a pointer or reference to a qualified function type (requires pointer-to-member) [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
Source\BehaviorTree\FltCondition.cpp(82): error C2509: '{ctor}': member function not declared in 'BHT::FltConditionA' [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'PriorityNode.cpp
Source\BehaviorTree\FltCondition.cpp(82): error C2065: '_func': undeclared identifier [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
Source\BehaviorTree\FltCondition.cpp(87): error C2955: 'BHT::FltConditionA': use of class template requires template argument list [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(87): error C2653: 'TYPE': is not a class or namespace name [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
Source\BehaviorTree\FltCondition.cpp(87): error C2645: no qualified name for pointer to member (found ':: *') [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
Source\BehaviorTree\FltCondition.cpp(87): error C2509: '{ctor}': member function not declared in 'BHT::FltConditionA' [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(87): error C2065: '_func': undeclared identifier [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
Source\BehaviorTree\FltCondition.cpp(92): error C2955: 'BHT::FltConditionA': use of class template requires template argument list [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(92): error C2509: '{ctor}': member function not declared in 'BHT::FltConditionA' [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(92): error C2065: '_func': undeclared identifier [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
Source\BehaviorTree\FltCondition.cpp(97): error C2955: 'BHT::FltConditionA': use of class template requires template argument list [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
Source\BehaviorTree\FltCondition.cpp(97): error C2509: 'getObjVal': member function not declared in 'BHT::FltConditionA' [D:\Esenthel\Esenthel3SDK\Projects\_Build_\Test\Project.vcxproj]
d:\esenthel\esenthel3sdk\projects\_build_\test\source\@BHT.FltConditionA.h(21): note: see declaration of 'BHT::FltConditionA'
it wouldn't be possible to have the header included in the EsenthelProject that you export somehow? either as a raw which you could dump. making libraries in Esenthel Would be very cool if it were possible to have a header code file which is a pure .h and is included before everything else in ones custom library(perhaps as a property on code file for avanced usage, to let the code editor to know that this will be a complete global only, I am thinking two properties, include as header only and priority, eg if you have two files one with priority 1 and one with 2 the one with the highest priority value gets put first).
(This post was last modified: 12-02-2016 07:01 AM by Zervox.)
|
|
12-02-2016 02:58 AM |
|
Esenthel
Administrator
|
RE: Code Editor #define
Thank you, I will investigate that once I find some time.
|
|
12-08-2016 02:45 AM |
|