AGX Dynamics  2.37.2.0
ScriptIDEData.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 
18 #pragma once
19 #ifndef AGXPYTHON_SCRIPTIDEDATA_H
20 #define AGXPYTHON_SCRIPTIDEDATA_H 1
21 
22 #include <agx/config/AGX_USE_PYTHON.h>
23 
24 #if AGX_USE_PYTHON()
25 
26 #include <agxPython/export.h>
27 
28 #include <agx/Referenced.h>
29 #include <agx/Name.h>
30 
31 #include <map>
32 #include <vector>
33 #include <string>
34 #include <iostream>
35 
36 namespace agxPython
37 {
38 
39  AGX_DECLARE_POINTER_TYPES(ScriptIDEData);
40  class AGXPYTHON_EXPORT ScriptIDEData : public agx::Referenced
41  {
42 
43  public:
44 
45  ScriptIDEData(size_t numberOfColumns);
46 
48  ScriptIDEData(const ScriptIDEData& copy);
49 
50 #ifndef SWIG
51  agx::String& getData(size_t i);
52 #endif
53 
54  agx::String operator[](size_t i) const;
55  agx::String& operator[](size_t i);
56 
57  size_t size() const;
58  agx::String getData(size_t i) const;
59  agx::String returnData(size_t i) const;
60 
61  virtual bool matching(const agx::String& regex) const;
62 
63  virtual size_t hash() const;
64 
65  virtual agx::String str() const =0;
66 
67  virtual agx::String type() const = 0;
68 
69  virtual bool isGood() const = 0;
70 
71  struct compare
72  {
73  bool operator()(size_t lhs, size_t rhs) const
74  {
75  if (lhs == rhs)
76  return false;
77  return (lhs > rhs);
78  }
79  };
80 
81  protected:
82 
83  virtual ~ScriptIDEData();
84 
85  virtual bool matching_single(size_t i, const agx::String& regex) const;
86 
87  private:
88 
90 
91  };
92 
93 
94 
95  AGX_DECLARE_POINTER_TYPES(ScriptIDEDataCollection);
96  class AGXPYTHON_EXPORT ScriptIDEDataCollection : public agx::Referenced
97  {
98 
99  public:
100 
101  typedef ScriptIDEDataRef elem_type;
102  typedef std::map<size_t, elem_type, ScriptIDEData::compare> container_type;
103  typedef container_type::iterator iterator_type;
104  typedef std::vector<elem_type> range_type;
105 
106  const agx::Name& getCollectionTypeName() const;
107 
108  virtual bool add(ScriptIDEDataRef item);
109 
110  virtual void clear();
111 
112  virtual range_type equal_range(const agx::String& regexFilter = "");
113 
114  iterator_type begin() { return m_data.begin(); }
115  iterator_type end() { return m_data.end(); }
116 
117  protected:
118  ScriptIDEDataCollection(const agx::Name& collectionTypeName);
119 
120  virtual ~ScriptIDEDataCollection();
121 
122  private:
123 
124  agx::Name m_collectionTypeName;
125 
126  container_type m_data;
127 
128  };
129 
130 }
131 
132 #endif
133 
134 #endif
AGXCORE_EXPORT UInt32 hash(const T &key)
Definition: HashFunction.h:65
AGXTERRAIN_EXPORT void clear()
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Representation of a name string.
Definition: Name.h:32
Base class providing referencing counted objects.
Definition: Referenced.h:119
Templated vector class.
Definition: Vector.h:52
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
#define AGXPYTHON_EXPORT