Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

StatLocation.H

Go to the documentation of this file.
00001 // Copyright (C) 2001, Compaq Computer Corporation
00002 // 
00003 // This file is part of Vesta.
00004 // 
00005 // Vesta is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 // 
00010 // Vesta is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with Vesta; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 // Last modified on Thu Aug  5 00:38:05 EDT 2004 by ken@xorian.net
00020 
00021 // StatLocation.H -- A class representing a location within the cache
00022 // about which statistics are recorded.  Used for recording the
00023 // min/max locations as well as (optionally) "troublesome" locations.
00024 
00025 #ifndef _STAT_LOCATION_H
00026 #define _STAT_LOCATION_H
00027 
00028 #include <FP.H>
00029 #include <FV.H>
00030 #include <CacheIndex.H>
00031 
00032 namespace Stat
00033 {
00034   // A Location within the cache.
00035   class Location
00036   {
00037   private:
00038     // Path of MPKFile or directory above it.
00039     Text path;
00040 
00041     // Informaiton about the PKFile this was in.
00042     FP::Tag pk;
00043     Text sourceFunc;
00044     bool has_pk;
00045 
00046     // Informaiton about the CFP group this was in.
00047     FP::Tag cfp;
00048     FV::Epoch namesEpoch;
00049     bool has_cfp;
00050 
00051     // Informaiton about the cache entry this was in.
00052     CacheEntry::Index ci;
00053     bool has_ci;
00054 
00055   public:
00056     Location(const Text &p_path)
00057       : path(p_path),
00058         has_pk(false), has_cfp(false), has_ci(false)
00059     { }
00060     Location(const Text &p_path,
00061              const FP::Tag &p_pk, const Text &p_sourceFunc)
00062       : path(p_path),
00063         pk(p_pk), sourceFunc(p_sourceFunc), has_pk(true),
00064         has_cfp(false), has_ci(false)
00065     { }
00066     Location(const Text &p_path,
00067              const FP::Tag &p_pk, const Text &p_sourceFunc,
00068              FV::Epoch p_namesEpoch, const FP::Tag &p_cfp)
00069       : path(p_path),
00070         pk(p_pk), sourceFunc(p_sourceFunc), has_pk(true),
00071         cfp(p_cfp), namesEpoch(p_namesEpoch), has_cfp(true),
00072         has_ci(false)
00073     { }
00074     Location(const Text &p_path,
00075              const FP::Tag &p_pk, const Text &p_sourceFunc,
00076              FV::Epoch p_namesEpoch, const FP::Tag &p_cfp,
00077              CacheEntry::Index p_ci)
00078       : path(p_path),
00079         pk(p_pk), sourceFunc(p_sourceFunc), has_pk(true),
00080         cfp(p_cfp), namesEpoch(p_namesEpoch), has_cfp(true),
00081         ci(p_ci), has_ci(true)
00082     { }
00083     Location(const Location &p_other)
00084       : path(p_other.path),
00085         pk(p_other.pk), sourceFunc(p_other.sourceFunc), has_pk(p_other.has_pk),
00086         cfp(p_other.cfp), namesEpoch(p_other.namesEpoch), has_cfp(p_other.has_cfp),
00087         ci(p_other.ci), has_ci(p_other.has_ci)
00088     { }
00089 
00090     Location add_pk(const FP::Tag &p_pk, const Text *p_sourceFunc) const
00091     {
00092       return Location(path, p_pk, *p_sourceFunc);
00093     }
00094 
00095     Location add_cfp(FV::Epoch p_namesEpoch, const FP::Tag &p_cfp) const
00096     {
00097       return Location(path, pk, sourceFunc, p_namesEpoch, p_cfp);
00098     }
00099 
00100     Location add_ci(CacheEntry::Index p_ci) const
00101     {
00102       return Location(path, pk, sourceFunc, namesEpoch, cfp, p_ci);
00103     }
00104 
00105     const Text &get_sourceFunc() const { return sourceFunc; }
00106 
00107     void print(std::ostream &out, int indent = 0) const;
00108   };
00109 }
00110 
00111 std::ostream &operator<<(std::ostream &, const Stat::Location &);
00112 
00113 #endif // _STAT_LOCATION_H

Generated on Mon May 8 00:48:36 2006 for Vesta by  doxygen 1.4.2