How to determine the type of a pointer indexed member. I intend to useοΌ
TYPEDUT_DemoStruct:STRUCTMember_1:BOOL;Member_2:INT;END_STRUCTEND_TYPEPROGRAMPrg_MainVARDemoStructPointer:Obj_DemoStruct1:DUT_DemoStruct;Obj_DemoStruct2:DUT_DemoStruct;Obj_DemoStruct3:DUT_DemoStruct;Demo_INT:INT;Index:INT;_pointer:POINTERTODUT_DemoStruct;END_VARFORIndex:=0TO5DOIF_pointer[Index]THEN//**whether the _pointer[Index] (pointer index member) is of type DUT_DemoStruct** _pointer[Index].Member_1:=TRUE; END_IF;END_FOR;
In addition, Do you have any application cases for CheckPointer?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
H:
Obviously misunderstood the question.
This is to better implement the contracted part of the HMSD(Hierarchical Master-Slave Distribution) framework. For example, batch initialization of states.
For example: if you want to implement batch initialization of objects of class Step, you only need to pass the pointer of the first Step to the initialization function, and the function will automatically search down according to the first pointer until it finds an object that is not of the Step class and stops searching. This process needs to be automated. To achieve such a function, you need the index of the pointer, and determine the type of the pointer index member.
Ideal code:
Feeling the current mechanism of pointer implementation, such a function seems to be difficult to achieve. Looking forward to the launch of the collection function.
π
2
Last edit: SiegeLion 2022-06-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How to determine the type of a pointer indexed member. I intend to useοΌ
In addition, Do you have any application cases for CheckPointer?
more posts ...
I don't understand your point.
Please use the dereference of a pointer to address the variables.
H:
Obviously misunderstood the question.
This is to better implement the contracted part of the HMSD(Hierarchical Master-Slave Distribution) framework. For example, batch initialization of states.
For example: if you want to implement batch initialization of objects of class Step, you only need to pass the pointer of the first Step to the initialization function, and the function will automatically search down according to the first pointer until it finds an object that is not of the Step class and stops searching. This process needs to be automated. To achieve such a function, you need the index of the pointer, and determine the type of the pointer index member.
Ideal code:
Feeling the current mechanism of pointer implementation, such a function seems to be difficult to achieve. Looking forward to the launch of the collection function.
Last edit: SiegeLion 2022-06-02