DgnECFinders.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 #pragma managed(push, off)
11 
12 #include <ECObjects/ECObjectsAPI.h>
13 #include "DgnModelRef.h"
14 #include "DgnFile.h"
15 #include "ElementHandle.h"
16 #include "ElementAgenda.h"
17 #include "DgnECInstance.h"
19 #include <Bentley/bvector.h>
20 #include <string>
21 #include <string.h>
22 #include "ECQuery.h"
23 
24 DGNPLATFORM_TYPEDEFS (FindInstancesScopeOption);
27 typedef bpair<const ECN::SchemaNameClassNamePair, int> InstanceCountEntry;
28 
31 
32 
33 /*---------------------------------------------------------------------------------**/
37 
41  {
42 private:
43  ReachableModelRefOptionsPtr m_modelReachableOptions;
44  DgnECHostType m_hostType;
45  UInt8 m_nonModelIdOption;
46  bool m_includeAttachments;
47  bool m_includePublicChildren;
48  bool m_allowExternalizedInstances;
49  DgnECInstanceCreateOptions m_createOptions;
50 
51 public:
54 
57  DGNPLATFORM_EXPORT FindInstancesScopeOption (DgnECHostType hostType);
58 
62  DGNPLATFORM_EXPORT FindInstancesScopeOption (DgnECHostType hostType, bool includeAttachments);
63 
65  DgnECHostType GetHostType() const {return m_hostType;}
66 
69  void SetHostType(DgnECHostType hostType) {m_hostType = hostType;}
70 
72  void SetSearchModelInstances () {m_hostType = DgnECHostType(m_hostType | DgnECHostType::Model);}
73 
75  void SetSearchFileInstances () {m_hostType = DgnECHostType(m_hostType | DgnECHostType::File);}
76 
78  bool GetSearchAttachments () const {return m_includeAttachments;}
79 
85  void SetSearchAttachments (bool includeAttachments) {m_includeAttachments = includeAttachments;}
86 
88  ReachableModelRefOptionsP GetReachableModelOptions() const {return m_modelReachableOptions.get();}
89 
92  DGNPLATFORM_EXPORT void SetReachableModelOptions (ReachableModelRefOptionsP options);
93 
95  bool GetSearchPublicChildren () const {return m_includePublicChildren;}
96 
99  void SetSearchPublicChildren(bool searchChildren) {m_includePublicChildren = searchChildren;}
100 
101  };
102 
103 /*---------------------------------------------------------------------------------**/
109 {
110 private:
111  virtual void MakeClassAbstract() = 0;
112 public:
113 public:
114 
119 
124  DGNPLATFORM_EXPORT static FindInstancesScopePtr CreateScope (bvector<DgnModelRefP> const& models, FindInstancesScopeOptionCR option, DgnFileR file);
125 
130 
135 
141 
146 
150  DGNPLATFORM_EXPORT static FindInstancesScopePtr CreateScope (DgnLinkTreeNodeCR linkNode);
151  DGNPLATFORM_EXPORT static FindInstancesScopePtr CreateScope (DgnLinkTreeNodeCR linkNode, DgnECInstanceCreateOptionsCR option);
152 
154  DGNPLATFORM_EXPORT DgnECHostType GetHostType() const;
155 
157  DGNPLATFORM_EXPORT DgnFileP GetFile () const;
158 
160  DGNPLATFORM_EXPORT bool Empty() const;
161 
162 };
163 //=======================================================================================
168 //+=============+===============+===============+===============+===============+======
170 {
171 private:
172  FindInstancesScopePtr m_scope;
173  SearchClassList m_requestedClasses;
174  ECQueryProcessFlags m_searchFlags;
175 
177  InstanceCountIterable (FindInstancesScopeR scope, const SearchClassList & requestedClasses, ECQueryProcessFlags searchFlags);
178 
179 public:
180  struct const_iterator;
181  //======================================================================================
183  //+=============+===============+===============+===============+===============+======
185  {
186 private:
187  virtual void MakeClassAbstract() = 0;
188 public:
189  };
190 
191  //======================================================================================
194  //+=============+===============+===============+===============+===============+======
195  struct const_iterator : std::iterator<std::forward_iterator_tag, InstanceCountEntry const>
196  {
197  private:
198  friend struct InstanceCountIterable;
200  bool m_isEnd;
201 
203  const_iterator ();
204 
205  public:
207  DGNPLATFORM_EXPORT const_iterator& operator++();
208 
211  DGNPLATFORM_EXPORT bool operator!=(const_iterator const& rhs) const;
212 
215  bool operator==(const_iterator const& rhs) const {return !(*this != rhs);}
216 
219  }; // end const_iterator
220 
222 
223 public:
228 }; // end InstanceCountIterable
229 
232 
233 
234 #pragma managed(pop)
235 
struct DgnPlatform::ElementAgenda const & ElementAgendaCR
Definition: DgnPlatform.h:258
struct DgnPlatform::DgnECInstanceCreateOptions const & DgnECInstanceCreateOptionsCR
Definition: DgnPlatform.h:539
void SetSearchPublicChildren(bool searchChildren)
Set true to search for public children of element.
Definition: DgnECFinders.h:99
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
Iterable for returning the number of instances for given classes within the given scope...
Definition: DgnECFinders.h:169
const_iterator iterator
only const iteration is possible
Definition: DgnECFinders.h:221
struct DgnPlatform::FindInstancesScopeOption const & FindInstancesScopeOptionCR
Definition: DgnECFinders.h:24
void SetSearchModelInstances()
Utility method to allow searching of instances from model header.
Definition: DgnECFinders.h:72
iterator begin()
Definition: stdcxx/bstdmap.h:178
ECQueryProcessFlags
Definition: WhereCriterion.h:33
iterator end()
Definition: stdcxx/bstdmap.h:186
void SetSearchAttachments(bool includeAttachments)
Set true to look for instance in attachment of a scope containing a model.
Definition: DgnECFinders.h:85
ReachableModelRefOptionsP GetReachableModelOptions() const
Get the how the scope scans a model and its attachments.
Definition: DgnECFinders.h:88
bvector< SearchClass > SearchClassList
Definition: ECQuery.h:44
uint8_t UInt8
Definition: Bentley.r.h:116
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
A DgnFile is an in-memory representation of a physical file, regardless of its format.
Definition: DgnFile.h:308
bool GetSearchAttachments() const
Check whether to find instances in attachment of a scope containing a model.
Definition: DgnECFinders.h:78
DgnECHostType GetHostType() const
Determine which type of instances to search for.
Definition: DgnECFinders.h:65
Defines the set of options used when querying for DgnECInstances.
Definition: DgnECInstance.h:203
Holds a set of options used to specify a set of ModelRefs to be iterated.
Definition: DgnModelRefCollections.h:22
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
A DgnModelRef provides access to a model in a Bentley::DgnPlatform::DgnFile.
Definition: DgnModelRef.h:172
void SetSearchFileInstances()
Utility method to allow searching of instances from file header.
Definition: DgnECFinders.h:75
#define DGNPLATFORM_TYPEDEFS(_name_)
Definition: DgnPlatform.h:73
void SetHostType(DgnECHostType hostType)
Set the host type from which instances are generated.
Definition: DgnECFinders.h:69
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
DVec3d operator*(Transform const &transform, DVec3d const &vector)
operator overload for multiplication of a transform and a vector li>The vector appears on the left as...
bool operator!=(const BentleyAllocator< _Ty > &, const BentleyAllocator< _Other > &)
Definition: BentleyAllocator.h:152
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
bool GetSearchPublicChildren() const
Get whether the scope will search for public children of elements.
Definition: DgnECFinders.h:95
bpair< const ECN::SchemaNameClassNamePair, int > InstanceCountEntry
Definition: DgnECFinders.h:26
! Used to return results from DgnECManager::FindInstances.
Definition: DgnECInstance.h:601
bool operator==(const_iterator const &rhs) const
Test whether two iterator are equal.
Definition: DgnECFinders.h:215
struct DgnPlatform::ElementHandle const & ElementHandleCR
Definition: DgnPlatform.h:260
A findinstances scope describes where to look for instances on a call to DgnECManager::FindInstances(...
Definition: DgnECFinders.h:108
DgnECHostType
Describes the underlying type on which an instance can be persisted.
Definition: DgnECInstance.h:78
Definition: DgnViewport.h:186
!FindInstancesScopeOption describes how the scope should be configured when ! we are traversing the e...
Definition: DgnECFinders.h:40

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.