CFx SDK Documentation  2023 SP0
daiIterator.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2019, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Open Design Alliance software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Open Design Alliance Copyright (C) 2002-2019 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef _DAI_ITERATOR_H
25 #define _DAI_ITERATOR_H
26 
27 #include "OdPlatformSettings.h"
28 #include "OdaCommon.h"
29 
30 //#include "RxObject.h"
31 //#include "RxObjectImpl.h"
32 #include "SharedPtr.h"
33 #include "RxValue.h"
34 
35 #include "daiBuildOptions.h"
36 #include "daiValueTypes.h"
37 
38 namespace OdDAI {
39 
40  class AggrBase;
41  class AggrIsntance;
42 
44  {
45  public:
46 
47  virtual void start() = 0;
48  virtual bool done() = 0;
49  virtual bool next() = 0;
50  virtual int size() = 0;
51 
52  virtual const OdRxValueType& type() = 0;
53  virtual OdRxValue get() = 0;
54  virtual bool test() = 0;
55 
56  };
58 
59  template< class T >
61  {
62  OdArray<T> m_arr;
63  T* m_it;
64 
65  public:
66 
67  IteratorArr(const OdArray<T> &arr)
68  : m_arr(arr)
69  { start(); };
70 
71  virtual void start() { m_it = m_arr.begin() - 1; };
72  virtual bool done() { return m_it >= m_arr.end() - 1; }
73  virtual bool next() { if (!done()) { ++m_it; return true; } return false; }
74  virtual int size() { return m_arr.size(); };
75  virtual const OdRxValueType& type() { return OdRxValueType::Desc<T>::value(); };
76  virtual bool test() { return m_it >= m_arr.begin() && m_it < m_arr.end(); };
77  virtual OdRxValue get() { if (test()) return OdRxValue(*m_it); return OdRxValue(); }
78 
79  };
80  //typedef OdSharedPtr<Iterator> DictionaryInstancePtr;//*/
81 
82 }
83 
84 #endif // _DAI_ITERATOR_H
virtual bool next()
Definition: daiIterator.h:73
virtual int size()
Definition: daiIterator.h:74
virtual OdRxValue get()
Definition: daiIterator.h:77
virtual const OdRxValueType & type()
Definition: daiIterator.h:75
virtual bool done()
Definition: daiIterator.h:72
virtual bool test()
Definition: daiIterator.h:76
virtual void start()
Definition: daiIterator.h:71
IteratorArr(const OdArray< T > &arr)
Definition: daiIterator.h:67
virtual bool test()=0
virtual bool done()=0
virtual void start()=0
virtual int size()=0
virtual const OdRxValueType & type()=0
virtual bool next()=0
virtual OdRxValue get()=0
#define DAI_EXPORT
OdSharedPtr< Iterator > IteratorPtr
Definition: daiIterator.h:57
static const OdRxValueType & value()