ANNA Suite  2020b
Multipurpose development suite for Telco applications
ShortBlock.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_dbms_ShortBlock_hpp
10 #define anna_dbms_ShortBlock_hpp
11 
12 #include <string>
13 
15 #include <anna/core/DataBlock.hpp>
16 
17 #include <anna/dbms/Data.hpp>
18 
19 namespace anna {
20 
21 namespace dbms {
22 
31 class ShortBlock : public Data {
32 public:
39  explicit ShortBlock(const int maxSize, const bool isNulleable = false) :
40  Data(Type::ShortBlock, maxSize, isNulleable),
41  a_value(true) {
42  a_value.allocate(maxSize);
43  Data::setBuffer((void*) a_value.getData());
44  }
45 
50  ShortBlock(const ShortBlock& other) :
51  Data(other),
52  a_value(true) {
53  a_value = other.a_value;
54  Data::setBuffer((void*) a_value.getData());
55  }
56 
60  virtual ~ShortBlock() {;}
61 
66  int getSize() const { return a_value.getSize(); }
67 
73  const anna::DataBlock& getValue() const { return a_value; }
74 
80  ShortBlock& operator = (const ShortBlock& other) noexcept(false);
81 
87  ShortBlock& operator = (const anna::DataBlock& value) noexcept(false);
88 
93  operator anna::DataBlock& () { return a_value; }
94 
99  operator const anna::DataBlock& () const { return a_value; }
100 
105  std::string asString() const ;
106 
107 protected:
109 };
110 
111 }
112 }
113 
114 #endif
115 
const anna::DataBlock & getValue() const
Definition: ShortBlock.hpp:73
void setBuffer(void *buffer)
Definition: Data.hpp:131
const char * getData() const
Definition: DataBlock.hpp:86
ShortBlock(const int maxSize, const bool isNulleable=false)
Definition: ShortBlock.hpp:39
Definition: Data.hpp:29
Definition: Data.hpp:27
Definition: ShortBlock.hpp:31
std::string asString() const
ShortBlock & operator=(const ShortBlock &other) noexcept(false)
int getSize() const
Definition: DataBlock.hpp:78
virtual ~ShortBlock()
Definition: ShortBlock.hpp:60
ShortBlock(const ShortBlock &other)
Definition: ShortBlock.hpp:50
Definition: app.hpp:12
bool isNulleable() const
Definition: Data.hpp:68
anna::DataBlock a_value
Definition: ShortBlock.hpp:108
void allocate(const int nbytes) noexcept(false)
Definition: DataBlock.hpp:24
int getSize() const
Definition: ShortBlock.hpp:66