AGX Dynamics  2.37.2.0
Path.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 #pragma once
18 
19 #include <agx/Name.h>
20 #include <agx/HashFunction.h>
21 
22 #ifdef _MSC_VER
23 # pragma warning(push)
24 # pragma warning( disable : 4251 ) // class X needs to have dll-interface to be used by clients of class Y
25 #endif
26 
27 namespace agx
28 {
33  {
34  public:
35  Path();
36  Path(const agx::String& path);
37  Path(const std::string& path);
38  Path(const char *path);
39  // Path(const char *begin, const char *end);
40  Path(const agx::Path& other);
41  explicit Path(const Name& name);
42 
43  ~Path();
44 
45  Path& operator= (const Path& other);
46 
47 
51  const agx::String& str() const;
52 
56  const char *c_str() const;
57 
61  agx::String root() const;
62 
66  bool empty() const;
67 
71  bool hasTail() const;
72 
76  agx::Path tail() const;
77 
81  agx::Path base() const;
82 
86  agx::String back() const;
87 
88 
89  bool contains(const Path& subpath);
90  bool contains(const Name& component);
91 
92  // Hash function
93  UInt32 hash() const;
94 
95  agx::Path operator+ (const agx::Path& extension) const;
96  agx::Path operator+ (const agx::Name& extension) const;
97 
98  agx::Path& operator+= (const agx::Path& extension);
99  agx::Path& operator+= (const agx::Name& extension);
100 
101  bool operator== (const agx::Path& other) const;
102  bool operator!= (const agx::Path& other) const;
103 
104 
105  public:
107  {
108  public:
109  iterator();
110 
111  String operator *() const;
112 
113  iterator& operator++();
114  iterator operator++(int);
115 
116  bool operator== (const iterator& other) const;
117  bool operator!= (const iterator& other) const;
118 
119  private:
120  friend class Path;
121  iterator(const Path& path, size_t pos = 0);
122 
123  private:
124  String m_path;
125  size_t m_pos;
126  };
127 
128 
129  iterator begin() const;
130  iterator end() const;
131 
132  private:
133  void init(const char *begin, const char *end);
134  void init(const std::string& str);
135 
136  private:
137  String m_str;
138  };
139 
140 
141  AGXCORE_EXPORT std::ostream& operator << ( std::ostream& stream, const Path& path );
142 
143  /* Implementation */
144  inline Path::Path()
145  {}
146 
147  AGX_FORCE_INLINE const String& Path::str() const { return m_str; }
148 
149  inline Path::iterator Path::begin() const { return iterator(*this); }
150  inline Path::iterator Path::end() const { return iterator(*this, String::npos); }
151 
153  {
154  return agx::hash(m_str);
155  }
156 
157 }
158 
159 #ifdef _MSC_VER
160 # pragma warning(pop)
161 #endif
AGXCORE_EXPORT UInt32 hash(const T &key)
Definition: HashFunction.h:65
Representation of a path, a list of name components.
Definition: Path.h:32
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
bool operator==(T val, InvalidIndexStruct)
Definition: agx.h:194
Representation of a name string.
Definition: Name.h:32
#define AGX_FORCE_INLINE
Definition: Object.h:59
const agx::String & str() const
Definition: Path.h:147
iterator end() const
Definition: Path.h:150
AgXString< T > operator+(const Indentation &indentation, const AgXString< T > &str)
Definition: Indentation.h:66
Path()
Definition: Path.h:144
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
std::ostream & operator<<(std::ostream &os, const agx::AddedMassInteraction::Matrix6x6 &m)
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
iterator begin() const
Definition: Path.h:149
UInt32 hash() const
Definition: Path.h:152
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
bool operator!=(T val, InvalidIndexStruct)
Definition: agx.h:200
AGXCORE_EXPORT Component * root()
uint32_t UInt32
Definition: Integer.h:40
#define AGXCORE_EXPORT
Vec3T< T > operator*(const Vec3T< T > &v, const AffineMatrix4x4T< T > &m)
AGXCABLE_EXPORT SegmentDamage & operator+=(SegmentDamage &lhs, const SegmentDamage &rhs)