source: nscp/include/checkHelpers.hpp @ 29ff7e1

0.4.10.4.2
Last change on this file since 29ff7e1 was 29ff7e1, checked in by Michael Medin <michael@…>, 11 months ago
  • Fixed issue with performance data overflowing 32-bit integers (#550)
  • Fixed issue with CheckUptime? and time rendering being wrong (#549)
  • Property mode set to 100644
File size: 42.0 KB
Line 
1/**************************************************************************
2*   Copyright (C) 2004-2007 by Michael Medin <michael@medin.name>         *
3*                                                                         *
4*   This code is part of NSClient++ - http://trac.nakednuns.org/nscp      *
5*                                                                         *
6*   This program is free software; you can redistribute it and/or modify  *
7*   it under the terms of the GNU General Public License as published by  *
8*   the Free Software Foundation; either version 2 of the License, or     *
9*   (at your option) any later version.                                   *
10*                                                                         *
11*   This program is distributed in the hope that it will be useful,       *
12*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14*   GNU General Public License for more details.                          *
15*                                                                         *
16*   You should have received a copy of the GNU General Public License     *
17*   along with this program; if not, write to the                         *
18*   Free Software Foundation, Inc.,                                       *
19*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
20***************************************************************************/
21#pragma once
22
23#include <string>
24#include <strEx.h>
25#include <format.hpp>
26#include <math.h>
27
28#define MAKE_PERFDATA_SIMPLE(alias, value, unit) _T("'") + alias + _T("'=") + value + unit
29#define MAKE_PERFDATA(alias, value, unit, warn, crit) _T("'") + alias + _T("'=") + value + unit + _T(";") + warn + _T(";") + crit
30#define MAKE_PERFDATA_EX(alias, value, unit, warn, crit, xmin, xmax) _T("'") + alias + _T("'=") + value + unit + _T(";") + warn + _T(";") + crit + _T(";") + xmin + _T(";") + xmax
31
32namespace checkHolders {
33
34
35
36        typedef enum { warning, critical} ResultType;
37        typedef enum { above = 1, below = -1, same = 0 } checkResultType;
38        class check_exception {
39                std::wstring error_;
40        public:
41                check_exception(std::wstring error) : error_(error) {}
42                std::wstring getMessage() {
43                        return error_;
44                }
45        };
46
47        struct parse_exception : public check_exception {
48                parse_exception(std::wstring error) : check_exception(error) {}
49        };
50
51        static std::wstring formatAbove(std::wstring str, ResultType what) {
52                if (what == warning)
53                        return str + _T(" > warning");
54                else if (what == critical)
55                        return str + _T(" > critical");
56                return str + _T(" > unknown");
57        }
58
59        static std::wstring formatBelow(std::wstring str, ResultType what) {
60                if (what == warning)
61                        return str + _T(" < warning");
62                else if (what == critical)
63                        return str + _T(" < critical");
64                return str + _T(" < unknown");
65        }
66        static std::wstring formatSame(std::wstring str, ResultType what) {
67                if (what == warning)
68                        return str + _T(" = warning");
69                else if (what == critical)
70                        return str + _T(" = critical");
71                return str + _T(" = unknown");
72        }
73        static std::wstring formatNotSame(std::wstring str, ResultType what) {
74                if (what == warning)
75                        return str + _T(" != warning");
76                else if (what == critical)
77                        return str + _T(" != critical");
78                return str + _T(" != unknown");
79        }
80        static std::wstring formatState(std::wstring str, ResultType what) {
81                if (what == warning)
82                        return str + _T(" (warning)");
83                else if (what == critical)
84                        return str + _T(" (critical)");
85                return str + _T(" (unknown)");
86        }
87        static std::wstring formatNotFound(std::wstring str, ResultType what) {
88                if (what == warning)
89                        return str + _T("not found (warning)");
90                else if (what == critical)
91                        return str + _T("not found (critical)");
92                return str + _T("not found (unknown)");
93        }
94
95
96        typedef enum {showLong, showShort, showProblems, showUnknown} showType;
97        template <class TContents>
98        struct CheckContainer {
99                typedef CheckContainer<TContents> TThisType;
100                typedef typename TContents::TValueType TPayloadValueType;
101                TContents warn;
102                TContents crit;
103                std::wstring data;
104                std::wstring alias;
105
106                showType show;
107                bool perfData;
108
109
110                CheckContainer() : show(showUnknown), perfData(true)
111                {}
112                CheckContainer(std::wstring data_, TContents warn_, TContents crit_)
113                        : data(data_), warn(warn_), crit(crit_), show(showUnknown), perfData(true)
114                {}
115                CheckContainer(std::wstring data_, std::wstring alias_, TContents warn_, TContents crit_)
116                        : data(data_), alias(alias_), warn(warn_), crit(crit_), show(showUnknown), perfData(true)
117                {}
118                CheckContainer(const TThisType &other)
119                        : data(other.data), alias(other.alias), warn(other.warn), crit(other.crit), show(other.show), perfData(other.perfData)
120
121                {}
122                CheckContainer<TContents>& operator =(const CheckContainer<TContents> &other) {
123                        warn = other.warn;
124                        crit = other.crit;
125                        data = other.data;
126                        alias = other.alias;
127                        show = other.show;
128                        perfData = other.perfData;
129                        return *this;
130                }
131                void reset() {
132                        warn.reset();
133                        crit.reset();
134                }
135                std::wstring getAlias() {
136                        if (alias.empty())
137                                return data;
138                        return alias;
139                }
140                void setDefault(TThisType def) {
141                        if (!warn.hasBounds())
142                                warn = def.warn;
143                        if (!crit.hasBounds())
144                                crit = def.crit;
145                        if (show == showUnknown)
146                                show = def.show;
147                }
148                bool showAll() {
149                        return show != showProblems;
150                }
151                std::wstring gatherPerfData(typename TContents::TValueType &value) {
152                        if (crit.hasBounds())
153                                return crit.gatherPerfData(getAlias(), value, warn, crit);
154                        else if (warn.hasBounds())
155                                return warn.gatherPerfData(getAlias(), value, warn, crit);
156                        else {
157                                TContents tmp;
158                                return tmp.gatherPerfData(getAlias(), value);
159                        }
160                }
161                bool hasBounds() {
162                        return warn.hasBounds() || crit.hasBounds();
163                }
164                void runCheck(typename TContents::TValueType value, NSCAPI::nagiosReturn &returnCode, std::wstring &message, std::wstring &perf) {
165                        std::wstring tstr;
166                        if (crit.check(value, getAlias(), tstr, critical)) {
167                                //std::wcout << _T("crit") << std::endl;
168                                nscapi::plugin_helper::escalteReturnCodeToCRIT(returnCode);
169                        } else if (warn.check(value, getAlias(), tstr, warning)) {
170                                //std::wcout << _T("warn") << std::endl;
171                                nscapi::plugin_helper::escalteReturnCodeToWARN(returnCode);
172                        }else if (show == showLong) {
173                                //std::wcout << _T("long") << std::endl;
174                                tstr = getAlias() + _T(": ") + TContents::toStringLong(value);
175                        }else if (show == showShort) {
176                                //std::wcout << _T("short") << std::endl;
177                                tstr = getAlias() + _T(": ") + TContents::toStringShort(value);
178                        }
179                        if (perfData) {
180                                if (!perf.empty())
181                                        perf += _T(" ");
182                                perf += gatherPerfData(value);
183                        }
184                        if (!message.empty() && !tstr.empty())
185                                message += _T(", ");
186                        if (!tstr.empty())
187                                message += tstr;
188                        //std::wcout << _T("result: ") << tstr << _T("--") << std::endl;
189                }
190        };
191
192        template <class TContents>
193        struct MagicCheckContainer : public CheckContainer<TContents> {
194                typedef CheckContainer<TContents> tParent;
195
196                MagicCheckContainer() : tParent() {}
197                MagicCheckContainer(std::wstring data_, TContents warn_, TContents crit_) : tParent(data_, warn_, crit_) {}
198                MagicCheckContainer(std::wstring data_, std::wstring alias_, TContents warn_, TContents crit_) : tParent(data_, alias_, warn_, crit_) {}
199                MagicCheckContainer(const TThisType &other) : tParent(other) {}
200
201                MagicCheckContainer<TContents>& operator =(const MagicCheckContainer<TContents> &other) {
202                        tParent::operator =(other);
203                        return *this;
204                }
205
206
207                void set_magic(double magic) {
208                        warn.max_.set_magic(magic);
209                        warn.min_.set_magic(magic);
210                        crit.max_.set_magic(magic);
211                        crit.min_.set_magic(magic);
212                }
213
214        };
215
216        template <class value_type>
217        struct check_proxy_interface {
218                virtual bool showAll() = 0;
219                virtual std::wstring gatherPerfData(value_type &value) = 0;
220                virtual bool hasBounds() = 0;
221                virtual void runCheck(value_type &value, NSCAPI::nagiosReturn &returnCode, std::wstring &message, std::wstring &perf) = 0;
222                virtual void set_warn_bound(std::wstring value) = 0;
223                virtual void set_crit_bound(std::wstring value) = 0;
224                virtual void set_showall(showType show_) = 0;
225
226                //virtual std::wstring get_default_alias() = 0;
227
228        };
229
230
231        //typedef enum {showLong, showShort, showProblems, showUnknown} showType;
232        template <class container_value_type, class impl_type>
233        class check_proxy_container : public check_proxy_interface<container_value_type> {
234                typedef check_proxy_container<container_value_type, impl_type> TThisType;
235                impl_type impl_;
236        public:
237                virtual typename impl_type::TPayloadValueType get_value(container_value_type &value) = 0;
238
239                void set_warn_bound(std::wstring value) {
240                        impl_.warn = value;
241                }
242                void set_crit_bound(std::wstring value) {
243                        impl_.crit = value;
244                }
245                void set_alias(std::wstring value) {
246                        impl_.alias = value;
247                }
248
249
250                check_proxy_container() {}
251                /*
252                void setDefault(TThisType def) {
253                        if (!warn.hasBounds())
254                                warn = def.warn;
255                        if (!crit.hasBounds())
256                                crit = def.crit;
257                        if (show == showUnknown)
258                                show = def.show;
259                }
260                */
261                bool showAll() {
262                        return impl_.showAll();
263                }
264                void set_showall(showType show_) {
265                        impl_.show = show_;
266                }
267                std::wstring gatherPerfData(container_value_type &value) {
268                        typename impl_type::TPayloadValueType real_value = get_value(value);
269                        return impl_.gatherPerfData(real_value);
270                }
271                bool hasBounds() {
272                        return impl_.hasBounds();
273                }
274                void runCheck(container_value_type &value, NSCAPI::nagiosReturn &returnCode, std::wstring &message, std::wstring &perf) {
275                        typename impl_type::TPayloadValueType real_value = get_value(value);
276                        return impl_.runCheck(real_value, returnCode, message, perf);
277                }
278        };
279
280
281        template <class value_type>
282        struct check_multi_container {
283                typedef check_multi_container<value_type> TThisType;
284                typedef check_proxy_interface<value_type> check_type;
285                typedef std::list<check_type*> check_list_type;
286                check_list_type checks_;
287                std::wstring data;
288                std::wstring alias;
289
290                std::wstring cached_warn_;
291                std::wstring cached_crit_;
292
293                showType show;
294                bool perfData;
295
296                void set_warn_bound(std::wstring value) {
297//                      if (checks_.empty())
298                                cached_warn_ = value;
299//                      else
300//                              (checks_.back())->set_warn_bound(value);
301                }
302                void set_crit_bound(std::wstring value) {
303//                      if (checks_.empty())
304                                cached_crit_ = value;
305//                      else
306//                              (checks_.back())->set_crit_bound(value);
307                }
308
309                void add_check(check_type *check) {
310                        if (check != NULL) {
311                                if (!cached_warn_.empty())
312                                        check->set_warn_bound(cached_warn_);
313                                if (!cached_crit_.empty())
314                                        check->set_crit_bound(cached_crit_);
315                                checks_.push_back(check);
316                        }
317                        cached_warn_ = _T("");
318                        cached_crit_ = _T("");
319                }
320
321                check_multi_container() : show(showUnknown), perfData(true)
322                {}
323        private:
324                check_multi_container(const TThisType &other)
325                        : data(other.data), alias(other.alias), checks_(other.checks_), show(other.show)
326                {}
327        public:
328                ~check_multi_container() {
329                        for (check_list_type::iterator it=checks_.begin(); it != checks_.end(); ++it) {
330                                delete *it;
331                        }
332                        checks_.clear();
333                }
334                std::wstring getAlias() {
335                        if (alias.empty())
336                                return data;
337                        return alias;
338                }
339                void setDefault(TThisType def) {
340                        if (show == showUnknown)
341                                show = def.show;
342                }
343                bool showAll() {
344                        return show != showProblems;
345                }
346                std::wstring gatherPerfData(value_type &value) {
347                        std::wstring ret;
348                        for (check_list_type::const_iterator cit=checks_.begin(); cit != checks_.end(); ++cit) {
349                                ret += (*cit)->gatherPerfData((*cit)->getAlias(), value);
350                        }
351                }
352                bool hasBounds() {
353                        for (check_list_type::const_iterator cit=checks_.begin(); cit != checks_.end(); ++cit) {
354                                if ((*cit)->hasBounds())
355                                        return true;
356                        }
357                        return false;
358                }
359                void runCheck(value_type value, NSCAPI::nagiosReturn &returnCode, std::wstring &message, std::wstring &perf) {
360                        for (check_list_type::const_iterator cit=checks_.begin(); cit != checks_.end(); ++cit) {
361                                (*cit)->set_showall(show);
362                                (*cit)->runCheck(value, returnCode, message, perf);
363                        }
364                        std::wcout << _T("result: ") << message << std::endl;
365                }
366        };
367
368        typedef unsigned __int64 disk_size_type;
369        template <typename TType = disk_size_type>
370        class disk_size_handler {
371        public:
372                static std::wstring print(TType value) {
373                        return format::format_byte_units(value);
374                }
375                static std::wstring get_perf_unit(TType value) {
376                        return format::find_proper_unit_BKMG(value);
377                }
378                static std::wstring print_perf(TType value, std::wstring unit) {
379                        return format::format_byte_units(value, unit);
380                }
381                static TType parse(std::wstring s) {
382                        TType val = format::decode_byte_units(s);
383                        if (val == 0 && s.length() > 1 && s[0] != L'0')
384                                NSC_LOG_MESSAGE_STD(_T("Maybe this is not what you want: ") + s + _T(" = ") + strEx::itos(val));
385                        return val;
386                }
387                static TType parse_percent(std::wstring s) {
388                        return strEx::stoi64(s);
389                }
390                static std::wstring print_percent(TType value) {
391                        return strEx::itos(value) + _T("%");
392                }
393                static std::wstring print_unformated(TType value) {
394                        return strEx::itos(value);
395                }
396
397                static std::wstring key_total() {
398                        return _T("Total: ");
399                }
400                static std::wstring key_lower() {
401                        return _T("Used: ");
402                }
403                static std::wstring key_upper() {
404                        return _T("Free: ");
405                }
406                static std::wstring key_prefix() {
407                        return _T("");
408                }
409                static std::wstring key_postfix() {
410                        return _T("");
411                }
412
413        };
414
415        typedef unsigned __int64 time_type;
416        template <typename TType = time_type>
417        class time_handler {
418        public:
419                static TType parse(std::wstring s) {
420                        TType val = strEx::stoi64_as_time(s);
421                        if (val == 0 && s.length() > 1 && s[0] != L'0')
422                                NSC_LOG_MESSAGE_STD(_T("Maybe this is not what you want: ") + s + _T(" = 0"));
423                        return val;
424                }
425                static TType parse_percent(std::wstring s) {
426                        return strEx::stoi(s);
427                }
428                static std::wstring print(TType value) {
429                        return strEx::itos_as_time(value);
430                }
431                static std::wstring print_percent(TType value) {
432                        return strEx::itos(value) + _T("%");
433                }
434                static std::wstring print_unformated(TType value) {
435                        return strEx::itos(value);
436                }
437                static std::wstring get_perf_unit(TType value) {
438                        return _T("");
439                }
440                static std::wstring print_perf(TType value, std::wstring unit) {
441                        return strEx::itos(value);
442                }
443                static std::wstring key_prefix() {
444                        return _T("");
445                }
446                static std::wstring key_postfix() {
447                        return _T("");
448                }
449
450        };
451
452
453        class int_handler {
454        public:
455                static int parse(std::wstring s) {
456                        int val = strEx::stoi(s);
457                        if (val == 0 && s.length() > 1 && s[0] != L'0')
458                                NSC_LOG_MESSAGE_STD(_T("Maybe this is not what you want: ") + s + _T(" = 0"));
459                        return val;
460                }
461                static int parse_percent(std::wstring s) {
462                        return strEx::stoi(s);
463                }
464                static std::wstring print(int value) {
465                        return strEx::itos(value);
466                }
467                static std::wstring get_perf_unit(int value) {
468                        return _T("");
469                }
470                static std::wstring print_perf(int value, std::wstring unit) {
471                        return strEx::itos(value);
472                }
473                static std::wstring print_unformated(int value) {
474                        return strEx::itos(value);
475                }
476                static std::wstring print_percent(int value) {
477                        return strEx::itos(value) + _T("%");
478                }
479                static std::wstring key_prefix() {
480                        return _T("");
481                }
482                static std::wstring key_postfix() {
483                        return _T("");
484                }
485        };
486        class int64_handler {
487        public:
488                static __int64 parse(std::wstring s) {
489                        __int64 val = strEx::stoi64(s);
490                        if (val == 0 && s.length() > 1 && s[0] != L'0')
491                                NSC_LOG_MESSAGE_STD(_T("Maybe this is not what you want: ") + s + _T(" = 0"));
492                        return val;
493                }
494                static __int64 parse_percent(std::wstring s) {
495                        return strEx::stoi(s);
496                }
497                static std::wstring print(__int64 value) {
498                        return boost::lexical_cast<std::wstring>(value);
499                }
500                static std::wstring get_perf_unit(__int64 value) {
501                        return _T("");
502                }
503                static std::wstring print_perf(__int64 value, std::wstring unit) {
504                        return boost::lexical_cast<std::wstring>(value);
505                }
506                static std::wstring print_unformated(__int64 value) {
507                        return boost::lexical_cast<std::wstring>(value);
508                }
509                static std::wstring print_percent(__int64 value) {
510                        return boost::lexical_cast<std::wstring>(value) + _T("%");
511                }
512                static std::wstring key_prefix() {
513                        return _T("");
514                }
515                static std::wstring key_postfix() {
516                        return _T("");
517                }
518        };
519        class double_handler {
520        public:
521                static double parse(std::wstring s) {
522                        return strEx::stod(s);
523                }
524                static double parse_percent(std::wstring s) {
525                        return strEx::stod(s);
526                }
527                static std::wstring get_perf_unit(double value) {
528                        return _T("");
529                }
530                static std::wstring print_perf(double value, std::wstring unit) {
531                        return strEx::itos_non_sci(value);
532                }
533                static std::wstring print(double value) {
534                        return strEx::itos(value);
535                }
536                static std::wstring print_unformated(double value) {
537                        return strEx::itos(value);
538                }
539                static std::wstring print_percent(double value) {
540                        return strEx::itos(value) + _T("%");
541                }
542                static std::wstring key_prefix() {
543                        return _T("");
544                }
545                static std::wstring key_postfix() {
546                        return _T("");
547                }
548        };
549
550        typedef unsigned long state_type;
551        const int state_none      = 0x00;
552        const int state_started   = 0x01;
553        const int state_stopped   = 0x02;
554        const int state_not_found = 0x06;
555        const int state_hung      = 0x0e;
556
557        class state_handler {
558        public:
559                static state_type parse(std::wstring s) {
560                        state_type ret = state_none;
561                        strEx::splitList lst = strEx::splitEx(s, _T(","));
562                        for (strEx::splitList::const_iterator it = lst.begin(); it != lst.end(); ++it) {
563                                if (*it == _T("started"))
564                                        ret |= state_started;
565                                else if (*it == _T("stopped"))
566                                        ret |= state_stopped;
567                                else if (*it == _T("ignored"))
568                                        ret |= state_none;
569                                else if (*it == _T("not found"))
570                                        ret |= state_not_found;
571                                else if (*it == _T("hung"))
572                                        ret |= state_hung;
573                        }
574                        return ret;
575                }
576                static std::wstring print(state_type value) {
577                        if (value == state_started)
578                                return _T("started");
579                        else if (value == state_stopped)
580                                return _T("stopped");
581                        else if (value == state_none)
582                                return _T("none");
583                        else if (value == state_not_found)
584                                return _T("not found");
585                        else if (value == state_hung)
586                                return _T("hung");
587                        return _T("unknown");
588                }
589                static std::wstring print_unformated(state_type value) {
590                        return strEx::itos(value);
591                }
592        };
593
594
595        template <typename TType = int, class THandler = int_handler >
596        class NumericBounds {
597        public:
598
599                bool bHasBounds_;
600                TType value_;
601                typedef typename TType TValueType;
602                typedef THandler TFormatType;
603
604                NumericBounds() : bHasBounds_(false), value_(0) {};
605
606                NumericBounds(const NumericBounds & other) {
607                        bHasBounds_ = other.bHasBounds_;
608                        value_ = other.value_;
609                }
610
611                void reset() {
612                        bHasBounds_ = false;
613                }
614                checkResultType check(TType value) const {
615                        if (value == value_)
616                                return same;
617                        else if (value > value_)
618                                return above;
619                        return below;
620                }
621
622                static std::wstring toStringLong(TType value) {
623                        return THandler::key_prefix() + THandler::print(value) + THandler::key_postfix();
624                }
625                static std::wstring toStringShort(TType value) {
626                        return THandler::print(value);
627                }
628                inline bool hasBounds() const {
629                        return bHasBounds_;
630                }
631
632                const NumericBounds & operator=(std::wstring value) {
633                        set(value);
634                        return *this;
635                }
636
637                TType getPerfBound(TType value) {
638                        return value_;
639                }
640                static std::wstring gatherPerfData(std::wstring alias, TType &value, TType warn, TType crit) {
641                        std::wstring unit = THandler::get_perf_unit(min(warn, min(crit, value)));
642                        return MAKE_PERFDATA(alias, THandler::print_perf(value, unit), unit, THandler::print_perf(warn, unit), THandler::print_perf(crit, unit));
643                }
644                static std::wstring gatherPerfData(std::wstring alias, TType &value) {
645                        std::wstring unit = THandler::get_perf_unit(value);
646                        return MAKE_PERFDATA_SIMPLE(alias, THandler::print_perf(value, unit), unit);
647                }
648
649        private:
650                void set(std::wstring s) {
651                        value_ = THandler::parse(s);
652                        bHasBounds_ = true;
653                }
654        };
655
656
657        template <typename TTypeValue, typename TTypeTotal = TTypeValue>
658        struct PercentageValueType {
659                typedef TTypeValue TValueType;
660                TTypeValue value;
661                TTypeTotal total;
662
663                TTypeValue getUpperPercentage() {
664                        return 100-(value*100/total);
665                }
666                TTypeValue getLowerPercentage() {
667                        return (value*100)/total;
668                }
669
670                TTypeValue adjust_upper_magic(TTypeValue percentage, double normal, double magic) {
671                        if (magic == 0)
672                                return percentage;
673                        return 100 - ( (100 - percentage) * pow(total / normal, magic) / (value / normal) );
674                }
675                TTypeValue adjust_lower_magic(TTypeValue percentage, double normal, double magic) {
676                        if (magic == 0)
677                                return percentage;
678                        return ( (percentage) * pow(total / normal, magic) / (value / normal) );
679                }
680
681
682        };
683
684        template <typename TType = int, class THandler = int_handler >
685        class NumericPercentageBounds {
686        public:
687                typedef enum {
688                        none = 0,
689                        percentage_upper = 1,
690                        percentage_lower = 2,
691                        value_upper = 3,
692                        value_lower = 4,
693                } checkTypes;
694
695                class InternalValue {
696                        NumericPercentageBounds *pParent_;
697                        bool isUpper_;
698                public:
699
700                        InternalValue(bool isUpper) : pParent_(NULL), isUpper_(isUpper) {}
701                        void setParent(NumericPercentageBounds *pParent) {
702                                pParent_ = pParent;
703                        }
704                        const InternalValue & operator=(std::wstring value) {
705                                std::wstring::size_type p = value.find_first_of('%');
706                                if (p != std::wstring::npos) {
707                                        if (isUpper_)
708                                                pParent_->setPercentageUpper(value.substr(0, p));
709                                        else
710                                                pParent_->setPercentageLower(value.substr(0, p));
711                                } else {
712                                        if (isUpper_)
713                                                pParent_->setUpper(value);
714                                        else
715                                                pParent_->setLower(value);
716                                }
717                                return *this;
718                        }
719
720                };
721
722                typedef typename TType TValueType;
723                typedef THandler TFormatType;
724                typedef NumericPercentageBounds<TType, THandler> TMyType;
725
726                checkTypes type_;
727                typename TType::TValueType value_;
728                InternalValue upper;
729                InternalValue lower;
730                double normal_size;
731                double magic;
732
733                NumericPercentageBounds() : type_(none), value_(0), upper(true), lower(false), normal_size(20*1024*1024), magic(0) {
734                        upper.setParent(this);
735                        lower.setParent(this);
736                }
737
738                NumericPercentageBounds(const NumericPercentageBounds &other)
739                        : type_(other.type_)
740                        , value_(other.value_)
741                        , upper(other.upper)
742                        , lower(other.lower)
743                        , normal_size(other.normal_size)
744                        , magic(other.magic)
745                {
746                        upper.setParent(this);
747                        lower.setParent(this);
748
749                }
750
751                NumericPercentageBounds& operator =(const NumericPercentageBounds &other) {
752                        type_ = other.type_;
753                        value_ = other.value_;
754                        upper = other.upper;
755                        lower = other.lower;
756                        normal_size = other.normal_size;
757                        magic = other.magic;
758                        upper.setParent(this);
759                        lower.setParent(this);
760                        return *this;
761                }
762                void reset() {
763                        type_ = none;
764                }
765                checkResultType check(TType value) const {
766                        if (type_ == percentage_lower) {
767                                if (value.getLowerPercentage() == value.adjust_lower_magic(value_, normal_size, magic))
768                                        return same;
769                                else if (value.getLowerPercentage() > value.adjust_lower_magic(value_, normal_size, magic))
770                                        return above;
771                        } else if (type_ == percentage_upper) {
772                                if (value.getUpperPercentage() == value.adjust_upper_magic(value_, normal_size, magic))
773                                        return same;
774                                else if (value.getUpperPercentage() > value.adjust_upper_magic(value_, normal_size, magic))
775                                        return above;
776                        } else if (type_ == value_lower) {
777                                if (value.value == value_)
778                                        return same;
779                                else if (value.value > value_)
780                                        return above;
781                        } else if (type_ == value_upper) {
782                                if ((value.total-value.value) == value_)
783                                        return same;
784                                else if ((value.total-value.value) > value_)
785                                        return above;
786                        } else {
787                                std::cout << _T("Damn...: ") << type_ << std::endl;
788                                throw _T("Damn...");
789                        }
790                        return below;
791                }
792                static std::wstring toStringShort(TType value) {
793                        return THandler::print(value.value);
794
795                }
796                static std::wstring toStringLong(TType value) {
797                        return
798                                THandler::key_total() + THandler::print(value.total) +
799                                _T(" - ") + THandler::key_lower() + THandler::print(value.value) +
800                                _T(" (") + THandler::print_percent(value.getLowerPercentage()) + _T(")") +
801                                _T(" - ") + THandler::key_upper() + THandler::print(value.total-value.value) +
802                                _T(" (") + THandler::print_percent(value.getUpperPercentage()) + _T(")");
803                }
804                inline bool hasBounds() const {
805                        return type_ != none;
806                }
807                typename TType::TValueType getPerfBound(TType value) {
808                        return value_;
809                }
810                void set_magic(double magic_) {
811                        magic = magic_;
812                }
813
814                template<class T>
815                T evaluate_percentage_to_value(T total, T threshold_percentage) {
816                        return total*threshold_percentage/100.0;
817                }
818                template<class T>
819                T evaluate_value_to_percentage(T total, T threshold_percentage) {
820                        return 100-(threshold_percentage*100.0/total);
821                }
822
823                std::wstring gatherPerfData(std::wstring alias, TType &value, typename TType::TValueType warn, typename TType::TValueType crit) {
824                        unsigned int value_p, warn_p, crit_p;
825                        TType::TValueType warn_v, crit_v;
826                        if (type_ == percentage_upper) {
827                                value_p = static_cast<unsigned int>(value.getUpperPercentage());
828                                warn_p = static_cast<unsigned int>(warn);
829                                crit_p = static_cast<unsigned int>(crit);
830                                warn_v = evaluate_percentage_to_value(value.total, warn);
831                                crit_v = evaluate_percentage_to_value(value.total, crit);
832                        } else if (type_ == percentage_lower) {
833                                value_p = static_cast<unsigned int>(value.getLowerPercentage());
834                                warn_p = static_cast<unsigned int>(warn);
835                                crit_p = static_cast<unsigned int>(crit);
836                                warn_v = evaluate_percentage_to_value(value.total, warn);
837                                crit_v = evaluate_percentage_to_value(value.total, crit);
838                        } else if (type_ == value_upper) {
839                                value_p = static_cast<unsigned int>(value.getUpperPercentage());
840                                warn_p = evaluate_value_to_percentage(value.total, warn);
841                                crit_p = evaluate_value_to_percentage(value.total, crit);
842                                warn_v = warn;
843                                crit_v = crit;
844                        } else {
845                                value_p = static_cast<unsigned int>(value.getLowerPercentage());
846                                warn_p = evaluate_value_to_percentage(value.total, warn);
847                                crit_p = evaluate_value_to_percentage(value.total, crit);
848                                warn_v = warn;
849                                crit_v = crit;
850                        }
851                        std::wstring unit = THandler::get_perf_unit(min_no_zero(warn_v, crit_v, value.value));
852                        return
853                                MAKE_PERFDATA(alias + _T(" %"), THandler::print_unformated(value_p), _T("%"), THandler::print_unformated(warn_p), THandler::print_unformated(crit_p))
854                                + _T(" ") +
855                                MAKE_PERFDATA_EX(alias, THandler::print_perf(value.value, unit), unit, THandler::print_perf(warn_v, unit), THandler::print_perf(crit_v, unit),
856                                        THandler::print_perf(0, unit), THandler::print_perf(value.total, unit))
857                                ;
858                }
859                template<class T>
860                T min_no_zero(T v1, T v2, T v3) {
861                        if (v1 == 0 && v2 == 0 && v3 == 0)
862                                return 0;
863                        T maximum = max(v1, max(v2, v3));
864                        if (v1 == 0)
865                                v1 = maximum;
866                        if (v2 == 0)
867                                v2 = maximum;
868                        if (v3 == 0)
869                                v3 = maximum;
870                        return min(v1, min(v2, v3));
871                }
872                std::wstring gatherPerfData(std::wstring alias, TType &value) {
873                        unsigned int value_p;
874                        if (type_ == percentage_upper) {
875                                value_p = static_cast<unsigned int>(value.getUpperPercentage());
876                        } else if (type_ == percentage_lower) {
877                                value_p = static_cast<unsigned int>(value.getLowerPercentage());
878                        } else if (type_ == value_upper) {
879                                value_p = static_cast<unsigned int>(value.getUpperPercentage());
880                        } else {
881                                value_p = static_cast<unsigned int>(value.getLowerPercentage());
882                        }
883                        std::wstring unit = THandler::get_perf_unit(value.value);
884                        return
885                                MAKE_PERFDATA_SIMPLE(alias + _T(" %"), THandler::print_unformated(value_p), _T("%"))
886                                + _T(" ") +
887                                MAKE_PERFDATA_SIMPLE(alias, THandler::print_perf(value.value, unit), unit)
888                                ;
889                }
890        private:
891                void setUpper(std::wstring s) {
892                        value_ = THandler::parse(s);
893                        type_ = value_upper;
894                }
895                void setLower(std::wstring s) {
896                        value_ = THandler::parse(s);
897                        type_ = value_lower;
898                }
899                void setPercentageUpper(std::wstring s) {
900                        value_ = THandler::parse_percent(s);
901                        type_ = percentage_upper;
902                }
903                void setPercentageLower(std::wstring s) {
904                        value_ = THandler::parse_percent(s);
905                        type_ = percentage_lower;
906                }
907        };
908
909        template <typename TType = state_type, class THandler = state_handler >
910        class StateBounds {
911        public:
912                TType value_;
913                typedef typename TType TValueType;
914                typedef THandler TFormatType;
915                typedef StateBounds<TType, THandler> TMyType;
916
917                StateBounds() : value_(state_none) {}
918                StateBounds(const StateBounds &other) : value_(other.value_) {}
919
920                void reset() {
921                        value_ = state_none;
922                }
923                bool check(TType value) const {
924                        return (value & value_) != 0;
925                }
926                static std::wstring toStringLong(TType value) {
927                        return THandler::print(value);
928                }
929                static std::wstring toStringShort(TType value) {
930                        return THandler::print(value);
931                }
932                inline bool hasBounds() const {
933                        return value_ != state_none;
934                }
935                TType getPerfBound(TType value) {
936                        return value_;
937                }
938                std::wstring gatherPerfData(std::wstring alias, TType &value, TType warn, TType crit) {
939                        return "";
940                }
941                std::wstring gatherPerfData(std::wstring alias, TType &value) {
942                        return "";
943                }
944                const StateBounds & operator=(std::wstring value) {
945                        set(value);
946                        return *this;
947                }
948        private:
949                void set(std::wstring s) {
950                        value_ = THandler::parse(s);
951                }
952        };
953
954        template <typename TMaxMinType = int, typename TStateType = state_type>
955        struct MaxMinStateValueType {
956                TMaxMinType count;
957                TStateType state;
958        };
959
960
961        template <class TValueType = MaxMinStateValueType, class TNumericHolder = NumericBounds<int, int_handler>, class TStateHolder = StateBounds<state_type, state_handler> >
962        class MaxMinStateBounds {
963        public:
964                TNumericHolder max_;
965                TNumericHolder min_;
966                TStateHolder state;
967                typedef MaxMinStateBounds<TValueType, TNumericHolder, TStateHolder > TMyType;
968
969                typedef typename TValueType TValueType;
970
971                MaxMinStateBounds() {}
972                MaxMinStateBounds(const MaxMinStateBounds &other) : state(other.state), max_(other.max_), min_(other.min_) {}
973                MaxMinStateBounds &     operator =(const MaxMinStateBounds &other) {
974                        state = other.state;
975                        max_ = other.max_;
976                        min_ = other.min_;
977                        return *this;
978                }
979                void reset() {
980                        state.reset();
981                        max_.reset();
982                        min_.reset();
983                }
984                bool hasBounds() {
985                        return state.hasBounds() ||  max_.hasBounds() || min_.hasBounds();
986                }
987
988                static std::wstring toStringLong(typename TValueType &value) {
989                        return TNumericHolder::toStringLong(value.count) + _T(", ") + TStateHolder::toStringLong(value.state);
990                }
991                static std::wstring toStringShort(typename TValueType &value) {
992                        return TNumericHolder::toStringShort(value.count);
993                }
994/*
995                void formatString(std::wstring &message, typename TValueType &value) {
996                        if (state.hasBounds())
997                                message = state.toString(value.state);
998                        else if (max.hasBounds())
999                                message = max.toString(value.count);
1000                        else if (min.hasBounds())
1001                                message = max.toString(value.count);
1002                }
1003                */
1004                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value, TMyType &warn, TMyType &crit) {
1005                        if (max_.hasBounds()) {
1006                                return max_.gatherPerfData(alias, value.count, warn.max_.getPerfBound(value.count), crit.max_.getPerfBound(value.count));
1007                        } else if (min_.hasBounds()) {
1008                                return min_.gatherPerfData(alias, value.count, warn.min_.getPerfBound(value.count), crit.min_.getPerfBound(value.count));
1009                        } else if (state.hasBounds()) {
1010                                return min_.gatherPerfData(alias, value.count, 0, 0);
1011                        }
1012                        return _T("");
1013                }
1014                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value) {
1015                        return _T("");
1016                }
1017                bool check(typename TValueType &value, std::wstring lable, std::wstring &message, ResultType type) {
1018                        if ((state.hasBounds())&&(!state.check(value.state))) {
1019                                message = lable + _T(": ") + formatState(TStateHolder::toStringShort(value.state), type);
1020                                return true;
1021                        } else if ((max_.hasBounds())&&(max_.check(value.count) != below)) {
1022                                message = lable + _T(": ") + formatAbove(TNumericHolder::toStringShort(value.count), type);
1023                                return true;
1024                        } else if ((min_.hasBounds())&&(min_.check(value.count) != above)) {
1025                                message = lable + _T(": ") + formatBelow(TNumericHolder::toStringShort(value.count), type);
1026                                return true;
1027                        } else {
1028                                NSC_LOG_MESSAGE_STD(_T("Missing bounds for check: ") + lable);
1029                                //std::cout << "No bounds specified..." << std::endl;
1030                        }
1031                        return false;
1032                }
1033
1034        };
1035
1036        template <class TFilterType>
1037        class FilterBounds {
1038        public:
1039                TFilterType filter;
1040                typedef typename TFilterType::TValueType TValueType;
1041                typedef FilterBounds<TFilterType> TMyType;
1042
1043                FilterBounds() {}
1044                FilterBounds(const FilterBounds &other) {
1045                        filter = other.filter;
1046                }
1047                void reset() {
1048                        filter.reset();
1049                }
1050                bool hasBounds() {
1051                        return filter.hasFilter();
1052                }
1053
1054                static std::wstring toStringLong(typename TValueType &value) {
1055                        //return filter.to_string() + _T(" matches ") + value;
1056                        // TODO FIx this;
1057                        return value;
1058                        //return TNumericHolder::toStringLong(value.count) + _T(", ") + TStateHolder::toStringLong(value.state);
1059                }
1060                static std::wstring toStringShort(typename TValueType &value) {
1061                        // TODO FIx this;
1062                        return value;
1063                        //return TNumericHolder::toStringShort(value.count);
1064                }
1065                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value, TMyType &warn, TMyType &crit) {
1066                        return _T("");
1067                }
1068                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value) {
1069                        return _T("");
1070                }
1071                bool check(typename TValueType &value, std::wstring lable, std::wstring &message, ResultType type) {
1072                        if (filter.hasFilter()) {
1073                                if (!filter.matchFilter(value))
1074                                        return false;
1075                                message = lable + _T(": ") + filter.to_string() + _T(" matches ") + value;
1076                                return true;
1077                        } else {
1078                                NSC_LOG_MESSAGE_STD(_T("Missing bounds for filter check: ") + lable);
1079                        }
1080                        return false;
1081                }
1082                const TMyType & operator=(std::wstring value) {
1083                        filter = value;
1084                        return *this;
1085                }
1086
1087        };
1088
1089
1090        template <class TStateHolder = StateBounds<state_type, state_handler> >
1091        class SimpleStateBounds {
1092        public:
1093                TStateHolder state;
1094                typedef SimpleStateBounds<TStateHolder > TMyType;
1095
1096                typedef typename TStateHolder::TValueType TValueType;
1097
1098                SimpleStateBounds() {}
1099                SimpleStateBounds(const SimpleStateBounds &other) {
1100                        state = other.state;
1101                }
1102                void reset() {
1103                        state.reset();
1104                }
1105                bool hasBounds() {
1106                        return state.hasBounds();
1107                }
1108                static std::wstring toStringLong(typename TValueType &value) {
1109                        return TStateHolder::toStringLong(value);
1110                }
1111                static std::wstring toStringShort(typename TValueType &value) {
1112                        return TStateHolder::toStringShort(value);
1113                }
1114                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value, TMyType &warn, TMyType &crit) {
1115                        if (state.hasBounds()) {
1116                                // @todo
1117                        }
1118                        return _T("");
1119                }
1120                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value) {
1121                        return _T("");
1122                }
1123                bool check(typename TValueType &value, std::wstring lable, std::wstring &message, ResultType type) {
1124                        if ((state.hasBounds())&&(!state.check(value))) {
1125                                message = lable + _T(": ") + formatState(TStateHolder::toStringLong(value), type);
1126                                return true;
1127                        }
1128                        return false;
1129                }
1130
1131        };
1132
1133        template <class THolder = NumericBounds<int, int_handler> >
1134        class MaxMinBounds {
1135        public:
1136                THolder max_;
1137                THolder min_;
1138                typedef MaxMinBounds<THolder > TMyType;
1139
1140                typedef typename THolder::TValueType TValueType;
1141                //              typedef THolder::TFormatType TFormatType;
1142
1143                MaxMinBounds() {}
1144                MaxMinBounds(const MaxMinBounds &other) : max_(other.max_), min_(other.min_) {}
1145                MaxMinBounds& operator=(const MaxMinBounds &other) {
1146                        max_ = other.max_;
1147                        min_ = other.min_;
1148                        return *this;
1149                }
1150                void reset() {
1151                        max_.reset();
1152                        min_.reset();
1153                }
1154                bool hasBounds() {
1155                        return max_.hasBounds() || min_.hasBounds();
1156                }
1157                static std::wstring toStringLong(typename THolder::TValueType &value) {
1158                        return THolder::toStringLong(value);
1159                }
1160                static std::wstring toStringShort(typename THolder::TValueType &value) {
1161                        return THolder::toStringShort(value);
1162                }
1163                std::wstring gatherPerfData(std::wstring alias, typename THolder::TValueType &value, TMyType &warn, TMyType &crit) {
1164                        if (max_.hasBounds()) {
1165                                return max_.gatherPerfData(alias, value, warn.max_.getPerfBound(value), crit.max_.getPerfBound(value));
1166                        } else if (min_.hasBounds()) {
1167                                return min_.gatherPerfData(alias, value, warn.min_.getPerfBound(value), crit.min_.getPerfBound(value));
1168                        } else {
1169                                NSC_LOG_MESSAGE_STD(_T("Missing bounds for maxmin-bounds check: ") + alias);
1170                                return min_.gatherPerfData(alias, value, 0, 0);
1171                        }
1172                        return _T("");
1173                }
1174                std::wstring gatherPerfData(std::wstring alias, typename THolder::TValueType &value) {
1175                        THolder tmp;
1176                        return tmp.gatherPerfData(alias, value);
1177                }
1178                bool check(typename THolder::TValueType &value, std::wstring lable, std::wstring &message, ResultType type) {
1179                        if ((max_.hasBounds())&&(max_.check(value) != below)) {
1180                                message = lable + _T(": ") + formatAbove(THolder::toStringLong(value), type);
1181                                return true;
1182                        } else if ((min_.hasBounds())&&(min_.check(value) != above)) {
1183                                message = lable + _T(": ") + formatBelow(THolder::toStringLong(value), type);
1184                                return true;
1185                        } else {
1186                                //std::cout << "No bounds specified..." << std::endl;
1187                        }
1188                        return false;
1189                }
1190
1191        };
1192        typedef MaxMinBounds<NumericBounds<double, double_handler> > MaxMinBoundsDouble;
1193        typedef MaxMinBounds<NumericBounds<__int64, int64_handler> > MaxMinBoundsInt64;
1194        typedef MaxMinBounds<NumericBounds<int, int_handler> > MaxMinBoundsInteger;
1195        typedef MaxMinBounds<NumericBounds<unsigned int, int_handler> > MaxMinBoundsUInteger;
1196        typedef MaxMinBounds<NumericBounds<unsigned long int, int_handler> > MaxMinBoundsULongInteger;
1197        typedef MaxMinBounds<NumericBounds<disk_size_type, disk_size_handler<disk_size_type> > > MaxMinBoundsDiscSize;
1198        typedef MaxMinBounds<NumericBounds<time_type, time_handler<time_type> > > MaxMinBoundsTime;
1199
1200
1201        template <class THolder = NumericBounds<int, int_handler> >
1202        class ExactBounds {
1203        public:
1204                THolder max;
1205                THolder min;
1206                THolder eq;
1207                THolder neq;
1208                typedef ExactBounds<THolder > TMyType;
1209                typedef typename THolder::TValueType TValueType;
1210
1211                ExactBounds() {}
1212                ExactBounds(const ExactBounds &other) {
1213                        max = other.max;
1214                        min = other.min;
1215                        eq = other.eq;
1216                        neq = other.neq;
1217                }
1218
1219                const TMyType& operator=(std::wstring value) {
1220                        //value_ = value;
1221                        if (value.substr(0,1) == _T(">")) {
1222                                max = value.substr(1);
1223                        } else if (value.substr(0,2) == _T("<>")) {
1224                                neq = value.substr(2);
1225                        } else if (value.substr(0,1) == _T("<")) {
1226                                min = value.substr(1);
1227                        } else if (value.substr(0,1) == _T("=")) {
1228                                eq = value.substr(1);
1229                        } else if (value.substr(0,2) == _T("!=")) {
1230                                neq = value.substr(2);
1231                        } else if (value.substr(0,1) == _T("!")) {
1232                                neq = value.substr(1);
1233                                /*
1234                                TODO add support for lists
1235                        } else if (value.substr(0,3) == _T("in:")) {
1236                                inList = value.substr(3);
1237                                */
1238                        } else if (value.substr(0,3) == _T("gt:")) {
1239                                max = value.substr(3);
1240                        } else if (value.substr(0,3) == _T("lt:")) {
1241                                min = value.substr(3);
1242                        } else if (value.substr(0,3) == _T("ne:")) {
1243                                neq = value.substr(3);
1244                        } else if (value.substr(0,3) == _T("eq:")) {
1245                                eq = value.substr(3);
1246                        } else {
1247                                throw parse_exception(_T("Unknown filter key: ") + value + _T(" (numeric filters have to have an operator as well ie. foo=>5 or bar==5 foo=gt:6)"));
1248                        }
1249                        return *this;
1250                }
1251
1252                void reset() {
1253                        max.reset();
1254                        min.reset();
1255                        eq.reset();
1256                        neq.reset();
1257                }
1258                bool hasBounds() {
1259                        return max.hasBounds() || min.hasBounds() || eq.hasBounds() || neq.hasBounds();
1260                }
1261                static std::wstring toStringLong(typename THolder::TValueType &value) {
1262                        return THolder::toStringLong(value);
1263                }
1264                static std::wstring toStringShort(typename THolder::TValueType &value) {
1265                        return THolder::toStringShort(value);
1266                }
1267                std::wstring gatherPerfData(std::wstring alias, typename THolder::TValueType &value, TMyType &warn, TMyType &crit) {
1268                        if (max.hasBounds()) {
1269                                return max.gatherPerfData(alias, value, warn.max.getPerfBound(value), crit.max.getPerfBound(value));
1270                        } else if (min.hasBounds()) {
1271                                return min.gatherPerfData(alias, value, warn.min.getPerfBound(value), crit.min.getPerfBound(value));
1272                        } else if (neq.hasBounds()) {
1273                                return neq.gatherPerfData(alias, value, warn.neq.getPerfBound(value), crit.neq.getPerfBound(value));
1274                        } else if (eq.hasBounds()) {
1275                                return eq.gatherPerfData(alias, value, warn.eq.getPerfBound(value), crit.eq.getPerfBound(value));
1276                        } else {
1277                                NSC_LOG_MESSAGE_STD(_T("Missing bounds for: ") + alias);
1278                                return _T("");
1279                        }
1280                }
1281                std::wstring gatherPerfData(std::wstring alias, typename THolder::TValueType &value) {
1282                        THolder tmp;
1283                        return tmp.gatherPerfData(alias, value);
1284                }
1285                bool check(typename THolder::TValueType &value, std::wstring lable, std::wstring &message, ResultType type) {
1286                        return check_preformatted(value, THolder::toStringLong(value), lable, message, type);
1287                }
1288                bool check_preformatted(typename THolder::TValueType &value, std::wstring formatted_value, std::wstring lable, std::wstring &message, ResultType type) {
1289                        if ((max.hasBounds())&&(max.check(value) == above)) {
1290                                message = lable + _T(": ") + formatAbove(formatted_value, type);
1291                                return true;
1292                        } else if ((min.hasBounds())&&(min.check(value) == below)) {
1293                                message = lable + _T(": ") + formatBelow(formatted_value, type);
1294                                return true;
1295                        } else if ((eq.hasBounds())&&(eq.check(value) == same)) {
1296                                message = lable + _T(": ") + formatSame(formatted_value, type);
1297                                return true;
1298                        } else if ((neq.hasBounds())&&(neq.check(value) != same)) {
1299                                message = lable + _T(": ") + formatNotSame(formatted_value, type);
1300                                return true;
1301                        } else {
1302                                //std::cout << "No bounds specified..." << std::endl;
1303                        }
1304                        return false;
1305                }
1306        };
1307        typedef ExactBounds<NumericBounds<unsigned long int, int_handler> > ExactBoundsULongInteger;
1308        typedef ExactBounds<NumericBounds<unsigned int, int_handler> > ExactBoundsUInteger;
1309        typedef ExactBounds<NumericBounds<unsigned long, int_handler> > ExactBoundsULong;
1310        typedef ExactBounds<NumericBounds<long long, int_handler> > ExactBoundsLongLong;
1311        typedef ExactBounds<NumericBounds<time_type, time_handler<__int64> > > ExactBoundsTime;
1312
1313        //typedef MaxMinBounds<NumericPercentageBounds<PercentageValueType<int ,int>, int_handler> > MaxMinPercentageBoundsInteger;
1314        //typedef MaxMinBounds<NumericPercentageBounds<PercentageValueType<__int64, __int64>, int64_handler> > MaxMinPercentageBoundsInt64;
1315        //typedef MaxMinBounds<NumericPercentageBounds<PercentageValueType<double, double>, double_handler> > MaxMinPercentageBoundsDouble;
1316        typedef MaxMinBounds<NumericPercentageBounds<PercentageValueType<disk_size_type, disk_size_type>, disk_size_handler<> > > MaxMinPercentageBoundsDiskSize;
1317        typedef MaxMinBounds<NumericPercentageBounds<PercentageValueType<__int64, __int64>, disk_size_handler<__int64> > > MaxMinPercentageBoundsDiskSizei64;
1318
1319        typedef MaxMinStateBounds<MaxMinStateValueType<int, state_type>, NumericBounds<int, int_handler>, StateBounds<state_type, state_handler> > MaxMinStateBoundsStateBoundsInteger;
1320        typedef SimpleStateBounds<StateBounds<state_type, state_handler> > SimpleBoundsStateBoundsInteger;
1321}
1322
1323
Note: See TracBrowser for help on using the repository browser.