1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * Copyright (c) 2010 The Hewlett-Packard Development Company 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 30 unchanged lines hidden (view full) --- 39 40void breakpoint(); 41 42class Flag 43{ 44 protected: 45 const char *_name; 46 const char *_desc; |
47 std::vector<Flag *> _kids; |
48 49 public: 50 Flag(const char *name, const char *desc); 51 virtual ~Flag(); 52 53 std::string name() const { return _name; } 54 std::string desc() const { return _desc; } |
55 std::vector<Flag *> kids() { return _kids; } |
56 57 virtual void enable() = 0; 58 virtual void disable() = 0; 59}; 60 61class SimpleFlag : public Flag 62{ 63 protected: --- 10 unchanged lines hidden (view full) --- 74 75 void enable() { _status = true; } 76 void disable() { _status = false; } 77}; 78 79class CompoundFlag : public SimpleFlag 80{ 81 protected: |
82 void 83 addFlag(Flag &f) 84 { 85 if (&f != NULL) 86 _kids.push_back(&f); 87 } |
88 89 public: 90 CompoundFlag(const char *name, const char *desc, 91 Flag &f00 = *(Flag *)0, Flag &f01 = *(Flag *)0, 92 Flag &f02 = *(Flag *)0, Flag &f03 = *(Flag *)0, 93 Flag &f04 = *(Flag *)0, Flag &f05 = *(Flag *)0, 94 Flag &f06 = *(Flag *)0, Flag &f07 = *(Flag *)0, 95 Flag &f08 = *(Flag *)0, Flag &f09 = *(Flag *)0, --- 5 unchanged lines hidden (view full) --- 101 : SimpleFlag(name, desc) 102 { 103 addFlag(f00); addFlag(f01); addFlag(f02); addFlag(f03); addFlag(f04); 104 addFlag(f05); addFlag(f06); addFlag(f07); addFlag(f08); addFlag(f09); 105 addFlag(f10); addFlag(f11); addFlag(f12); addFlag(f13); addFlag(f14); 106 addFlag(f15); addFlag(f16); addFlag(f17); addFlag(f18); addFlag(f19); 107 } 108 |
109 void enable(); 110 void disable(); 111}; 112 113} // namespace Debug 114 115#endif // __BASE_DEBUG_HH__ |