summaryrefslogtreecommitdiffhomepage
path: root/flowgraph/data.h
blob: 65bac8f7be0b6563a96d51a4a033e126213ee195 (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
70
71
72
73
74
// Basic Data types, abstract (not yet machine specific)

#pragma once

#include <cstdint>
#include <memory>
#include <vector>

namespace FlowGraph {

 // Data models:
 // 64 bit Linux:   LLP64
 // 64 bit Windows: LP64
 //
 // Explicitely NOT defined here:
 //  * Size (same as Pointer, LongLong on Linux and Windows)
 //  * Bool (Byte)
 //  * Long (different on Linux (64 bit) and Windows (32 bit))
 enum class DataType: int
 {
  Char,     // 8 bit
  UChar,    // 8 bit

  Short,    // 16 bit on 64 bit Linux and Windows
  UShort,

  Int,      // 32 bit on 64 bit Linux and Windows
  UInt,

  LongLong, // 64 bit on 64 bit Linux and Windows
  ULongLong,

  Pointer,  // 64 bit on 64 bit Linux and Windows, size is same size

  Float,    // 32 bit, IEEE 754
  Double    // 64 bit, IEEE 754
 };

 class Storage; ///< forward declaration

 // Argument for Operations
 // -> includes identity of data point, e.g. a local int variable
 // Built up as a list of Data instances for global and local data points in parallel to FlowGraph
 class Data
 {
 public:
  Data(DataType type, std::shared_ptr<Storage> storage);
  DataType type() const;
  std::shared_ptr<Storage> storage() const;
  bool operator==(const Data& other) const;
 private:
  const DataType m_type;
  std::shared_ptr<Storage> m_storage;
 };

}

namespace GlobalData {

#if 0
 // variable of simple or struct type
 class Element
 {
 private:
  size_t size;
  std::vector<uint8_t> data; // may be empty if uninitialized
 };

 class Segment: public std::vector<Element>
 {
 };
#endif

}