Add label summary times to ctest default output. Also, remove parallel time output...
[cmake.git] / Source / cmDefinitions.h
blob0977c5c9dd2fb7911b300270a7ca5c91fd27c41a
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmDefinitions.h,v $
5 Language: C++
6 Date: $Date: 2009-07-22 18:22:45 $
7 Version: $Revision: 1.1 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmDefinitions_h
18 #define cmDefinitions_h
20 #include "cmStandardIncludes.h"
22 /** \class cmDefinitions
23 * \brief Store a scope of variable definitions for CMake language.
25 * This stores the state of variable definitions (set or unset) for
26 * one scope. Sets are always local. Gets search parent scopes
27 * transitively and save results locally.
29 class cmDefinitions
31 public:
32 /** Construct with the given parent scope. */
33 cmDefinitions(cmDefinitions* parent = 0);
35 /** Reset object as if newly constructed. */
36 void Reset(cmDefinitions* parent = 0);
38 /** Returns the parent scope, if any. */
39 cmDefinitions* GetParent() const { return this->Up; }
41 /** Get the value associated with a key; null if none.
42 Store the result locally if it came from a parent. */
43 const char* Get(const char* key);
45 /** Set (or unset if null) a value associated with a key. */
46 const char* Set(const char* key, const char* value);
48 /** Compute the closure of all defined keys with values.
49 This flattens the scope. The result has no parent. */
50 cmDefinitions Closure() const;
52 /** Compute the set of all defined keys. */
53 std::set<cmStdString> ClosureKeys() const;
55 private:
56 // String with existence boolean.
57 struct Def: public cmStdString
59 Def(): cmStdString(), Exists(false) {}
60 Def(const char* v): cmStdString(v?v:""), Exists(v?true:false) {}
61 Def(Def const& d): cmStdString(d), Exists(d.Exists) {}
62 bool Exists;
64 static Def NoDef;
66 // Parent scope, if any.
67 cmDefinitions* Up;
69 // Local definitions, set or unset.
70 typedef std::map<cmStdString, Def> MapType;
71 MapType Map;
73 // Internal query and update methods.
74 Def const& GetInternal(const char* key);
75 Def const& SetInternal(const char* key, Def const& def);
77 // Implementation of Closure() method.
78 struct ClosureTag {};
79 cmDefinitions(ClosureTag const&, cmDefinitions const* root);
80 void ClosureImpl(std::set<cmStdString>& undefined,
81 cmDefinitions const* defs);
83 // Implementation of ClosureKeys() method.
84 void ClosureKeys(std::set<cmStdString>& defined,
85 std::set<cmStdString>& undefined) const;
88 #endif