feisty meow concerns codebase 2.140
process_entry.cpp
Go to the documentation of this file.
1/*****************************************************************************\
2* *
3* Name : process_entry *
4* Author : Chris Koeritz *
5* *
6*******************************************************************************
7* Copyright (c) 2000-$now By Author. This program is free software; you can *
8* redistribute it and/or modify it under the terms of the GNU General Public *
9* License as published by the Free Software Foundation; either version 2 of *
10* the License or (at your option) any later version. This is online at: *
11* http://www.fsf.org/copyleft/gpl.html *
12* Please send any updates to: fred@gruntose.com *
13\*****************************************************************************/
14
15#include "process_entry.h"
16
17#include <basis/array.h>
18#include <basis/astring.h>
19#include <filesystem/filename.h>
20
21using namespace basis;
22using namespace filesystem;
23
24namespace processes {
25
27: _process_id(0),
28 _references(0),
29 _threads(0),
30 _parent_process_id(0),
31 _module16(0),
32 _process_path(new astring)
33{}
34
36: _process_id(0),
37 _references(0),
38 _threads(0),
39 _parent_process_id(0),
40 _module16(0),
41 _process_path(new astring)
42{
43 operator =(to_copy);
44}
45
47{
48 WHACK(_process_path);
49}
50
52{
53 fill = text_form();
54}
55
57{
58 if (&to_copy == this) return *this;
59 _process_id = to_copy._process_id;
60 _references = to_copy._references;
61 _threads = to_copy._threads;
63 *_process_path = *to_copy._process_path;
64 _module16 = to_copy._module16;
65 return *this;
66}
67
68const astring &process_entry::path() const { return *_process_path; }
69
70void process_entry::path(const astring &new_path)
71{ *_process_path = new_path; }
72
74{
75#ifdef __UNIX__
76 filename pat(path());
77#else
78 filename pat(path().lower());
79#endif
80 return a_sprintf("%s: pid=%u refs=%u thrd=%u par=%u mod16=%u path=%s",
83}
84
85} //namespace.
86
a_sprintf is a specialization of astring that provides printf style support.
Definition astring.h:440
Provides a dynamically resizable ASCII character string.
Definition astring.h:35
const char * s() const
synonym for observe. the 's' stands for "string", if that helps.
Definition astring.h:113
Defines the base class for all string processing objects in hoople.
Definition base_string.h:28
Provides operations commonly needed on file names.
Definition filename.h:64
const basis::astring & raw() const
returns the astring that we're holding onto for the path.
Definition filename.cpp:97
filename dirname() const
returns the directory for the filename.
Definition filename.cpp:393
filename basename() const
returns the base of the filename; no directory.
Definition filename.cpp:385
Encapsulates information about OS processes.
basis::un_int _parent_process_id
the process id of the owning process.
basis::un_int _references
the number of references to (users of) this process.
~process_entry()
basis::un_int _process_id
the OS identifier of this process.
basis::astring text_form() const
returns a descriptive string for the information here.
basis::un_short _module16
non-zero if this process is a 16-bit application.
process_entry & operator=(const process_entry &to_copy)
process_entry()
const basis::astring & path() const
basis::un_int _threads
the number of threads in use by this process.
The guards collection helps in testing preconditions and reporting errors.
Definition array.h:30
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
Definition functions.h:121
A platform independent way to obtain the timestamp of a file.