process_entry.cpp

Go to the documentation of this file.
00001 /*****************************************************************************\
00002 *                                                                             *
00003 *  Name   : process_entry                                                     *
00004 *  Author : Chris Koeritz                                                     *
00005 *                                                                             *
00006 *******************************************************************************
00007 * Copyright (c) 2000-$now By Author.  This program is free software; you can  *
00008 * redistribute it and/or modify it under the terms of the GNU General Public  *
00009 * License as published by the Free Software Foundation; either version 2 of   *
00010 * the License or (at your option) any later version.  This is online at:      *
00011 *     http://www.fsf.org/copyleft/gpl.html                                    *
00012 * Please send any updates to: fred@gruntose.com                               *
00013 \*****************************************************************************/
00014 
00015 #include "process_entry.h"
00016 
00017 #include <basis/array.h>
00018 #include <basis/astring.h>
00019 #include <filesystem/filename.h>
00020 
00021 using namespace basis;
00022 using namespace filesystem;
00023 
00024 namespace processes {
00025 
00026 process_entry::process_entry()
00027 : _process_id(0),
00028   _references(0),
00029   _threads(0),
00030   _parent_process_id(0),
00031   _module16(0),
00032   _process_path(new astring)
00033 {}
00034 
00035 process_entry::process_entry(const process_entry &to_copy)
00036 : _process_id(0),
00037   _references(0),
00038   _threads(0),
00039   _parent_process_id(0),
00040   _module16(0),
00041   _process_path(new astring)
00042 {
00043   operator =(to_copy);
00044 }
00045 
00046 process_entry::~process_entry()
00047 {
00048   WHACK(_process_path);
00049 }
00050 
00051 void process_entry::text_form(basis::base_string &fill) const
00052 {
00053   fill = text_form();
00054 }
00055 
00056 process_entry &process_entry::operator =(const process_entry &to_copy)
00057 {
00058   if (&to_copy == this) return *this;
00059   _process_id = to_copy._process_id;
00060   _references = to_copy._references;
00061   _threads = to_copy._threads;
00062   _parent_process_id = to_copy._parent_process_id;
00063   *_process_path = *to_copy._process_path;
00064   _module16 = to_copy._module16;
00065   return *this;
00066 }
00067 
00068 const astring &process_entry::path() const { return *_process_path; }
00069 
00070 void process_entry::path(const astring &new_path)
00071 { *_process_path = new_path; }
00072 
00073 astring process_entry::text_form() const
00074 {
00075 #ifdef __UNIX__
00076   filename pat(path());
00077 #else
00078   filename pat(path().lower());
00079 #endif
00080   return a_sprintf("%s: pid=%u refs=%u thrd=%u par=%u mod16=%u path=%s",
00081       pat.basename().raw().s(), _process_id, _references, _threads,
00082       _parent_process_id, _module16, pat.dirname().raw().s());
00083 }
00084 
00085 } //namespace.
00086 
Generated on Sat Jan 28 04:22:24 2012 for hoople2 project by  doxygen 1.6.3