AGX Dynamics 2.39.0.0
Loading...
Searching...
No Matches
Path.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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
27namespace 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
44
45 Path& operator= (const Path& other);
46
47
51 const agx::String& str() const;
52
56 const char *c_str() const;
57
62
66 bool empty() const;
67
71 bool hasTail() const;
72
76 agx::Path tail() const;
77
81 agx::Path base() const;
82
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:
110
111 String operator *() const;
112
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 agx::String operator+(const std::string &str, const agx::Name &name)
#define AGXCORE_EXPORT
Representation of a name string.
Definition: Name.h:33
iterator operator++(int)
iterator & operator++()
Representation of a path, a list of name components.
Definition: Path.h:33
Path(const agx::String &path)
Path(const std::string &path)
Path(const char *path)
const char * c_str() const
Path(const Name &name)
agx::Path tail() const
Path()
Definition: Path.h:144
UInt32 hash() const
Definition: Path.h:152
agx::String root() const
const agx::String & str() const
Definition: Path.h:147
iterator end() const
Definition: Path.h:150
iterator begin() const
Definition: Path.h:149
bool contains(const Name &component)
bool hasTail() const
agx::String back() const
bool contains(const Path &subpath)
agx::Path base() const
bool empty() const
Path(const agx::Path &other)
#define AGX_FORCE_INLINE
Definition: macros.h:58
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:32
AGXCORE_EXPORT UInt32 hash(const T &key)
Definition: HashFunction.h:65
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
std::ostream & operator<<(std::ostream &os, const agx::AddedMassInteraction::Matrix6x6 &m)
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API.