Line data Source code
1 : // Copyright (c) 2019 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/snapdatabase
4 : // contact@m2osw.com
5 : //
6 : // This program is free software; you can redistribute it and/or modify
7 : // it under the terms of the GNU General Public License as published by
8 : // the Free Software Foundation; either version 2 of the License, or
9 : // (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License along
17 : // with this program; if not, write to the Free Software Foundation, Inc.,
18 : // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 : #pragma once
20 :
21 :
22 : /** \file
23 : * \brief Cell header.
24 : *
25 : * A row is composed of cells. Whenever you access the database, you create
26 : * rows and add cells to it.
27 : *
28 : * Note that a cell must be defned in the schema of a table to be allowed
29 : * in a row.
30 : */
31 :
32 : // self
33 : //
34 : #include "snapdatabase/bigint/bigint.h"
35 : #include "snapdatabase/data/schema.h"
36 :
37 :
38 :
39 : namespace snapdatabase
40 : {
41 :
42 :
43 :
44 0 : class cell
45 : {
46 : public:
47 : typedef std::shared_ptr<cell> pointer_t;
48 : typedef std::map<std::string, pointer_t> map_t;
49 :
50 : cell(schema_column::pointer_t t);
51 :
52 : schema_column::pointer_t schema() const;
53 :
54 : bool is_void() const;
55 : void set_void();
56 :
57 : int8_t get_int8() const;
58 : void set_int8(int8_t value);
59 :
60 : uint8_t get_uint8() const;
61 : void set_uint8(uint8_t value);
62 :
63 : int16_t get_int16() const;
64 : void set_int16(int16_t value);
65 :
66 : uint16_t get_uint16() const;
67 : void set_uint16(uint16_t value);
68 :
69 : int32_t get_int32() const;
70 : void set_int32(int32_t value);
71 :
72 : uint32_t get_uint32() const;
73 : void set_uint32(uint32_t value);
74 :
75 : int64_t get_int64() const;
76 : void set_int64(int64_t value);
77 :
78 : uint64_t get_uint64() const;
79 : void set_uint64(uint64_t value);
80 :
81 : int512_t get_int128() const;
82 : void set_int128(int512_t value);
83 :
84 : uint512_t get_uint128() const;
85 : void set_uint128(uint512_t value);
86 :
87 : int512_t get_int256() const;
88 : void set_int256(int512_t value);
89 :
90 : uint512_t get_uint256() const;
91 : void set_uint256(uint512_t value);
92 :
93 : int512_t get_int512() const;
94 : void set_int512(int512_t value);
95 :
96 : uint512_t get_uint512() const;
97 : void set_uint512(uint512_t value);
98 :
99 : float get_float32() const;
100 : void set_float32(float value);
101 :
102 : double get_float64() const;
103 : void set_float64(double value);
104 :
105 : long double get_float128() const;
106 : void set_float128(long double value);
107 :
108 : version_t get_version() const;
109 : void set_version(version_t value);
110 :
111 : std::string get_string() const;
112 : void set_string(std::string const & value);
113 :
114 : private:
115 : schema_column::pointer_t f_schema_column = schema_column::pointer_t();
116 : uint512_t f_integer = uint512_t();
117 : long double f_float_value = 0.0L;
118 : std::string f_string = std::string();
119 : };
120 :
121 :
122 :
123 : } // namespace snapdatabase
124 : // vim: ts=4 sw=4 et
|