aboutsummaryrefslogtreecommitdiff
path: root/common/const/test.hxx
blob: 7e8a71802089327fe09a498122051362a5916d73 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// file      : common/const/test.hxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#ifndef TEST_HXX
#define TEST_HXX

#include <memory>
#include <odb/core.hxx>

struct obj1;
struct obj2;

typedef obj1* obj1_ptr;
typedef const obj1* obj1_cptr;

typedef std::auto_ptr<obj2> obj2_ptr;
typedef std::auto_ptr<const obj2> obj2_cptr;

#pragma db object pointer (obj1_ptr)
struct obj1
{
  obj1 () {}
  obj1 (int i): id (i) {}

  #pragma db id
  int id;

  void f () {}
  void cf () const {}
};

#pragma db object pointer (obj2_ptr)
struct obj2
{
  obj2 () {}
  obj2 (int i): id (i) {}

  #pragma db id
  int id;

  void f () {}
  void cf () const {}
};

#pragma db object
struct aggr
{
  aggr (int i): id (i), o1 (0) {}
  aggr (): o1 (0) {}
  ~aggr () {delete o1;}

  #pragma db id
  int id;

  obj1_cptr o1;
  obj2_cptr o2;
};

#endif // TEST_HXX