Safir SDK Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EnumerationContainerBase.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Copyright Saab AB, 2006-2013 (http://safir.sourceforge.net)
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 
33 namespace Safir
34 {
35 namespace Dob
36 {
37 namespace 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  virtual bool IsNull() const {return m_bIsNull;}
83 
84  //implementation of pure virtual in ContainerBase.
85  virtual void SetNull()
86  {
87  m_bIsNull = true;
88  m_bIsChanged = true;
89  }
90 
91  //implementation of pure virtual in ContainerBase.
92  virtual void Copy(const ContainerBase & that)
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  friend class BlobOperations;
105 
113  {ContainerBase::operator =(other); m_Value = other.m_Value; m_bIsNull = other.m_bIsNull; return *this;}
114 
118  bool m_bIsNull;
119 
125  };
126 
127 
128 }
129 }
130 }
131 #endif
132 
virtual void Copy(const ContainerBase &that)
Virtual assignment.
Definition: EnumerationContainerBase.h:92
Operations on blobs.
Definition: BlobOperations.h:53
virtual void SetOrdinal(const EnumerationValue value)=0
Set the ordinal value of the enumeration container.
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:360
ContainerBase & operator=(const ContainerBase &other)
Copy assignment operator.
Definition: ContainerBase.h:117
virtual void SetNull()
Set the container to null.
Definition: EnumerationContainerBase.h:85
Base class for containers of enumeration values.
Definition: EnumerationContainerBase.h:50
#define __WFILE__
Definition: Exceptions.h:31
virtual bool IsNull() const
Is the container set to null?
Definition: EnumerationContainerBase.h:82
EnumerationValue m_Value
The value of the enumeration container.
Definition: EnumerationContainerBase.h:124
Base class for all Containers.
Definition: ContainerBase.h:41
DotsC_EnumerationValue EnumerationValue
The ordinal value of an enumeration.
Definition: Defs.h:271
bool m_bIsChanged
The variable containing the change flag.
Definition: ContainerBase.h:123
EnumerationContainerBase & operator=(const EnumerationContainerBase &other)
Copy assignment operator.
Definition: EnumerationContainerBase.h:112
bool m_bIsNull
The null flag for the enumeration container.
Definition: EnumerationContainerBase.h:118
EnumerationContainerBase()
Default Constructor.
Definition: EnumerationContainerBase.h:57