Back to index

nordugrid-arc-nox  1.1.0~rc6
Defines | Functions
gridmap.cpp File Reference
#include <string>
#include <fstream>
#include "environment.h"
#include "conf.h"
#include "gridmap.h"

Go to the source code of this file.

Defines

#define istream_readline(__f, __s, __n)

Functions

bool gridmap_user_list (std::string &ulist)
bool gridmap_user_list (std::list< std::string > &ulist)

Define Documentation

#define istream_readline (   __f,
  __s,
  __n 
)
Value:
{      \
   __f.get(__s,__n,'\n');         \
   if(__f.fail()) __f.clear();               \
   __f.ignore(INT_MAX,'\n'); \
}

Definition at line 22 of file gridmap.cpp.


Function Documentation

bool gridmap_user_list ( std::string &  ulist)

Definition at line 30 of file gridmap.cpp.

                                         {
  std::string path = globus_gridmap();
  std::ifstream f(path.c_str()); 
  if(! f.is_open() ) return false;
  for(;!f.eof();) {
    char buf[512];
    istream_readline(f,buf,sizeof(buf));
    std::string rest = buf;
    std::string name = "";
    for(;rest.length() != 0;) {
      name=config_next_arg(rest);
    };
    if(name.length() == 0) continue;
    std::string::size_type pos;
    if((pos=ulist.find(name)) != std::string::npos) {
      if(pos!=0) 
        if(ulist[pos-1] != ' ') { ulist+=" "+name; continue; };
      pos+=name.length();
      if(pos < ulist.length())
        if(ulist[pos] != ' ') { ulist+=" "+name; continue; };
    }
    else { ulist+=" "+name; };
  };
  f.close();
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool gridmap_user_list ( std::list< std::string > &  ulist)

Definition at line 57 of file gridmap.cpp.

                                                  {
  std::string path = globus_gridmap();
  std::ifstream f(path.c_str()); 
  if(! f.is_open() ) return false;
  for(;!f.eof();) {
    char buf[512];
    istream_readline(f,buf,sizeof(buf));
    std::string rest = buf;
    std::string name = "";
    for(;rest.length() != 0;) {
      name=config_next_arg(rest);
    };
    if(name.length() == 0) continue;
    std::string::size_type pos;
    for(std::list<std::string>::iterator u = ulist.begin();
                          u != ulist.end(); ++u) {
      if(name == *u) { name.resize(0); break; };
    };
    if(name.length() == 0) continue;
    ulist.push_back(name);
  };
  f.close();
  return true;
}

Here is the call graph for this function: