ECInstanceIterable.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
10 #include <ECObjects/ECObjects.h>
12 
15 
16 
17 /*---------------------------------------------------------------------------------**/
23 template <typename value_type>
24 struct IInstanceCollectionIteratorAdapter :public Bentley::RefCountedBase, std::iterator<std::forward_iterator_tag, value_type>
25  {
26  public:
27  typedef value_type& reference;
28  virtual void MoveToNext () = 0;
29  virtual bool IsDifferent (IInstanceCollectionIteratorAdapter const &) const = 0;
30  virtual reference GetCurrent () = 0;
31  };
32 
33 /*---------------------------------------------------------------------------------**/
37 template <typename value_type>
39  {
40 private:
41 
42 public:
44  virtual const_iterator begin() const = 0;
45  virtual const_iterator end() const = 0;
46  };
47 
48 typedef ECN::IInstanceCollectionAdapter<IECInstanceP const> IECInstanceCollectionAdapter;
50 typedef ECN::IInstanceCollectionIteratorAdapter<IECInstanceP const> IECInstanceCollectionIteratorAdapter;
51 typedef ECN::IInstanceCollectionAdapter<IECRelationshipInstanceP const> IECRelationshipCollectionAdapter;
53 typedef ECN::IInstanceCollectionIteratorAdapter<IECRelationshipInstanceP const> IECRelationshipCollectionIteratorAdapter;
54 
55 /*---------------------------------------------------------------------------------**/
64  {
65  private:
66  IECInstanceCollectionAdapterPtr m_collectionPtr;
67 
68  public:
71  {
72  }
73 
77 
78  typedef IECInstanceCollectionAdapter::const_iterator const_iterator;
81  ECOBJECTS_EXPORT bool empty() const;
82  ECOBJECTS_EXPORT bool IsNull () const;
83  };
84 
85 /*---------------------------------------------------------------------------------**/
94  {
95  private:
97 
98  public:
101  {
102  }
103 
107 
108  typedef IECRelationshipCollectionAdapter::const_iterator const_iterator;
111  ECOBJECTS_EXPORT bool empty() const;
112  ECOBJECTS_EXPORT bool IsNull () const;
113  };
116 
IECRelationshipCollectionAdapter::const_iterator const_iterator
Definition: ECInstanceIterable.h:108
virtual bool IsDifferent(IInstanceCollectionIteratorAdapter const &) const =0
Compares the item at the current location of the passed in iterator with this iterator's current item...
bool empty() const
returns whether the collection is empty or not
virtual const_iterator end() const =0
returns the end of the collection
ECN::IInstanceCollectionAdapter< IECInstanceP const > IECInstanceCollectionAdapter
Definition: ECInstanceIterable.h:48
bool IsNull() const
returns whether the collection is Null
ECInstanceIterable()
Default constructor.
Definition: ECInstanceIterable.h:70
VirtualCollectionIterator< IInstanceCollectionIteratorAdapter< value_type > > const_iterator
Definition: ECInstanceIterable.h:43
virtual reference GetCurrent()=0
Returns the item at the current iterator location.
This is the iterator that is exposed using VirtualCollectionIterator.
Definition: ECInstanceIterable.h:24
A container collection which allows you to expose different kinds of collection as a single type...
Definition: ECInstanceIterable.h:38
#define ECOBJECTS_EXPORT
Definition: ECObjects.h:20
ECN::IInstanceCollectionIteratorAdapter< IECRelationshipInstanceP const > IECRelationshipCollectionIteratorAdapter
Definition: ECInstanceIterable.h:53
value_type & reference
Definition: ECInstanceIterable.h:27
ECN::IInstanceCollectionIteratorAdapter< IECInstanceP const > IECInstanceCollectionIteratorAdapter
Definition: ECInstanceIterable.h:50
typical usage for (ECRelationshipIterable::const_iterator iter = collection.begin(); iter != collecti...
Definition: ECInstanceIterable.h:93
const_iterator begin() const
returns the beginning of this collection
virtual void MoveToNext()=0
Moves to next item in the collection.
typical usage for (ECInstanceIterable::const_iterator iter = collection.begin(); iter != collection...
Definition: ECInstanceIterable.h:63
const_iterator end() const
returns the end of the collection
bool empty() const
returns whether the collection is empty or not
#define END_BENTLEY_ECOBJECT_NAMESPACE
Definition: DgnPlatform.h:41
RefCountedPtr< IECInstanceCollectionAdapter > IECInstanceCollectionAdapterPtr
Definition: ECInstanceIterable.h:49
This template is used by iterators that hide their implementation from the published API...
Definition: VirtualCollectionIterator.h:33
ECRelationshipIterable()
Default constructor.
Definition: ECInstanceIterable.h:100
IECInstanceCollectionAdapter::const_iterator const_iterator
Definition: ECInstanceIterable.h:78
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
RefCountedPtr< IECRelationshipCollectionAdapter > IECRelationshipCollectionAdapterPtr
Definition: ECInstanceIterable.h:52
const_iterator end() const
returns the end of the collection
bool IsNull() const
returns whether the collection is Null
ECN::IInstanceCollectionAdapter< IECRelationshipInstanceP const > IECRelationshipCollectionAdapter
Definition: ECInstanceIterable.h:51
virtual const_iterator begin() const =0
returns the beginning of the collection
#define BEGIN_BENTLEY_ECOBJECT_NAMESPACE
Definition: DgnPlatform.h:40
const_iterator begin() const
returns the beginning of this collection

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