process_entry.cpp

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

Generated on Fri Nov 21 04:29:57 2008 for HOOPLE Libraries by  doxygen 1.5.1