/[svn]/gigedit/trunk/src/param.cpp
ViewVC logotype

Contents of /gigedit/trunk/src/param.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1052 - (show annotations) (download)
Sat Mar 3 12:20:01 2007 UTC (13 years, 1 month ago) by persson
File size: 757 byte(s)
Initial revision

1 #include <gig.h>
2
3 template<typename T>
4 class Param {
5 protected:
6 gig::DimensionRegion* object;
7 public:
8 virtual T& access() = 0;
9 };
10
11 template<typename T>
12 class Param1 : public Param<T> {
13 using Param<T>::object;
14 T gig::DimensionRegion::* param;
15 public:
16 Param1(T gig::DimensionRegion::* param) : param(param) { }
17 T& access();
18 };
19
20 template<typename T>
21 T& Param1<T>::access() {
22 printf("ojsan");
23 return object->*param;
24 }
25
26 class ParamUnityNote : public Param<uint8_t> {
27 public:
28 uint8_t& access() {
29 printf("hejsan\n");
30 return object->UnityNote; }
31 };
32
33
34 int main() {
35 ParamUnityNote p1;
36 Param1<uint8_t> p2(&gig::DimensionRegion::ChannelOffset);
37 Param<uint8_t>& pp = p1;
38 printf("%d\n", pp.access());
39 }

  ViewVC Help
Powered by ViewVC