9 #ifndef GEPETTO_VIEWER_MACROS_HH
10 #define GEPETTO_VIEWER_MACROS_HH
12 #if __cplusplus > 199711L
16 using std::shared_ptr;
18 using std::static_pointer_cast;
19 using std::dynamic_pointer_cast;
24 #include <boost/shared_ptr.hpp>
25 #include <boost/weak_ptr.hpp>
28 using boost::shared_ptr;
29 using boost::weak_ptr;
30 using boost::static_pointer_cast;
31 using boost::dynamic_pointer_cast;
37 #include <osg/ref_ptr>
40 #define ASSERT(condition, message) \
42 if (! (condition)) { \
43 std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
44 << " line " << __LINE__ << ": " << message << std::endl; \
45 std::exit(EXIT_FAILURE); \
50 #define DEF_CLASS_SMART_PTR(className) \
52 typedef ::gepetto::viewer::shared_ptr<className> className##Ptr_t; \
53 typedef ::gepetto::viewer::shared_ptr<const className> className##ConstPtr_t; \
54 typedef ::gepetto::viewer::weak_ptr<className> className##WeakPtr; \
55 typedef ::gepetto::viewer::weak_ptr<const className> className##ConstWeakPtr; \
57 #define DEF_OSG_CLASS_REF_PTR(className) \
59 typedef ::osg::ref_ptr< className > className##RefPtr; \
60 typedef ::osg::observer_ptr< className > className##ObserverPtr;
62 #define SCENE_VIEWER_ACCEPT_VISITOR \
64 virtual void accept (NodeVisitor& nv) { if (nv.valid(*this)) { nv.apply (*this); } } \
66 #endif // GEPETTO_VIEWER_MACROS_HH