Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
Hopi::HopiFileTimeout Class Reference
Collaboration diagram for Hopi::HopiFileTimeout:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 HopiFileTimeout (const std::string &p)
 ~HopiFileTimeout (void)
void Destroy (void)

Static Public Member Functions

static void Timeout (int t)
static void Add (const std::string &p)
static void DestroyOld (void)
static void DestroyAll (void)

Private Attributes

std::string path

Static Private Attributes

static std::map< std::string,
time_t > 
files
static Glib::Mutex lock
static int timeout = 10

Detailed Description

Definition at line 336 of file hopi.cpp.


Constructor & Destructor Documentation

Hopi::HopiFileTimeout::HopiFileTimeout ( const std::string &  p)

Definition at line 356 of file hopi.cpp.

                                                  :path(p) {
  lock.lock();
  files[path]=time(NULL);
  lock.unlock();
}

Definition at line 362 of file hopi.cpp.

                                      {
}

Member Function Documentation

void Hopi::HopiFileTimeout::Add ( const std::string &  p) [static]

Definition at line 373 of file hopi.cpp.

                                            {
  lock.lock();
  files[p]=time(NULL);
  lock.unlock();
}

Here is the caller graph for this function:

Definition at line 365 of file hopi.cpp.

                                  {
  lock.lock();
  std::map<std::string,time_t>::iterator f = files.find(path);
  if(f != files.end()) files.erase(f);
  lock.unlock();
  ::unlink(path.c_str());
}
void Hopi::HopiFileTimeout::DestroyAll ( void  ) [static]

Definition at line 396 of file hopi.cpp.

                                     {
  lock.lock();
  std::map<std::string,time_t>::iterator f = files.begin();
  for(;f != files.end();) {
    ::unlink(f->first.c_str());
    std::map<std::string,time_t>::iterator f_ = f;
    ++f;
    files.erase(f_);
  }
  lock.unlock();
}

Here is the caller graph for this function:

void Hopi::HopiFileTimeout::DestroyOld ( void  ) [static]

Definition at line 379 of file hopi.cpp.

                                     {
  lock.lock();
  std::map<std::string,time_t>::iterator f = files.begin();
  for(;f != files.end();) {
    int delta = (unsigned int)(time(NULL) - f->second);
    if(delta >= timeout) {
      ::unlink(f->first.c_str());
      std::map<std::string,time_t>::iterator f_ = f;
      ++f;
      files.erase(f_);
      continue;
    };
    ++f;
  }
  lock.unlock();
}

Here is the caller graph for this function:

static void Hopi::HopiFileTimeout::Timeout ( int  t) [inline, static]

Definition at line 345 of file hopi.cpp.

{ timeout=t; };

Here is the caller graph for this function:


Member Data Documentation

std::map< std::string, time_t > Hopi::HopiFileTimeout::files [static, private]

Definition at line 338 of file hopi.cpp.

Glib::Mutex Hopi::HopiFileTimeout::lock [static, private]

Definition at line 339 of file hopi.cpp.

std::string Hopi::HopiFileTimeout::path [private]

Definition at line 341 of file hopi.cpp.

int Hopi::HopiFileTimeout::timeout = 10 [static, private]

Definition at line 340 of file hopi.cpp.


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