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 void SetNull() override
86 {
87 m_bIsNull = true;
88 m_bIsChanged = true;
89 }
90
91 //implementation of pure virtual in ContainerBase.
92 void Copy(const ContainerBase & that) override
93 {
94 if (this != &that)
95 {
96 if (typeid(*this) != typeid(that))
97 {
98 throw SoftwareViolationException(L"Invalid call to Copy, containers are not of same type",__WFILE__,__LINE__);
99 }
100 *this = static_cast<const EnumerationContainerBase &>(that);
101 }
102 }
103 protected:
104
110 constexpr EnumerationContainerBase(const EnumerationContainerBase& other) = default;
111
119
124
130
132 };
133
134
135}
136}
137}
138#endif
#define __WFILE__
Definition Exceptions.h:31
This namespace contains all the functionality and definitions of the SAFIR SDK.
Definition Backdoor.h:31
DotsC_EnumerationValue EnumerationValue
The ordinal value of an enumeration.
Definition Defs.h:270
Base class for all Containers.
Definition ContainerBase.h:44
bool m_bIsChanged
The variable containing the change flag.
Definition ContainerBase.h:127
Base class for containers of enumeration values.
Definition EnumerationContainerBase.h:51
void SetNull() override
Set the container to null.
Definition EnumerationContainerBase.h:85
void Copy(const ContainerBase &that) override
Virtual assignment.
Definition EnumerationContainerBase.h:92
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.
friend class Safir::Dob::Typesystem::Internal::BlobOperations
Definition EnumerationContainerBase.h:131
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:123
EnumerationValue m_Value
The value of the enumeration container.
Definition EnumerationContainerBase.h:129
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