source: nscp/include/checkHelpers.hpp @ c3f233d

0.4.10.4.2
Last change on this file since c3f233d was c3f233d, checked in by Michael Medin <michael@…>, 12 months ago
  • Fixed some gcc compile issues
  • Fixed a lot of gcc -Wall warnings
  • Fixed some issues with real time eventlog.
  • Extended the event log unit tests to encompass the new real-time checks.
  • Property mode set to 100644
File size: 41.8 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                checkTypes type_;
723                typename TType::TValueType value_;
724                typedef typename TType TValueType;
725                typedef THandler TFormatType;
726                typedef NumericPercentageBounds<TType, THandler> TMyType;
727                InternalValue upper;
728                InternalValue lower;
729                double normal_size;
730                double magic;
731
732                NumericPercentageBounds() : type_(none), upper(true), lower(false), magic(0), normal_size(20*1024*1024) {
733                        upper.setParent(this);
734                        lower.setParent(this);
735                }
736
737                NumericPercentageBounds(const NumericPercentageBounds &other)
738                        : type_(other.type_)
739                        , value_(other.value_)
740                        , magic(other.magic)
741                        , normal_size(other.normal_size)
742                        , upper(other.upper)
743                        , lower(other.lower)
744                {
745                        upper.setParent(this);
746                        lower.setParent(this);
747
748                }
749
750                NumericPercentageBounds& operator =(const NumericPercentageBounds &other) {
751                        type_ = other.type_;
752                        value_ = other.value_;
753                        magic = other.magic;
754                        normal_size = other.normal_size;
755                        upper = other.upper;
756                        lower = other.lower;
757                        upper.setParent(this);
758                        lower.setParent(this);
759                        return *this;
760                }
761                void reset() {
762                        type_ = none;
763                }
764                checkResultType check(TType value) const {
765                        if (type_ == percentage_lower) {
766                                if (value.getLowerPercentage() == value.adjust_lower_magic(value_, normal_size, magic))
767                                        return same;
768                                else if (value.getLowerPercentage() > value.adjust_lower_magic(value_, normal_size, magic))
769                                        return above;
770                        } else if (type_ == percentage_upper) {
771                                if (value.getUpperPercentage() == value.adjust_upper_magic(value_, normal_size, magic))
772                                        return same;
773                                else if (value.getUpperPercentage() > value.adjust_upper_magic(value_, normal_size, magic))
774                                        return above;
775                        } else if (type_ == value_lower) {
776                                if (value.value == value_)
777                                        return same;
778                                else if (value.value > value_)
779                                        return above;
780                        } else if (type_ == value_upper) {
781                                if ((value.total-value.value) == value_)
782                                        return same;
783                                else if ((value.total-value.value) > value_)
784                                        return above;
785                        } else {
786                                std::cout << _T("Damn...: ") << type_ << std::endl;
787                                throw _T("Damn...");
788                        }
789                        return below;
790                }
791                static std::wstring toStringShort(TType value) {
792                        return THandler::print(value.value);
793
794                }
795                static std::wstring toStringLong(TType value) {
796                        return
797                                THandler::key_total() + THandler::print(value.total) +
798                                _T(" - ") + THandler::key_lower() + THandler::print(value.value) +
799                                _T(" (") + THandler::print_percent(value.getLowerPercentage()) + _T(")") +
800                                _T(" - ") + THandler::key_upper() + THandler::print(value.total-value.value) +
801                                _T(" (") + THandler::print_percent(value.getUpperPercentage()) + _T(")");
802                }
803                inline bool hasBounds() const {
804                        return type_ != none;
805                }
806                typename TType::TValueType getPerfBound(TType value) {
807                        return value_;
808                }
809                void set_magic(double magic_) {
810                        magic = magic_;
811                }
812
813                template<class T>
814                T evaluate_percentage_to_value(T total, T threshold_percentage) {
815                        return total*threshold_percentage/100.0;
816                }
817                template<class T>
818                T evaluate_value_to_percentage(T total, T threshold_percentage) {
819                        return 100-(threshold_percentage*100.0/total);
820                }
821
822                std::wstring gatherPerfData(std::wstring alias, TType &value, typename TType::TValueType warn, typename TType::TValueType crit) {
823                        unsigned int value_p, warn_p, crit_p;
824                        TType::TValueType warn_v, crit_v;
825                        if (type_ == percentage_upper) {
826                                value_p = static_cast<unsigned int>(value.getUpperPercentage());
827                                warn_p = static_cast<unsigned int>(warn);
828                                crit_p = static_cast<unsigned int>(crit);
829                                warn_v = evaluate_percentage_to_value(value.total, warn);
830                                crit_v = evaluate_percentage_to_value(value.total, crit);
831                        } else if (type_ == percentage_lower) {
832                                value_p = static_cast<unsigned int>(value.getLowerPercentage());
833                                warn_p = static_cast<unsigned int>(warn);
834                                crit_p = static_cast<unsigned int>(crit);
835                                warn_v = evaluate_percentage_to_value(value.total, warn);
836                                crit_v = evaluate_percentage_to_value(value.total, crit);
837                        } else if (type_ == value_upper) {
838                                value_p = static_cast<unsigned int>(value.getUpperPercentage());
839                                warn_p = evaluate_value_to_percentage(value.total, warn);
840                                crit_p = evaluate_value_to_percentage(value.total, crit);
841                                warn_v = static_cast<unsigned int>(warn);
842                                crit_v = static_cast<unsigned int>(crit);
843                        } else {
844                                value_p = static_cast<unsigned int>(value.getLowerPercentage());
845                                warn_p = evaluate_value_to_percentage(value.total, warn);
846                                crit_p = evaluate_value_to_percentage(value.total, crit);
847                                warn_v = static_cast<unsigned int>(warn);
848                                crit_v = static_cast<unsigned int>(crit);
849                        }
850                        std::wstring unit = THandler::get_perf_unit(min(warn_v, min(crit_v, value.value)));
851                        return
852                                MAKE_PERFDATA(alias + _T(" %"), THandler::print_unformated(value_p), _T("%"), THandler::print_unformated(warn_p), THandler::print_unformated(crit_p))
853                                + _T(" ") +
854                                MAKE_PERFDATA_EX(alias, THandler::print_perf(value.value, unit), unit, THandler::print_perf(warn_v, unit), THandler::print_perf(crit_v, unit),
855                                        THandler::print_perf(0, unit), THandler::print_perf(value.total, unit))
856                                ;
857                }
858                std::wstring gatherPerfData(std::wstring alias, TType &value) {
859                        unsigned int value_p;
860                        if (type_ == percentage_upper) {
861                                value_p = static_cast<unsigned int>(value.getUpperPercentage());
862                        } else if (type_ == percentage_lower) {
863                                value_p = static_cast<unsigned int>(value.getLowerPercentage());
864                        } else if (type_ == value_upper) {
865                                value_p = static_cast<unsigned int>(value.getUpperPercentage());
866                        } else {
867                                value_p = static_cast<unsigned int>(value.getLowerPercentage());
868                        }
869                        std::wstring unit = THandler::get_perf_unit(value.value);
870                        return
871                                MAKE_PERFDATA_SIMPLE(alias + _T(" %"), THandler::print_unformated(value_p), _T("%"))
872                                + _T(" ") +
873                                MAKE_PERFDATA_SIMPLE(alias, THandler::print_perf(value.value, unit), unit)
874                                ;
875                }
876        private:
877                void setUpper(std::wstring s) {
878                        value_ = THandler::parse(s);
879                        type_ = value_upper;
880                }
881                void setLower(std::wstring s) {
882                        value_ = THandler::parse(s);
883                        type_ = value_lower;
884                }
885                void setPercentageUpper(std::wstring s) {
886                        value_ = THandler::parse_percent(s);
887                        type_ = percentage_upper;
888                }
889                void setPercentageLower(std::wstring s) {
890                        value_ = THandler::parse_percent(s);
891                        type_ = percentage_lower;
892                }
893        };
894
895        template <typename TType = state_type, class THandler = state_handler >
896        class StateBounds {
897        public:
898                TType value_;
899                typedef typename TType TValueType;
900                typedef THandler TFormatType;
901                typedef StateBounds<TType, THandler> TMyType;
902
903                StateBounds() : value_(state_none) {}
904                StateBounds(const StateBounds &other) : value_(other.value_) {}
905
906                void reset() {
907                        value_ = state_none;
908                }
909                bool check(TType value) const {
910                        return (value & value_) != 0;
911                }
912                static std::wstring toStringLong(TType value) {
913                        return THandler::print(value);
914                }
915                static std::wstring toStringShort(TType value) {
916                        return THandler::print(value);
917                }
918                inline bool hasBounds() const {
919                        return value_ != state_none;
920                }
921                TType getPerfBound(TType value) {
922                        return value_;
923                }
924                std::wstring gatherPerfData(std::wstring alias, TType &value, TType warn, TType crit) {
925                        return "";
926                }
927                std::wstring gatherPerfData(std::wstring alias, TType &value) {
928                        return "";
929                }
930                const StateBounds & operator=(std::wstring value) {
931                        set(value);
932                        return *this;
933                }
934        private:
935                void set(std::wstring s) {
936                        value_ = THandler::parse(s);
937                }
938        };
939
940        template <typename TMaxMinType = int, typename TStateType = state_type>
941        struct MaxMinStateValueType {
942                TMaxMinType count;
943                TStateType state;
944        };
945
946
947        template <class TValueType = MaxMinStateValueType, class TNumericHolder = NumericBounds<int, int_handler>, class TStateHolder = StateBounds<state_type, state_handler> >
948        class MaxMinStateBounds {
949        public:
950                TNumericHolder max_;
951                TNumericHolder min_;
952                TStateHolder state;
953                typedef MaxMinStateBounds<TValueType, TNumericHolder, TStateHolder > TMyType;
954
955                typedef typename TValueType TValueType;
956
957                MaxMinStateBounds() {}
958                MaxMinStateBounds(const MaxMinStateBounds &other) : state(other.state), max_(other.max_), min_(other.min_) {}
959                MaxMinStateBounds &     operator =(const MaxMinStateBounds &other) {
960                        state = other.state;
961                        max_ = other.max_;
962                        min_ = other.min_;
963                        return *this;
964                }
965                void reset() {
966                        state.reset();
967                        max_.reset();
968                        min_.reset();
969                }
970                bool hasBounds() {
971                        return state.hasBounds() ||  max_.hasBounds() || min_.hasBounds();
972                }
973
974                static std::wstring toStringLong(typename TValueType &value) {
975                        return TNumericHolder::toStringLong(value.count) + _T(", ") + TStateHolder::toStringLong(value.state);
976                }
977                static std::wstring toStringShort(typename TValueType &value) {
978                        return TNumericHolder::toStringShort(value.count);
979                }
980/*
981                void formatString(std::wstring &message, typename TValueType &value) {
982                        if (state.hasBounds())
983                                message = state.toString(value.state);
984                        else if (max.hasBounds())
985                                message = max.toString(value.count);
986                        else if (min.hasBounds())
987                                message = max.toString(value.count);
988                }
989                */
990                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value, TMyType &warn, TMyType &crit) {
991                        if (max_.hasBounds()) {
992                                return max_.gatherPerfData(alias, value.count, warn.max_.getPerfBound(value.count), crit.max_.getPerfBound(value.count));
993                        } else if (min_.hasBounds()) {
994                                return min_.gatherPerfData(alias, value.count, warn.min_.getPerfBound(value.count), crit.min_.getPerfBound(value.count));
995                        } else if (state.hasBounds()) {
996                                return min_.gatherPerfData(alias, value.count, 0, 0);
997                        }
998                        return _T("");
999                }
1000                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value) {
1001                        return _T("");
1002                }
1003                bool check(typename TValueType &value, std::wstring lable, std::wstring &message, ResultType type) {
1004                        if ((state.hasBounds())&&(!state.check(value.state))) {
1005                                message = lable + _T(": ") + formatState(TStateHolder::toStringShort(value.state), type);
1006                                return true;
1007                        } else if ((max_.hasBounds())&&(max_.check(value.count) != below)) {
1008                                message = lable + _T(": ") + formatAbove(TNumericHolder::toStringShort(value.count), type);
1009                                return true;
1010                        } else if ((min_.hasBounds())&&(min_.check(value.count) != above)) {
1011                                message = lable + _T(": ") + formatBelow(TNumericHolder::toStringShort(value.count), type);
1012                                return true;
1013                        } else {
1014                                NSC_LOG_MESSAGE_STD(_T("Missing bounds for check: ") + lable);
1015                                //std::cout << "No bounds specified..." << std::endl;
1016                        }
1017                        return false;
1018                }
1019
1020        };
1021
1022        template <class TFilterType>
1023        class FilterBounds {
1024        public:
1025                TFilterType filter;
1026                typedef typename TFilterType::TValueType TValueType;
1027                typedef FilterBounds<TFilterType> TMyType;
1028
1029                FilterBounds() {}
1030                FilterBounds(const FilterBounds &other) {
1031                        filter = other.filter;
1032                }
1033                void reset() {
1034                        filter.reset();
1035                }
1036                bool hasBounds() {
1037                        return filter.hasFilter();
1038                }
1039
1040                static std::wstring toStringLong(typename TValueType &value) {
1041                        //return filter.to_string() + _T(" matches ") + value;
1042                        // TODO FIx this;
1043                        return value;
1044                        //return TNumericHolder::toStringLong(value.count) + _T(", ") + TStateHolder::toStringLong(value.state);
1045                }
1046                static std::wstring toStringShort(typename TValueType &value) {
1047                        // TODO FIx this;
1048                        return value;
1049                        //return TNumericHolder::toStringShort(value.count);
1050                }
1051                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value, TMyType &warn, TMyType &crit) {
1052                        return _T("");
1053                }
1054                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value) {
1055                        return _T("");
1056                }
1057                bool check(typename TValueType &value, std::wstring lable, std::wstring &message, ResultType type) {
1058                        if (filter.hasFilter()) {
1059                                if (!filter.matchFilter(value))
1060                                        return false;
1061                                message = lable + _T(": ") + filter.to_string() + _T(" matches ") + value;
1062                                return true;
1063                        } else {
1064                                NSC_LOG_MESSAGE_STD(_T("Missing bounds for filter check: ") + lable);
1065                        }
1066                        return false;
1067                }
1068                const TMyType & operator=(std::wstring value) {
1069                        filter = value;
1070                        return *this;
1071                }
1072
1073        };
1074
1075
1076        template <class TStateHolder = StateBounds<state_type, state_handler> >
1077        class SimpleStateBounds {
1078        public:
1079                TStateHolder state;
1080                typedef SimpleStateBounds<TStateHolder > TMyType;
1081
1082                typedef typename TStateHolder::TValueType TValueType;
1083
1084                SimpleStateBounds() {}
1085                SimpleStateBounds(const SimpleStateBounds &other) {
1086                        state = other.state;
1087                }
1088                void reset() {
1089                        state.reset();
1090                }
1091                bool hasBounds() {
1092                        return state.hasBounds();
1093                }
1094                static std::wstring toStringLong(typename TValueType &value) {
1095                        return TStateHolder::toStringLong(value);
1096                }
1097                static std::wstring toStringShort(typename TValueType &value) {
1098                        return TStateHolder::toStringShort(value);
1099                }
1100                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value, TMyType &warn, TMyType &crit) {
1101                        if (state.hasBounds()) {
1102                                // @todo
1103                        }
1104                        return _T("");
1105                }
1106                std::wstring gatherPerfData(std::wstring alias, typename TValueType &value) {
1107                        return _T("");
1108                }
1109                bool check(typename TValueType &value, std::wstring lable, std::wstring &message, ResultType type) {
1110                        if ((state.hasBounds())&&(!state.check(value))) {
1111                                message = lable + _T(": ") + formatState(TStateHolder::toStringLong(value), type);
1112                                return true;
1113                        }
1114                        return false;
1115                }
1116
1117        };
1118
1119        template <class THolder = NumericBounds<int, int_handler> >
1120        class MaxMinBounds {
1121        public:
1122                THolder max_;
1123                THolder min_;
1124                typedef MaxMinBounds<THolder > TMyType;
1125
1126                typedef typename THolder::TValueType TValueType;
1127                //              typedef THolder::TFormatType TFormatType;
1128
1129                MaxMinBounds() {}
1130                MaxMinBounds(const MaxMinBounds &other) : max_(other.max_), min_(other.min_) {}
1131                MaxMinBounds& operator=(const MaxMinBounds &other) {
1132                        max_ = other.max_;
1133                        min_ = other.min_;
1134                        return *this;
1135                }
1136                void reset() {
1137                        max_.reset();
1138                        min_.reset();
1139                }
1140                bool hasBounds() {
1141                        return max_.hasBounds() || min_.hasBounds();
1142                }
1143                static std::wstring toStringLong(typename THolder::TValueType &value) {
1144                        return THolder::toStringLong(value);
1145                }
1146                static std::wstring toStringShort(typename THolder::TValueType &value) {
1147                        return THolder::toStringShort(value);
1148                }
1149                std::wstring gatherPerfData(std::wstring alias, typename THolder::TValueType &value, TMyType &warn, TMyType &crit) {
1150                        if (max_.hasBounds()) {
1151                                return max_.gatherPerfData(alias, value, warn.max_.getPerfBound(value), crit.max_.getPerfBound(value));
1152                        } else if (min_.hasBounds()) {
1153                                return min_.gatherPerfData(alias, value, warn.min_.getPerfBound(value), crit.min_.getPerfBound(value));
1154                        } else {
1155                                NSC_LOG_MESSAGE_STD(_T("Missing bounds for maxmin-bounds check: ") + alias);
1156                                return min_.gatherPerfData(alias, value, 0, 0);
1157                        }
1158                        return _T("");
1159                }
1160                std::wstring gatherPerfData(std::wstring alias, typename THolder::TValueType &value) {
1161                        THolder tmp;
1162                        return tmp.gatherPerfData(alias, value);
1163                }
1164                bool check(typename THolder::TValueType &value, std::wstring lable, std::wstring &message, ResultType type) {
1165                        if ((max_.hasBounds())&&(max_.check(value) != below)) {
1166                                message = lable + _T(": ") + formatAbove(THolder::toStringLong(value), type);
1167                                return true;
1168                        } else if ((min_.hasBounds())&&(min_.check(value) != above)) {
1169                                message = lable + _T(": ") + formatBelow(THolder::toStringLong(value), type);
1170                                return true;
1171                        } else {
1172                                //std::cout << "No bounds specified..." << std::endl;
1173                        }
1174                        return false;
1175                }
1176
1177        };
1178        typedef MaxMinBounds<NumericBounds<double, double_handler> > MaxMinBoundsDouble;
1179        typedef MaxMinBounds<NumericBounds<__int64, int64_handler> > MaxMinBoundsInt64;
1180        typedef MaxMinBounds<NumericBounds<int, int_handler> > MaxMinBoundsInteger;
1181        typedef MaxMinBounds<NumericBounds<unsigned int, int_handler> > MaxMinBoundsUInteger;
1182        typedef MaxMinBounds<NumericBounds<unsigned long int, int_handler> > MaxMinBoundsULongInteger;
1183        typedef MaxMinBounds<NumericBounds<disk_size_type, disk_size_handler<disk_size_type> > > MaxMinBoundsDiscSize;
1184        typedef MaxMinBounds<NumericBounds<time_type, time_handler<time_type> > > MaxMinBoundsTime;
1185
1186
1187        template <class THolder = NumericBounds<int, int_handler> >
1188        class ExactBounds {
1189        public:
1190                THolder max;
1191                THolder min;
1192                THolder eq;
1193                THolder neq;
1194                typedef ExactBounds<THolder > TMyType;
1195                typedef typename THolder::TValueType TValueType;
1196
1197                ExactBounds() {}
1198                ExactBounds(const ExactBounds &other) {
1199                        max = other.max;
1200                        min = other.min;
1201                        eq = other.eq;
1202                        neq = other.neq;
1203                }
1204
1205                const TMyType& operator=(std::wstring value) {
1206                        //value_ = value;
1207                        if (value.substr(0,1) == _T(">")) {
1208                                max = value.substr(1);
1209                        } else if (value.substr(0,2) == _T("<>")) {
1210                                neq = value.substr(2);
1211                        } else if (value.substr(0,1) == _T("<")) {
1212                                min = value.substr(1);
1213                        } else if (value.substr(0,1) == _T("=")) {
1214                                eq = value.substr(1);
1215                        } else if (value.substr(0,2) == _T("!=")) {
1216                                neq = value.substr(2);
1217                        } else if (value.substr(0,1) == _T("!")) {
1218                                neq = value.substr(1);
1219                                /*
1220                                TODO add support for lists
1221                        } else if (value.substr(0,3) == _T("in:")) {
1222                                inList = value.substr(3);
1223                                */
1224                        } else if (value.substr(0,3) == _T("gt:")) {
1225                                max = value.substr(3);
1226                        } else if (value.substr(0,3) == _T("lt:")) {
1227                                min = value.substr(3);
1228                        } else if (value.substr(0,3) == _T("ne:")) {
1229                                neq = value.substr(3);
1230                        } else if (value.substr(0,3) == _T("eq:")) {
1231                                eq = value.substr(3);
1232                        } else {
1233                                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)"));
1234                        }
1235                        return *this;
1236                }
1237
1238                void reset() {
1239                        max.reset();
1240                        min.reset();
1241                        eq.reset();
1242                        neq.reset();
1243                }
1244                bool hasBounds() {
1245                        return max.hasBounds() || min.hasBounds() || eq.hasBounds() || neq.hasBounds();
1246                }
1247                static std::wstring toStringLong(typename THolder::TValueType &value) {
1248                        return THolder::toStringLong(value);
1249                }
1250                static std::wstring toStringShort(typename THolder::TValueType &value) {
1251                        return THolder::toStringShort(value);
1252                }
1253                std::wstring gatherPerfData(std::wstring alias, typename THolder::TValueType &value, TMyType &warn, TMyType &crit) {
1254                        if (max.hasBounds()) {
1255                                return max.gatherPerfData(alias, value, warn.max.getPerfBound(value), crit.max.getPerfBound(value));
1256                        } else if (min.hasBounds()) {
1257                                return min.gatherPerfData(alias, value, warn.min.getPerfBound(value), crit.min.getPerfBound(value));
1258                        } else if (neq.hasBounds()) {
1259                                return neq.gatherPerfData(alias, value, warn.neq.getPerfBound(value), crit.neq.getPerfBound(value));
1260                        } else if (eq.hasBounds()) {
1261                                return eq.gatherPerfData(alias, value, warn.eq.getPerfBound(value), crit.eq.getPerfBound(value));
1262                        } else {
1263                                NSC_LOG_MESSAGE_STD(_T("Missing bounds for: ") + alias);
1264                                return _T("");
1265                        }
1266                }
1267                std::wstring gatherPerfData(std::wstring alias, typename THolder::TValueType &value) {
1268                        THolder tmp;
1269                        return tmp.gatherPerfData(alias, value);
1270                }
1271                bool check(typename THolder::TValueType &value, std::wstring lable, std::wstring &message, ResultType type) {
1272                        return check_preformatted(value, THolder::toStringLong(value), lable, message, type);
1273                }
1274                bool check_preformatted(typename THolder::TValueType &value, std::wstring formatted_value, std::wstring lable, std::wstring &message, ResultType type) {
1275                        if ((max.hasBounds())&&(max.check(value) == above)) {
1276                                message = lable + _T(": ") + formatAbove(formatted_value, type);
1277                                return true;
1278                        } else if ((min.hasBounds())&&(min.check(value) == below)) {
1279                                message = lable + _T(": ") + formatBelow(formatted_value, type);
1280                                return true;
1281                        } else if ((eq.hasBounds())&&(eq.check(value) == same)) {
1282                                message = lable + _T(": ") + formatSame(formatted_value, type);
1283                                return true;
1284                        } else if ((neq.hasBounds())&&(neq.check(value) != same)) {
1285                                message = lable + _T(": ") + formatNotSame(formatted_value, type);
1286                                return true;
1287                        } else {
1288                                //std::cout << "No bounds specified..." << std::endl;
1289                        }
1290                        return false;
1291                }
1292        };
1293        typedef ExactBounds<NumericBounds<unsigned long int, int_handler> > ExactBoundsULongInteger;
1294        typedef ExactBounds<NumericBounds<unsigned int, int_handler> > ExactBoundsUInteger;
1295        typedef ExactBounds<NumericBounds<unsigned long, int_handler> > ExactBoundsULong;
1296        typedef ExactBounds<NumericBounds<long long, int_handler> > ExactBoundsLongLong;
1297        typedef ExactBounds<NumericBounds<time_type, time_handler<__int64> > > ExactBoundsTime;
1298
1299        //typedef MaxMinBounds<NumericPercentageBounds<PercentageValueType<int ,int>, int_handler> > MaxMinPercentageBoundsInteger;
1300        //typedef MaxMinBounds<NumericPercentageBounds<PercentageValueType<__int64, __int64>, int64_handler> > MaxMinPercentageBoundsInt64;
1301        //typedef MaxMinBounds<NumericPercentageBounds<PercentageValueType<double, double>, double_handler> > MaxMinPercentageBoundsDouble;
1302        typedef MaxMinBounds<NumericPercentageBounds<PercentageValueType<disk_size_type, disk_size_type>, disk_size_handler<> > > MaxMinPercentageBoundsDiskSize;
1303        typedef MaxMinBounds<NumericPercentageBounds<PercentageValueType<__int64, __int64>, disk_size_handler<__int64> > > MaxMinPercentageBoundsDiskSizei64;
1304
1305        typedef MaxMinStateBounds<MaxMinStateValueType<int, state_type>, NumericBounds<int, int_handler>, StateBounds<state_type, state_handler> > MaxMinStateBoundsStateBoundsInteger;
1306        typedef SimpleStateBounds<StateBounds<state_type, state_handler> > SimpleBoundsStateBoundsInteger;
1307}
1308
1309
Note: See TracBrowser for help on using the repository browser.