Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Types | Public Member Functions | Private Attributes
JobUsers Class Reference

#include <users.h>

Collaboration diagram for JobUsers:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::list< JobUser >
::iterator 
iterator
typedef std::list< JobUser >
::const_iterator 
const_iterator

Public Member Functions

 JobUsers (void)
 ~JobUsers (void)
iterator begin (void)
const_iterator begin (void) const
iterator end (void)
const_iterator end (void) const
size_t size (void) const
iterator AddUser (const std::string &unix_name, RunPlugin *cred_plugin=NULL, const std::string &control_dir="", const std::vector< std::string > *session_root=NULL)
iterator DeleteUser (iterator &user)
bool HasUser (const std::string &name)
std::string ControlDir (iterator user)
std::string ControlDir (const std::string user)
iterator find (const std::string user)
bool run_helpers (void)
bool substitute (std::string &param) const

Private Attributes

std::list< JobUserusers

Detailed Description

Definition at line 138 of file users.h.


Member Typedef Documentation

Definition at line 143 of file users.h.

typedef std::list<JobUser>::iterator JobUsers::iterator

Definition at line 142 of file users.h.


Constructor & Destructor Documentation

JobUsers::JobUsers ( void  )

Definition at line 303 of file users.cpp.

                       {
}
JobUsers::~JobUsers ( void  )

Definition at line 306 of file users.cpp.

                        {
}

Member Function Documentation

JobUsers::iterator JobUsers::AddUser ( const std::string &  unix_name,
RunPlugin cred_plugin = NULL,
const std::string &  control_dir = "",
const std::vector< std::string > *  session_root = NULL 
)

Definition at line 309 of file users.cpp.

                                                                                                                                                            {
  JobUser user(unix_name,cred_plugin);
  user.SetControlDir(control_dir);
  if(session_roots) user.SetSessionRoot(*session_roots);
  if(user.is_valid()) { return users.insert(users.end(),user); };
  return users.end();
}

Here is the call graph for this function:

Here is the caller graph for this function:

iterator JobUsers::begin ( void  ) [inline]

Definition at line 146 of file users.h.

{ return users.begin(); };

Here is the caller graph for this function:

const_iterator JobUsers::begin ( void  ) const [inline]

Definition at line 147 of file users.h.

{ return users.begin(); };
std::string JobUsers::ControlDir ( iterator  user)

Definition at line 317 of file users.cpp.

                                            {
  if(user == users.end()) return std::string("");
  return (*user).ControlDir();
}
std::string JobUsers::ControlDir ( const std::string  user)

Definition at line 330 of file users.cpp.

                                                   {
  for(iterator i=users.begin();i!=users.end();++i) {
    if((*i) == user) return (*i).ControlDir();
  };
  return std::string("");
}
iterator JobUsers::DeleteUser ( iterator user) [inline]

Definition at line 153 of file users.h.

{ return users.erase(user); };
iterator JobUsers::end ( void  ) [inline]

Definition at line 148 of file users.h.

{ return users.end(); };

Here is the caller graph for this function:

const_iterator JobUsers::end ( void  ) const [inline]

Definition at line 149 of file users.h.

{ return users.end(); };
JobUsers::iterator JobUsers::find ( const std::string  user)

Definition at line 322 of file users.cpp.

                                                    {
  iterator i;
  for(i=users.begin();i!=users.end();++i) {
    if((*i) == user) break;
  };
  return i;
}

Here is the caller graph for this function:

bool JobUsers::HasUser ( const std::string &  name) [inline]

Definition at line 155 of file users.h.

                                      {
    for(iterator i=users.begin();i!=users.end();++i)
      if((*i) == name) return true;
    return false;
  };

Here is the caller graph for this function:

bool JobUsers::run_helpers ( void  )

Definition at line 369 of file users.cpp.

                               {
  for(iterator i=users.begin();i!=users.end();++i) {
    i->run_helpers();
  };
  return true;
}

Here is the caller graph for this function:

size_t JobUsers::size ( void  ) const [inline]

Definition at line 150 of file users.h.

{ return users.size(); };

Here is the caller graph for this function:

bool JobUsers::substitute ( std::string &  param) const

Definition at line 180 of file users.cpp.

                                                {
  std::string session_roots = "";
  std::string control_dirs = "";
  for(JobUsers::const_iterator i = begin();i!=end();++i) {
    std::string tmp_s;
    tmp_s = i->SessionRoot();
    make_escaped_string(tmp_s);
    tmp_s=tmp_s+" ";
    if(session_roots.find(tmp_s) == std::string::npos) session_roots+=tmp_s;
    tmp_s = i->ControlDir();
    make_escaped_string(tmp_s);
    tmp_s=tmp_s+" ";
    if(control_dirs.find(tmp_s) == std::string::npos) control_dirs+=tmp_s;
  };
  std::string::size_type curpos=0;
  for(;;) {
    if(curpos >= param.length()) break;
    std::string::size_type pos = param.find('%',curpos);
    if(pos == std::string::npos) break;
    pos++; if(pos>=param.length()) break;
    if(param[pos] == '%') { curpos=pos+1; continue; };
    std::string to_put;
    switch(param[pos]) {
      case 'r': to_put=session_roots; break;
      case 'c': to_put=control_dirs; break;
      default: to_put=param.substr(pos-1,2);
    };
    curpos=pos+1+(to_put.length() - 2);
    param.replace(pos-1,2,to_put);
  };
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

std::list<JobUser> JobUsers::users [private]

Definition at line 140 of file users.h.


The documentation for this class was generated from the following files: