Safir SDK Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TypeRepository.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Copyright Saab AB, 2004-2013 (http://safir.sourceforge.net)
4 *
5 * Created by: Joel Ottosson / joot
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 Internals.
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 #ifndef __DOTS_INTERNAL_TYPE_REPOSITORY_H__
25 #define __DOTS_INTERNAL_TYPE_REPOSITORY_H__
26 
27 #include <set>
28 #include <string>
30 #include <Safir/Utilities/Internal/Id.h>
31 
32 namespace Safir
33 {
34 namespace Dob
35 {
36 namespace Typesystem
37 {
38 namespace ToolSupport
39 {
40  template <class T> struct TypeRepositoryTraits;
41 
42  //forward declarations
43  class ClassDescription;
44  class MemberDescription;
45 
47  {
48  public:
49  virtual const char* FileName() const=0;
50  virtual const char* Summary() const=0;
51  virtual DotsC_TypeId GetTypeId() const=0;
52  virtual const char* GetName() const=0;
53  virtual int GetNumberOfMembers() const=0;
54  virtual DotsC_MemberIndex GetMemberIndex(const std::string& memberName) const=0;
55  virtual const MemberDescription* GetMember(DotsC_MemberIndex index) const=0;
56  };
57 
59  {
60  public:
61  virtual const char* FileName() const=0;
62  virtual const char* Summary() const=0;
63  virtual DotsC_TypeId GetTypeId() const=0;
64  virtual const char* GetName() const=0;
65  virtual const ExceptionDescription* GetBaseClass() const=0;
66  };
67 
69  {
70  public:
71  virtual const char* Summary() const=0;
72  virtual const char* GetName() const=0; //get the parameter name, no namespace and class name: MyParameter
73  virtual const char* GetQualifiedName() const=0; //get fully qualified parameter name: MyNamespace.MyClass.MyParameter
74  virtual DotsC_MemberType GetMemberType() const=0;
75  virtual DotsC_TypeId GetTypeId() const=0; //only valid if MemberType is object or enum
76  virtual bool IsArray() const=0;
77  virtual int GetArraySize() const=0;
78  virtual bool IsHidden() const=0;
79 
80  //Get parameter values - depending on actual type of the parameter
81  //For entityId use GetInt64Value for typeId and GetHashedValue for instanceId
82  virtual boost::int32_t GetInt32Value(int index) const=0; //int32, enum
83  virtual boost::int64_t GetInt64Value(int index) const=0; //int64, typeId
84  virtual float GetFloat32Value(int index) const=0; //float32, si32
85  virtual double GetFloat64Value(int index) const=0; //float64, si64
86  virtual bool GetBoolValue(int index) const=0;
87  virtual const char* GetStringValue(int index) const=0;
88  virtual std::pair<const char*, size_t> GetObjectValue(int index) const=0;
89  virtual std::pair<const char*, size_t> GetBinaryValue(int index) const=0;
90  virtual std::pair<boost::int64_t, const char*> GetHashedValue(int index) const=0; //instanceId, channelId, handlerId
91  };
92 
94  {
95  public:
96  virtual const char* FileName() const=0;
97  virtual const char* Summary() const=0;
98  virtual DotsC_TypeId GetTypeId() const=0;
99  virtual const char* GetName() const=0;
100  virtual DotsC_TypeId GetCheckSum() const=0;
101  virtual int GetNumberOfValues() const=0;
102  virtual const char* GetValueName(DotsC_EnumerationValue val) const=0;
103  virtual int GetIndexOfValue(const std::string& valueName) const=0; //Supports short name and fully qualified name. Ex: 'Monday' and 'MyEnumType.Monday'
104  };
105 
107  {
108  public:
109  virtual const char* Summary() const=0;
110  virtual DotsC_TypeId GetTypeId() const=0; //only valid if MemberType is object or enum
111  virtual const char* GetName() const=0;
112  virtual DotsC_MemberType GetMemberType() const=0;
113  virtual const bool IsArray() const=0;
114  virtual int GetArraySize() const=0;
115  virtual int GetMaxLength() const=0; //only valid if memberType is String
116  };
117 
119  {
120  public:
121  virtual DotsC_PropertyMappingKind GetMappingKind() const=0;
122  virtual std::pair<const ParameterDescription*, int /*paramIndex*/> GetParameter() const=0; //if mapped to parameter. If paramIndex<0, whole array is.
123 
124  //if mapped to member
125  virtual int MemberReferenceDepth() const=0;
126  virtual std::pair<DotsC_MemberIndex, DotsC_ArrayIndex> GetMemberReference(int depth) const=0;
127  };
128 
130  {
131  public:
132  virtual const char* FileName() const=0;
133  virtual const char* Summary() const=0;
134  virtual const PropertyDescription* GetProperty() const=0;
135  virtual const ClassDescription* GetClass() const=0;
136  virtual const MemberMappingDescription* GetMemberMapping(int propertyMemberIndex) const=0;
137  };
138 
140  {
141  public:
142  virtual const char* Summary() const=0;
143  virtual const char* GetName() const=0;
144 
145  virtual int GetNumberOfInParameters() const=0;
146  virtual const MemberDescription* GetInParameterMember(int index) const=0;
147 
148  virtual int GetNumberOfDefaultValues() const=0;
149  virtual const MemberDescription* GetDefaultValueMember(int index) const=0;
150  virtual std::pair<const ParameterDescription*, int /*paramIndex*/> GetDefaultValue(int index) const=0;
151  };
152 
154  {
155  public:
156  virtual const char* FileName() const=0;
157  virtual const char* Summary() const=0;
158  virtual DotsC_TypeId GetTypeId() const=0;
159  virtual const char* GetName() const=0;
160  virtual const ClassDescription* GetBaseClass() const=0;
161  virtual int GetNumberOfDescendants() const=0;
162  virtual const ClassDescription* GetDescendant(int index) const=0;
163  virtual int GetNumberOfMembers() const=0;
164  virtual int GetNumberOfOwnMembers() const=0;
165  virtual int GetNumberOfInheritedMembers() const=0;
166  virtual DotsC_MemberIndex GetMemberIndex(const std::string& memberName) const=0;
167  virtual const MemberDescription* GetMember(DotsC_MemberIndex index) const=0;
168  virtual int GetNumberOfParameters() const=0;
169  virtual int GetNumberOfOwnParameters() const=0;
170  virtual int GetNumberOfInheritedParameters() const=0;
171  virtual const ParameterDescription* GetParameter(DotsC_ParameterIndex index) const=0;
172  virtual void GetPropertyIds(std::set<DotsC_TypeId>& propertyIds) const=0;
173  virtual const PropertyMappingDescription* GetPropertyMapping(DotsC_TypeId propertyTypeId, bool & isInherited) const=0;
174  virtual int GetNumberOfCreateRoutines() const=0;
175  virtual const CreateRoutineDescription* GetCreateRoutine(int index) const=0;
176  virtual int InitialSize() const=0;
177  virtual int OwnSize() const=0;
178  };
179 
184  {
185  public:
186  //Enmerations
187  virtual const EnumDescription* GetEnum(DotsC_TypeId typeId) const=0;
188  virtual int GetNumberOfEnums() const=0;
189  virtual void GetAllEnumTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
190 
191  //properties
192  virtual const PropertyDescription* GetProperty(DotsC_TypeId typeId) const=0;
193  virtual int GetNumberOfProperties() const=0;
194  virtual void GetAllPropertyTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
195 
196  //classes
197  virtual const ClassDescription* GetClass(DotsC_TypeId typeId) const=0;
198  virtual int GetNumberOfClasses() const=0;
199  virtual void GetAllClassTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
200 
201  //exceptions
202  virtual const ExceptionDescription* GetException(DotsC_TypeId typeId) const=0;
203  virtual int GetNumberOfExceptions() const=0;
204  virtual void GetAllExceptionTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
205  };
206 
208  {
219  };
220 }
221 }
222 }
223 } //end namespace Safir::Dob::Typesystem::Internal
224 
225 #endif
ExceptionDescription ExceptionDescriptionType
Definition: TypeRepository.h:213
virtual std::pair< const char *, size_t > GetObjectValue(int index) const =0
virtual std::pair< DotsC_MemberIndex, DotsC_ArrayIndex > GetMemberReference(int depth) const =0
virtual const ExceptionDescription * GetException(DotsC_TypeId typeId) const =0
DotsC_Int32 DotsC_MemberIndex
Definition: LanguageInterfaceDefs.h:45
virtual const ClassDescription * GetClass() const =0
virtual const CreateRoutineDescription * GetCreateRoutine(int index) const =0
virtual const MemberDescription * GetMember(DotsC_MemberIndex index) const =0
virtual const PropertyMappingDescription * GetPropertyMapping(DotsC_TypeId propertyTypeId, bool &isInherited) const =0
virtual void GetPropertyIds(std::set< DotsC_TypeId > &propertyIds) const =0
virtual const char * GetValueName(DotsC_EnumerationValue val) const =0
virtual const ClassDescription * GetBaseClass() const =0
ParameterDescription ParameterDescriptionType
Definition: TypeRepository.h:214
virtual boost::int64_t GetInt64Value(int index) const =0
virtual const PropertyDescription * GetProperty(DotsC_TypeId typeId) const =0
DotsC_PropertyMappingKind
Definition: LanguageInterfaceDefs.h:123
The TypeRepository class is the baseclass of any TypeRepository implementation.
Definition: TypeRepository.h:183
virtual int GetIndexOfValue(const std::string &valueName) const =0
PropertyDescription PropertyDescriptionType
Definition: TypeRepository.h:212
virtual const ParameterDescription * GetParameter(DotsC_ParameterIndex index) const =0
virtual void GetAllEnumTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
virtual DotsC_MemberIndex GetMemberIndex(const std::string &memberName) const =0
virtual DotsC_MemberType GetMemberType() const =0
virtual const char * GetStringValue(int index) const =0
EnumDescription EnumDescriptionType
Definition: TypeRepository.h:215
MemberMappingDescription MemberMappingDescriptionType
Definition: TypeRepository.h:216
DotsC_Int64 DotsC_TypeId
Definition: LanguageInterfaceDefs.h:37
virtual const MemberDescription * GetInParameterMember(int index) const =0
virtual std::pair< const ParameterDescription *, int > GetParameter() const =0
DotsC_MemberType
Definition: LanguageInterfaceDefs.h:53
PropertyMappingDescription PropertyMappingDescriptionType
Definition: TypeRepository.h:217
ClassDescription ClassDescriptionType
Definition: TypeRepository.h:210
virtual std::pair< const char *, size_t > GetBinaryValue(int index) const =0
virtual std::pair< boost::int64_t, const char * > GetHashedValue(int index) const =0
DotsC_Int32 DotsC_EnumerationValue
Definition: LanguageInterfaceDefs.h:51
TypeRepository RepositoryType
Definition: TypeRepository.h:209
virtual const ClassDescription * GetDescendant(int index) const =0
virtual const EnumDescription * GetEnum(DotsC_TypeId typeId) const =0
virtual void GetAllExceptionTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
virtual std::pair< const ParameterDescription *, int > GetDefaultValue(int index) const =0
virtual double GetFloat64Value(int index) const =0
virtual boost::int32_t GetInt32Value(int index) const =0
virtual const ExceptionDescription * GetBaseClass() const =0
virtual DotsC_MemberIndex GetMemberIndex(const std::string &memberName) const =0
MemberDescription MemberDescriptionType
Definition: TypeRepository.h:211
virtual void GetAllClassTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
virtual const MemberMappingDescription * GetMemberMapping(int propertyMemberIndex) const =0
virtual const ClassDescription * GetClass(DotsC_TypeId typeId) const =0
virtual DotsC_PropertyMappingKind GetMappingKind() const =0
virtual void GetAllPropertyTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
virtual const MemberDescription * GetDefaultValueMember(int index) const =0
DotsC_Int32 DotsC_ParameterIndex
Definition: LanguageInterfaceDefs.h:49
virtual const MemberDescription * GetMember(DotsC_MemberIndex index) const =0
CreateRoutineDescription CreateRoutineDescriptionType
Definition: TypeRepository.h:218
virtual const PropertyDescription * GetProperty() const =0
virtual DotsC_MemberType GetMemberType() const =0