1#region Nested Class ...
2
3
4 internal class POUAnalyser
5 {
6 #region Private Members ...
7
8
9 private POUs _activePOUs;
10 #endregion
11 #region Contructors / Desctructors ...
12
13
14 public POUAnalyser(IBuildAnalyserRule analyser)
15 {
16
17 }
18 #endregion
19
20
21 }
22
23 internal class POUs: CollectionBase, IList, ICollection, IEnumerable
24 {
25 #region Contructors / Desctructors ...
26
27
28 public POUs()
29 {
30
31 }
32 #endregion
33 #region Public Methods ...
34
35 #endregion
36 #region Private Methods ...
37
38
39 /// <summary>
40 /// Returns the list of the active POUs which are configured in the task configuration.
41 /// </summary>
42 /// <param name="analyser"></param>
43 /// <returns></returns>
44 private List<IPouObject> GetActivePOUs(IBuildMessageLogger analyser)
45 {
46 List<IPouObject> activePOUs = new List<IPouObject>();
47
48 // get the application meta object passed in the arguments
49 IMetaObject appMetaObj = SystemInstances.ObjectMgr.GetObjectToRead(analyser.ProjectHandle, analyser.Application);
50
51 foreach (Guid subGuid in appMetaObj.SubObjectGuids)
52 {
53 // Search in all the child objects, the application object
54 IMetaObject childMetaObj = SystemInstances.ObjectMgr.GetObjectToRead(analyser.ProjectHandle, subGuid);
55 //get the "Embedded Functions" object
56 //if (childMetaObj.Object.GetType().ToString().Equals("_3S.CoDeSys.TaskConfigObject.TaskConfigObject"))
57 if (childMetaObj.Object is ITaskConfigObject)
58 {
59 ITaskConfigObject taskConfig = childMetaObj.Object as ITaskConfigObject;
60 foreach (ITaskObject task in taskConfig.Tasks)
61 {
62 foreach (IPouObject pou in task.POUs)
63 {
64 activePOUs.Add(pou);
65 }
66 }
67 }
68 }
69 return activePOUs;
70 }
71 /// <summary>
72 /// Returns the list of all the POUs which are stored in the project.
73 /// </summary>
74 /// <param name="analyser"></param>
75 private Dictionary<string, IPOUObject> GetAllPOUs(IBuildMessageLogger analyser)
76 {
77 Dictionary<string, IPOUObject> POUs = new Dictionary<string, IPOUObject>();
78
79 foreach (Guid guid in SystemInstances.ObjectMgr.GetAllObjects(analyser.ProjectHandle))
80 {
81 IMetaObject metaObject = SystemInstances.ObjectMgr.GetObjectToRead(analyser.ProjectHandle, guid);
82 if (metaObject.Object is IPOUObject)
83 {
84 IPOUObject pouObj = metaObject.Object as IPOUObject;
85 POUs.Add(pouObj.MetaObject.Name, pouObj);
86 }
87 }
88 return POUs;
89 }
90 #endregion
91 }
92 #endregion