XRootD
Loading...
Searching...
No Matches
XrdPfc::PathTokenizer Struct Reference

#include <XrdPfc.hh>

+ Inheritance diagram for XrdPfc::PathTokenizer:
+ Collaboration diagram for XrdPfc::PathTokenizer:

Public Member Functions

 PathTokenizer (const std::string &path, int max_depth, bool parse_as_lfn)
 
void deboog ()
 
const char * get_dir (int pos)
 
int get_n_dirs ()
 
std::string make_path ()
 

Public Attributes

std::vector< const char * > m_dirs
 
int m_n_dirs
 
const char * m_reminder
 

Detailed Description

Definition at line 185 of file XrdPfc.hh.

Constructor & Destructor Documentation

◆ PathTokenizer()

XrdPfc::PathTokenizer::PathTokenizer ( const std::string & path,
int max_depth,
bool parse_as_lfn )
inline

Definition at line 191 of file XrdPfc.hh.

191 :
192 SplitParser(path, "/"),
193 m_reminder (0),
194 m_n_dirs (0)
195 {
196 // If parse_as_lfn is true store final token into m_reminder, regardless of maxdepth.
197 // This assumes the last token is a file name (and full path is lfn, including the file name).
198
199 m_dirs.reserve(max_depth);
200
201 char *t = 0;
202 for (int i = 0; i < max_depth; ++i)
203 {
204 t = get_token();
205 if (t == 0) break;
206 m_dirs.emplace_back(t);
207 }
208 if (parse_as_lfn && *get_reminder() == 0 && ! m_dirs.empty())
209 {
210 m_reminder = m_dirs.back();
211 m_dirs.pop_back();
212 }
213 else
214 {
216 }
217 m_n_dirs = (int) m_dirs.size();
218 }
const char * m_reminder
Definition XrdPfc.hh:188
std::vector< const char * > m_dirs
Definition XrdPfc.hh:187
SplitParser(const std::string &s, const char *d)
Definition XrdPfc.hh:145
char * get_token()
Definition XrdPfc.hh:150
char * get_reminder()
Definition XrdPfc.hh:162

References XrdPfc::SplitParser::get_reminder(), XrdPfc::SplitParser::get_token(), m_dirs, and m_n_dirs.

+ Here is the call graph for this function:

Member Function Documentation

◆ deboog()

void XrdPfc::PathTokenizer::deboog ( )
inline

Definition at line 247 of file XrdPfc.hh.

248 {
249 printf("PathTokenizer::deboog size=%d\n", m_n_dirs);
250 for (int i = 0; i < m_n_dirs; ++i)
251 {
252 printf(" %2d: %s\n", i, m_dirs[i]);
253 }
254 printf(" rem: %s\n", m_reminder);
255 }

References m_dirs, m_n_dirs, and m_reminder.

◆ get_dir()

const char * XrdPfc::PathTokenizer::get_dir ( int pos)
inline

Definition at line 225 of file XrdPfc.hh.

226 {
227 if (pos >= m_n_dirs) return 0;
228 return m_dirs[pos];
229 }

References m_dirs, and m_n_dirs.

◆ get_n_dirs()

int XrdPfc::PathTokenizer::get_n_dirs ( )
inline

Definition at line 220 of file XrdPfc.hh.

221 {
222 return m_n_dirs;
223 }

References m_n_dirs.

◆ make_path()

std::string XrdPfc::PathTokenizer::make_path ( )
inline

Definition at line 231 of file XrdPfc.hh.

232 {
233 std::string res;
234 for (std::vector<const char*>::iterator i = m_dirs.begin(); i != m_dirs.end(); ++i)
235 {
236 res += "/";
237 res += *i;
238 }
239 if (m_reminder != 0)
240 {
241 res += "/";
242 res += m_reminder;
243 }
244 return res;
245 }

References m_dirs, and m_reminder.

Member Data Documentation

◆ m_dirs

std::vector<const char*> XrdPfc::PathTokenizer::m_dirs

Definition at line 187 of file XrdPfc.hh.

Referenced by PathTokenizer(), deboog(), get_dir(), and make_path().

◆ m_n_dirs

int XrdPfc::PathTokenizer::m_n_dirs

Definition at line 189 of file XrdPfc.hh.

Referenced by PathTokenizer(), deboog(), get_dir(), and get_n_dirs().

◆ m_reminder

const char* XrdPfc::PathTokenizer::m_reminder

Definition at line 188 of file XrdPfc.hh.

Referenced by deboog(), and make_path().


The documentation for this struct was generated from the following file: