1 /* === S I N F G =========================================================== */
3 ** \brief Template Header
5 ** $Id: template.h,v 1.1.1.1 2005/01/04 01:23:09 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SINFG_NODEBASE_H
25 #define __SINFG_NODEBASE_H
27 /* === H E A D E R S ======================================================= */
29 #include "../protocol.h"
30 #include "../string.h"
32 #include <sigc++/slot.h>
34 /* === M A C R O S ========================================================= */
38 #define DEFINE_SIMPLE_FUNC(func_name, ret_type) \
39 private: sigc::slot<ret_type> slot_##func_name; \
40 public: ret_type func_name() { return slot_##func_name(); }
42 #define DEFINE_SIMPLE_FUNC_CONST(func_name, ret_type) \
43 private: sigc::slot<ret_type> slotconst_##func_name; \
44 public: ret_type func_name()const { return slotconst_##func_name(); }
46 #define DECLARE_FUNC(func_name, ret_type, ...) \
47 private: sigc::slot<ret_type, __VA_ARGS__> slot_##func_name;
48 // public: ret_type func_name(__VA_ARGS__)
50 #define DECLARE_FUNC_CONST(func_name, ret_type, ...) \
51 private: sigc::slot<ret_type, __VA_ARGS__> slotconst_##func_name;
53 // public: ret_type func_name(__VA_ARGS__)const
55 #define DEFINE_FUNC(func_name, ret_type, arg_list, ...) \
56 public: ret_type func_name(__VA_ARGS__) { return slot_##func_name arg_list; }
58 #define DEFINE_FUNC_CONST(func_name, ret_type, arg_list, ...) \
59 public: ret_type func_name(__VA_ARGS__)const { return slotconst_##func_name arg_list; }
61 #define DEFINE_DATA(data_name, data_type) \
62 DEFINE_SIMPLE_FUNC_CONST(get_ ## data_name, data_type); \
63 DECLARE_FUNC(set_ ## data_name, void, data_type); \
64 DEFINE_FUNC(set_ ## data_name, void, (x), data_type x)
67 /* === T Y P E D E F S ===================================================== */
69 /* === C L A S S E S & S T R U C T S ======================================= */
74 class NodeBase : public Protocol
78 PX_DEFINE_DATA(guid, GUID)
80 PX_DEFINE_FUNC(func_test, float, int, int)
82 PX_DEFINE_DATA(id, String)
84 PX_DEFINE_DATA(root, NodeHandle)
86 PX_DEFINE_FUNC(signal_changed, sigc::signal<void>)
87 PX_DEFINE_FUNC(signal_deleted, sigc::signal<void>)
89 PX_DEFINE_FUNC_CONST(get_parents, const NodeList)
90 PX_DEFINE_FUNC_CONST(get_children, const NodeList)
92 PX_DEFINE_FUNC(query_children, NodeList, Query)
94 }; // END of class Proto::NodeBase
96 }; // END of namespace Proto
97 }; // END of namespace sinfg
99 /* === E N D =============================================================== */