aboutsummaryrefslogtreecommitdiff
path: root/diagnostics/containers-of-containers.hxx
blob: 02608256abaf6423373bb4e49207ed6ea4832f62 (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
62
63
64
65
66
67
68
69
// file      : common/id/auto/test.hxx
// copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#include <map>
#include <vector>

#ifdef ODB_COMPILER
#  if defined(ODB_DATABASE_PGSQL)
#    define BLOB_TYPE "BYTEA"
#  elif defined(ODB_DATABASE_MSSQL)
#    define BLOB_TYPE "VARBINARY(max)"
#  else
#    define BLOB_TYPE "BLOB"
#  endif
#endif

#pragma db value
struct value_cont
{
  int n;
  std::vector<int> v;
};

#pragma db value
struct value_blob
{
  int n;
  #pragma db type(BLOB_TYPE)
  std::vector<char> v;
};

#pragma db object
struct object
{
  #pragma db id
  int id;

  //std::vector<std::vector<int> > vv;

  std::vector<value_cont> vc;
  std::map<int, value_cont> mc;

  std::vector<value_blob> vb;
  std::map<int, value_blob> mb;
};

/*

#include <array>
#include <vector>

using float3 = std::array<float, 3>;

#pragma db value(float3) transient
#pragma db member(float3::e1) virtual(float) get(this[0]) set(this[0])
#pragma db member(float3::e2) virtual(float) get(this[1]) set(this[1])
#pragma db member(float3::e3) virtual(float) get(this[2]) set(this[2])

#pragma db object
struct object
{
  #pragma db id
  int id;

  std::vector<float3> vf3;
};

*/