-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prototyping reflection of external libraries #120
Prototyping reflection of external libraries #120
Conversation
…sary handling of different cases
@@ -238,11 +173,28 @@ public virtual void SetInputParams() | |||
HasDefaultValue = x.HasDefaultValue, | |||
DefaultValue = x.DefaultValue | |||
}).ToList(); | |||
if (Method is MethodInfo && !Method.IsStatic) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inserting the instance as an input if the method is an instance method
} | ||
} | ||
|
||
/*************************************/ | ||
|
||
public virtual void SetDelegate() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old CompileFunction
now calls the ToFunc
from the Reflection_Engine
@@ -1,92 +0,0 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrated to the Reflection_Engine
@@ -1,85 +0,0 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Migrated to the Data_Engine
@@ -37,7 +37,7 @@ public static partial class Query | |||
|
|||
public static IEnumerable<MethodBase> EngineItems() | |||
{ | |||
return Engine.Reflection.Query.BHoMMethodList().Where(x => !x.IsNotImplemented() && !x.IsDeprecated()); | |||
return Engine.Reflection.Query.BHoMMethodList().Where(x => x.IsExposed()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the new centralised way to filter out methods we don't want to expose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, just a couple of minor things.
Would be good to catch up before the merge though.
{ | ||
m_CompiledFunc = Method.ToFunc(); | ||
} | ||
|
||
public virtual void SetOutputParams() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to put the separator comment here.
Although to be honest, I am not sure I see the need of this method as it is a one liner is is only called once
/***************************************************/ | ||
/**** Public Methods ****/ | ||
/***************************************************/ | ||
public override string Name { get; protected set; } = "ExternalCompute"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer it to be name External
instead of ExternalCompute
.
I understand where you're going with this but not every linked method is going to correspond to a Compute
format so I'd rather stick to External
to avoid the parallel.
Thanks @adecler for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @epignatelli , all good now!
NOTE: Depends on BHoM/BHoM_Engine#1132
To test the prototype, switch to the correspondent (identically named) branches in the Grasshopper_Toolkit and the BHoM_Engine
Issues addressed by this PR
This mainly supports BHoM/BHoM_Engine#1132
Closes #118 as a side effect
This pr add the
ExternalCaller
component that contains all the methods from external libraries.As discussed with @adecler I tried to make it as BHoMmy as possible by modifying a little bit the
MethodCaller
. This way the new component fits into the pattern of all the other Engine methods.On the other hand, this pr migrates a set of methods to the Reflection_Engine, since they are much more general.
As usual, I left some comments on the diff itself to clarify the modifications.
Test files
The test comes with the PR on the Numpy_Toolkit: BHoM/Numpy_Toolkit#2
Changelog
ExternalCaller
component that can reflect any external assemblyCompileFunction
method to the Reflection_Engine asEngine.Reflection.Convert.ToFunc
GetConstructedType
method to the Reflection_Engine asEngine.Reflection.Modify.MakeGeneric
Engine.UI.Create.MethodInfo
to the Reflection_Engine asEngine.Reflection.Create.MethodInfo
Engine.UI.Modify.GroupMethodsByName
to the Data_Engine asEngine.Data.Modify.GroupByName
and clarified it is a generic methodAdditional comments