Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RoadLogEvent.h « libqhullcpp « src « qhull « src « xs - github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7c4cfba0de3aca93583c947ecdb38805624daf17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/****************************************************************************
**
** Copyright (c) 2008-2015 C.B. Barber. All rights reserved.
** $Id: //main/2015/qhull/src/libqhullcpp/RoadLogEvent.h#1 $$Change: 1981 $
** $DateTime: 2015/09/28 20:26:32 $$Author: bbarber $
**
****************************************************************************/

#ifndef ROADLOGEVENT_H
#define ROADLOGEVENT_H

#include <ostream>
#include <stdexcept>
#include <string>

namespace orgQhull {

#//!\name Defined here
    //! RoadLogEvent -- Record an event for the RoadLog
    struct RoadLogEvent;

struct RoadLogEvent {

public:
#//!\name Fields
    const char *    format_string; //! Format string (a literal with format codes, for logging)
    int             int_1;       //! Integer argument (%d, for logging)
    int             int_2;       //! Integer argument (%d, for logging)
    float           float_1;     //! Float argument (%f, for logging)
    union {                      //! One additional argument (for logging)
        const char *cstr_1;      //!   Cstr argument (%s) -- type checked at construct-time
        const void *void_1;      //!   Void* argument (%x) -- Use upper-case codes for object types
        long long   int64_1;     //!   signed int64 (%i).  Ambiguous if unsigned is also defined.
        double      double_1;    //!   Double argument (%e)
    };

#//!\name Constants

#//!\name Constructors
    RoadLogEvent() : format_string(0), int_1(0), int_2(0), float_1(0), int64_1(0) {};
    explicit RoadLogEvent(const char *fmt) : format_string(fmt), int_1(0), int_2(0), float_1(0), int64_1(0) {};
    RoadLogEvent(const char *fmt, int d) : format_string(fmt), int_1(d), int_2(0), float_1(0), int64_1(0) {};
    RoadLogEvent(const char *fmt, int d, int d2) : format_string(fmt), int_1(d), int_2(d2), float_1(0), int64_1(0) {};
    RoadLogEvent(const char *fmt, int d, int d2, float f) : format_string(fmt), int_1(d), int_2(d2), float_1(f), int64_1(0) {};
    RoadLogEvent(const char *fmt, int d, int d2, float f, const char *s) : format_string(fmt), int_1(d), int_2(d2), float_1(f), cstr_1(s) {};
    RoadLogEvent(const char *fmt, int d, int d2, float f, const void *x) : format_string(fmt), int_1(d), int_2(d2), float_1(f), void_1(x) {};
    RoadLogEvent(const char *fmt, int d, int d2, float f, int i) : format_string(fmt), int_1(d), int_2(d2), float_1(f), int64_1(i) {};
    RoadLogEvent(const char *fmt, int d, int d2, float f, long long i) : format_string(fmt), int_1(d), int_2(d2), float_1(f), int64_1(i) {};
    RoadLogEvent(const char *fmt, int d, int d2, float f, double g) : format_string(fmt), int_1(d), int_2(d2), float_1(f), double_1(g) {};
    ~RoadLogEvent() {};
    //! Default copy constructor and assignment

#//!\name GetSet
    bool                isValid() const { return format_string!=0; }
    int                 int1() const { return int_1; };
    int                 int2() const { return int_2; };
    float               float1() const { return float_1; };
    const char *        format() const { return format_string; };
    const char *        cstr1() const { return cstr_1; };
    const void *        void1() const { return void_1; };
    long long           int64() const { return int64_1; };
    double              double1() const { return double_1; };

#//!\name Conversion

    std::string        toString(const char* tag, int code) const;

private:
#//!\name Class helpers
    static bool         firstExtraCode(std::ostream &os, char c, char *extraCode);


};//class RoadLogEvent

}//namespace orgQhull

#endif // ROADLOGEVENT_H