28 #define GINGA_PRAGMA_DIAG PRAGMA_DIAG 29 #define GINGA_PRAGMA_DIAG_PUSH PRAGMA_DIAG_PUSH 30 #define GINGA_PRAGMA_DIAG_POP PRAGMA_DIAG_POP 31 #define GINGA_PRAGMA_DIAG_IGNORE PRAGMA_DIAG_IGNORE 32 #define GINGA_PRAGMA_DIAG_WARNING PRAGMA_DIAG_WARNING 41 GINGA_PRAGMA_DIAG_PUSH ()
42 GINGA_PRAGMA_DIAG_IGNORE (-Wcast-qual)
43 GINGA_PRAGMA_DIAG_IGNORE (-Wconversion)
44 #include <gst/app/gstappsink.h> 46 #include <gst/video/video.h> 47 GINGA_PRAGMA_DIAG_POP ()
61 #define GINGA_NAMESPACE_BEGIN namespace ginga { 62 #define GINGA_NAMESPACE_END } 68 #define unused(...) G_GNUC_UNUSED __VA_ARGS__ 71 #define cast(a, b) (dynamic_cast<a>((b))) 72 #define instanceof(a, b) (cast (a,(b)) != nullptr) 74 #define tryinsert(a, b, fn) \ 75 (std::count ((b).begin (), (b).end (), (a)) == 0) \ 76 ? ((b).fn (a), true) : false 78 #define MAP_GET_IMPL(m, a, b) \ 81 auto it = (m).find ((a)); \ 82 if (it == (m).end ()) \ 84 tryset ((b), it->second); \ 89 #define MAP_SET_IMPL(m, a, b) \ 92 auto it = (m).find ((a)); \ 94 return it == (m).end (); \ 99 #define GINGA_STRFUNC (__ginga_strfunc (G_STRFUNC)).c_str () 100 string __ginga_strfunc (
const string &);
101 #define __ginga_log(fn, fmt, ...)\ 102 fn ("%s: " fmt, GINGA_STRFUNC, ## __VA_ARGS__) 104 #define TRACE(fmt, ...) __ginga_log (g_debug, fmt, ## __VA_ARGS__) 105 #define WARNING(fmt, ...) __ginga_log (g_warning, fmt, ## __VA_ARGS__) 106 #define ERROR(fmt, ...) __ginga_log (g_error, fmt, ## __VA_ARGS__) 107 #define CRITICAL(fmt, ...) __ginga_log (g_critical, fmt, ## __VA_ARGS__) 109 #define ERROR_NOT_IMPLEMENTED(fmt, ...)\ 110 ERROR ("not implemented: " fmt, ## __VA_ARGS__) 113 typedef GdkRGBA Color;
114 typedef GdkRectangle Rect;
115 typedef GstClockTime Time;
118 #define GINGA_TIME_NONE GST_CLOCK_TIME_NONE 119 #define GINGA_TIME_IS_VALID(t) GST_CLOCK_TIME_IS_VALID ((t)) 120 #define GINGA_STIME_NONE GST_CLOCK_STIME_NONE 121 #define GINGA_STIME_IS_VALID(t) GST_CLOCK_STIME_IS_VALID ((t)) 122 #define GINGA_SECOND GST_SECOND 123 #define GINGA_MSECOND GST_MSECOND 124 #define GINGA_USECOND GST_USECOND 125 #define GINGA_NSECOND GST_NSECOND 126 #define GINGA_TIME_AS_SECONDS(t) GST_TIME_AS_SECONDS ((t)) 127 #define GINGA_TIME_AS_MSECONDS(t) GST_TIME_AS_MSECONDS ((t)) 128 #define GINGA_TIME_AS_USECONDS(t) GST_TIME_AS_USECONDS ((t)) 129 #define GINGA_TIME_AS_NSECONDS(t) GST_TIME_AS_NSECONDS ((t)) 130 #define GINGA_TIME_DIFF(s,e) GST_CLOCK_DIFF ((s), (e)) 131 #define GINGA_TIME_FORMAT GST_TIME_FORMAT 132 #define GINGA_TIME_ARGS(t) GST_TIME_ARGS ((t)) 133 #define GINGA_STIME_FORMAT GST_STIME_FORMAT 134 #define GINGA_STIME_ARGS(t) GST_STIME_ARGS ((t)) 137 bool floateq (
double,
double,
double epsilon=.0000001);
138 #define doubleeq floateq 141 bool try_parse_bool (
const string &,
bool *);
142 bool parse_bool (
const string &);
144 bool try_parse_color (
const string &, Color *);
145 Color parse_color (
const string &);
147 bool try_parse_list (
const string &,
char,
size_t,
size_t, list<string> *);
148 list<string> parse_list (
const string &,
char,
size_t,
size_t);
150 bool try_parse_table (
const string &, map<string, string> *);
151 map<string, string> parse_table (
const string &);
153 bool try_parse_time (
const string &, Time *);
154 Time parse_time (
const string &);
156 int parse_percent (
const string &,
int,
int,
int);
157 guint8 parse_pixel (
const string &);
160 bool _xstrtod (
const string &,
double *);
161 bool _xstrtoll (
const string &, gint64 *, guint);
162 bool _xstrtoull (
const string &, guint64 *, guint);
163 double xstrtod (
const string &);
164 gint xstrtoint (
const string &, guint8);
165 gint8 xstrtoint8 (
const string &, guint8);
166 gint64 xstrtoint64 (
const string &, guint8);
167 guint xstrtouint (
const string &, guint8);
168 guint8 xstrtouint8 (
const string &, guint8);
169 guint64 xstrtouint64 (
const string &, guint8);
170 bool xstrispercent (
const string &);
171 double xstrtodorpercent (
const string &,
bool *);
172 int xstrcasecmp (
const string &,
const string &);
173 #define xstrcaseeq(s1, s2) (xstrcasecmp ((s1), (s2)) == 0) 174 bool xstrhasprefix (
const string &,
const string &);
175 bool xstrhassuffix (
const string &,
const string &);
176 int G_GNUC_PRINTF (2,3) xstrassign (
string &, const
char *, ...);
177 string G_GNUC_PRINTF (1,2) xstrbuild (const
char *, ...);
178 string xstrstrip (
string);
179 list<
string> xstrsplit (const
string &,
char);
182 string xpathbasename (
string);
183 string xpathdirname (
string);
184 bool xpathisabs (const
string &);
185 bool xpathisuri (const
string &);
186 string xpathmakeabs (
string);
187 string xpathbuild (const
string &, const
string &);
188 string xpathbuildabs (const
string &, const
string &);
191 typedef
void (*UserDataCleanFunc)(
void *);
197 bool getData (
const string &,
void **);
198 bool setData (
const string &,
void *, UserDataCleanFunc fn=
nullptr);
200 map<string,pair<void *, void (*)(void *)>> _udata;
204 using namespace ginga;
206 #endif // AUX_GINGA_H
Definition: aux-ginga.h:192