gepetto-viewer 6.0.0
An user-friendly Graphical Interface
Loading...
Searching...
No Matches
macros.h
Go to the documentation of this file.
1//
2// macros.h
3// gepetto-viewer
4//
5// Created by Justin Carpentier, Mathieu Geisert in November 2014.
6// Copyright (c) 2014 LAAS-CNRS. All rights reserved.
7//
8
9#ifndef GEPETTO_VIEWER_MACROS_HH
10#define GEPETTO_VIEWER_MACROS_HH
11
12#if __cplusplus > 199711L
13#include <memory>
14namespace gepetto {
15namespace viewer {
16using std::dynamic_pointer_cast;
17using std::shared_ptr;
18using std::static_pointer_cast;
19using std::weak_ptr;
20} // namespace viewer
21} // namespace gepetto
22#else
23#ifndef Q_MOC_RUN
24#include <boost/shared_ptr.hpp>
25#include <boost/weak_ptr.hpp>
26namespace gepetto {
27namespace viewer {
28using boost::dynamic_pointer_cast;
29using boost::shared_ptr;
30using boost::static_pointer_cast;
31using boost::weak_ptr;
32} // namespace viewer
33} // namespace gepetto
34#endif
35#endif
36
37#include <osg/ref_ptr>
38
40#define ASSERT(condition, message) \
41 do { \
42 if (!(condition)) { \
43 std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
44 << " line " << __LINE__ << ": " << message << std::endl; \
45 std::exit(EXIT_FAILURE); \
46 } \
47 } while (false)
48
51#define DEF_CLASS_SMART_PTR(className) \
52 class className; \
53 typedef ::gepetto::viewer::shared_ptr<className> className##Ptr_t; \
54 typedef ::gepetto::viewer::shared_ptr<const className> \
55 className##ConstPtr_t; \
56 typedef ::gepetto::viewer::weak_ptr<className> className##WeakPtr; \
57 typedef ::gepetto::viewer::weak_ptr<const className> className##ConstWeakPtr;
58
59#define DEF_OSG_CLASS_REF_PTR(className) \
60 /*class className;*/ \
61 typedef ::osg::ref_ptr<className> className##RefPtr; \
62 typedef ::osg::observer_ptr<className> className##ObserverPtr;
63
64#define SCENE_VIEWER_ACCEPT_VISITOR \
65 \
66 virtual void accept(NodeVisitor& nv) { \
67 if (nv.valid(*this)) { \
68 nv.apply(*this); \
69 } \
70 }
71
72#endif // GEPETTO_VIEWER_MACROS_HH
Definition action-search-bar.hh:27