File: sgi-statusaction.h

package info (click to toggle)
mixviews 1.10-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,440 kB
  • ctags: 6,314
  • sloc: cpp: 31,647; ansic: 2,100; makefile: 1,782; sh: 17
file content (36 lines) | stat: -rw-r--r-- 1,167 bytes parent folder | download | duplicates (3)
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
// sgi-statusaction.h

// this is an ugly ugly hack for the native SGI CC compiler which chokes on
// templates.  Yack!

#if defined(__STDC__) || defined(__ANSI_CPP__)
#define __StatusCallback(T) T##_StatusCallback
#define StatusCallback(T) __StatusCallback(T)
#define __StatusMemberFunction(T) T##_StatusMemberFunction
#define StatusMemberFunction(T) __StatusMemberFunction(T)
#else
#define __StatusCallback(T) T/**/_StatusCallback
#define StatusCallback(T) __StatusCallback(T)
#define __StatusMemberFunction(T) T/**/_StatusMemberFunction
#define StatusMemberFunction(T) __StatusMemberFunction(T)
#endif

#define declareStatusCallback(T) \
typedef int (T::*StatusMemberFunction(T))(); \
class StatusCallback(T) : public StatusAction { \
public: \
    StatusCallback(T)(T*, StatusMemberFunction(T)); \
\
    virtual int operator () (void); \
private: \
    T* myObject; \
    StatusMemberFunction(T) myFunction; \
};

#define implementStatusCallback(T) \
StatusCallback(T)::StatusCallback(T)(T* obj, StatusMemberFunction(T) func) { \
    myObject = obj; \
    myFunction = func; \
} \
\
int StatusCallback(T)::operator () (void) { return (myObject->*myFunction)(); }