Navigation through the EPLAN 21 data model is carried out via iterators.
The EPLAN 21 data model contains different object lists; a project contains, e.g., a list of pages. Using iterators, the individual objects of these lists can be accessed within a loop. In this case, the project is the "parent," with the iterator being of the EPL_ITERATOR_PAGES type. Like all other objects of the API, iterators are referenced via handles.
In order to release the storage space required by the iterator, iterators must be explicitly released via eplCloseObject when they are no longer needed.
The current version of the programming interface does, e.g., provide iterators for the following objects: projects of a database, pages of a project, instances of a page. A complete overview of the iterators can be found in the Iterator types reference. The EPLAN 21 object model shows the objects with their respective iterators.
void pageIterTest(EplSession s, EplHandle hProject) { if (hProject != EPL_ERROR) { // Open iterator for pages of a project: EplHandle hPageIter = eplOpenIterator(s, hProject, EPL_ITERTYPE_PAGES); // Access to the first page: EplHandle hPage = eplFirst(s, hPageIter); while (hPage != EPL_ERROR) { doSomethingWithPage(s, hPage); // Get next page: hPage = eplNext(s, hPageIter); } // Release iterator: eplCloseObject(hPageIter); } } |