Safir SDK Core
Loading...
Searching...
No Matches
EnumerationContainerBase.h
Go to the documentation of this file.
1/******************************************************************************
2*
3* Copyright Saab AB, 2006-2013 (http://safirsdkcore.com)
4*
5* Created by: Lars Hagström / stlrha
6*
7*******************************************************************************
8*
9* This file is part of Safir SDK Core.
10*
11* Safir SDK Core is free software: you can redistribute it and/or modify
12* it under the terms of version 3 of the GNU General Public License as
13* published by the Free Software Foundation.
14*
15* Safir SDK Core is distributed in the hope that it will be useful,
16* but WITHOUT ANY WARRANTY; without even the implied warranty of
17* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18* GNU General Public License for more details.
19*
20* You should have received a copy of the GNU General Public License
21* along with Safir SDK Core. If not, see <http://www.gnu.org/licenses/>.
22*
23******************************************************************************/
24
25#ifndef __DOTS_ENUMERATION_CONTAINER_BASE_H__
26#define __DOTS_ENUMERATION_CONTAINER_BASE_H__
27
31#include <typeinfo>
32
33namespace Safir
34{
35namespace Dob
36{
37namespace Typesystem
38{
51 {
52 public:
58
68 virtual void SetOrdinal(const EnumerationValue value) = 0;
69
79 virtual EnumerationValue GetOrdinal() const = 0;
80
81 //implementation of pure virtual in ContainerBase.
82 bool IsNull() const override {return m_bIsNull;}
83
84 //implementation of pure virtual in ContainerBase.
85 bool HasVal() const override {return !m_bIsNull;}
86
87 //implementation of pure virtual in ContainerBase.
88 void SetNull() override
89 {
90 m_bIsNull = true;
91 m_bIsChanged = true;
92 }
93
94 //implementation of pure virtual in ContainerBase.
95 void Copy(const ContainerBase & that) override
96 {
97 if (this != &that)
98 {
99 if (typeid(*this) != typeid(that))
100 {
101 throw SoftwareViolationException(L"Invalid call to Copy, containers are not of same type",__WFILE__,__LINE__);
102 }
103 *this = static_cast<const EnumerationContainerBase &>(that);
104 }
105 }
106 protected:
107
113 constexpr EnumerationContainerBase(const EnumerationContainerBase& other) = default;
114
122
127
133
135 };
136
137
138}
139}
140}
141#endif
#define __WFILE__
Definition Exceptions.h:31
This namespace contains all the functionality and definitions of the SAFIR SDK.
Definition Backdoor.h:31
This namespace contains all functionality of the DOB (Components DOSE and DOTS).
Definition Connection.h:38
This namespace contains the DOB Typesystem functionality and definitions.
Definition ArrayContainer.h:37
DotsC_EnumerationValue EnumerationValue
The ordinal value of an enumeration.
Definition Defs.h:270
bool m_bIsChanged
The variable containing the change flag.
Definition ContainerBase.h:134
constexpr ContainerBase()
Default Constructor.
Definition ContainerBase.h:51
void SetNull() override
Set the container to null.
Definition EnumerationContainerBase.h:88
void Copy(const ContainerBase &that) override
Virtual assignment.
Definition EnumerationContainerBase.h:95
constexpr EnumerationContainerBase(const EnumerationContainerBase &other)=default
Copy constructor.
bool IsNull() const override
Is the container set to null?
Definition EnumerationContainerBase.h:82
virtual void SetOrdinal(const EnumerationValue value)=0
Set the ordinal value of the enumeration container.
bool HasVal() const override
Does the container have a value?
Definition EnumerationContainerBase.h:85
friend class Safir::Dob::Typesystem::Internal::BlobOperations
Definition EnumerationContainerBase.h:134
constexpr EnumerationContainerBase()
Default Constructor.
Definition EnumerationContainerBase.h:57
EnumerationContainerBase & operator=(const EnumerationContainerBase &other)=default
Copy assignment operator.
bool m_bIsNull
The null flag for the enumeration container.
Definition EnumerationContainerBase.h:126
EnumerationValue m_Value
The value of the enumeration container.
Definition EnumerationContainerBase.h:132
virtual EnumerationValue GetOrdinal() const =0
Get the ordinal value of the enumeration container.
Meant to be used when something goes very wrong.
Definition Exceptions.h:364