Back to index

nordugrid-arc-nox  1.1.0~rc6
Defines | Functions | Variables
info_types.cpp File Reference
#include <iostream>
#include <limits.h>
#include <arc/StringConv.h>
#include "../misc/canonical_dir.h"
#include "../misc/escaped.h"
#include "info_types.h"

Go to the source code of this file.

Defines

#define istream_readline(__f, __s, __n)

Functions

void output_escaped_string (std::ostream &o, const std::string &str)
std::ostream & operator<< (std::ostream &o, const FileData &fd)
std::istream & operator>> (std::istream &i, FileData &fd)
static char StateToShortcut (const std::string &state)
std::istream & operator>> (std::istream &i, LRMSResult &r)
std::ostream & operator<< (std::ostream &o, const LRMSResult &r)

Variables

static Arc::Loggerlogger = Arc::Logger::getRootLogger()

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 24 of file info_types.cpp.


Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const FileData fd 
)

Definition at line 47 of file info_types.cpp.

                                                          {
  output_escaped_string(o,fd.pfn);
  o.put(' ');
  output_escaped_string(o,fd.lfn);
  return o;
}

Here is the call graph for this function:

std::ostream& operator<< ( std::ostream &  o,
const LRMSResult r 
)

Definition at line 277 of file info_types.cpp.

                                                          {
  o<<r.code()<<" "<<r.description();
  return o;
}

Here is the call graph for this function:

std::istream& operator>> ( std::istream &  i,
FileData fd 
)

Definition at line 54 of file info_types.cpp.

                                                    {
  char buf[1024];
  istream_readline(i,buf,sizeof(buf));
  fd.pfn.resize(0); fd.lfn.resize(0);
  int n=input_escaped_string(buf,fd.pfn);
  input_escaped_string(buf+n,fd.lfn);
  if((fd.pfn.length() == 0) && (fd.lfn.length() == 0)) return i; /* empty st */
  if(canonical_dir(fd.pfn) != 0) {
    logger.msg(Arc::ERROR,"Wrong directory in %s",buf);
    fd.pfn.resize(0); fd.lfn.resize(0);
  };
  return i;
}

Here is the call graph for this function:

std::istream& operator>> ( std::istream &  i,
LRMSResult r 
)

Definition at line 270 of file info_types.cpp.

                                                    {
  char buf[1025]; // description must have reasonable size
  if(i.eof()) { buf[0]=0; } else { istream_readline(i,buf,sizeof(buf)); };
  r=buf;
  return i;
}
void output_escaped_string ( std::ostream &  o,
const std::string &  str 
)

Definition at line 34 of file info_types.cpp.

                                                               {
  std::string::size_type n,nn;
  for(nn=0;;) {
//    if((n=str.find(' ',nn)) == std::string::npos) break;
    if((n=str.find_first_of(" \\",nn)) == std::string::npos) break;
    o.write(str.data()+nn,n-nn);
    o.put('\\');
    o.put(*(str.data()+n));
    nn=n+1;
  };
  o.write(str.data()+nn,str.length()-nn);
}

Here is the caller graph for this function:

static char StateToShortcut ( const std::string &  state) [static]

Definition at line 107 of file info_types.cpp.

                                                    {
  if(state == "ACCEPTED") return 'a'; // not supported
  if(state == "PREPARING") return 'b';
  if(state == "SUBMIT") return 's'; // not supported
  if(state == "INLRMS") return 'q';
  if(state == "FINISHING") return 'f';
  if(state == "FINISHED") return 'e';
  if(state == "DELETED") return 'd';
  if(state == "CANCELING") return 'c';
  return ' ';
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 32 of file info_types.cpp.