Safir SDK Core
Loading...
Searching...
No Matches
TypeRepository.h
Go to the documentation of this file.
1/******************************************************************************
2*
3* Copyright Saab AB, 2004-2015 (http://safirsdkcore.com)
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 <map>
29#include <string>
30#include <Safir/Dob/Typesystem/LanguageInterfaceDefs.h>
31#include <Safir/Utilities/Internal/Id.h>
32
33namespace Safir
34{
35namespace Dob
36{
37namespace Typesystem
38{
39namespace ToolSupport
40{
41 //forward declarations
42 template <class T> struct TypeRepositoryTraits;
43 class ClassDescription;
45
50 {
51 public:
53 virtual ~PropertyDescription() = default;
54
59 virtual const char* FileName() const=0;
60
65 virtual const char* Summary() const=0;
66
71 virtual DotsC_TypeId GetTypeId() const=0;
72
77 virtual const char* GetName() const=0;
78
83 virtual int GetNumberOfMembers() const=0;
84
90 virtual DotsC_MemberIndex GetMemberIndex(const std::string& memberName) const=0;
91
97 virtual const MemberDescription* GetMember(DotsC_MemberIndex index) const=0;
98 };
99
104 {
105 public:
107 virtual ~ExceptionDescription() = default;
108
113 virtual const char* FileName() const=0;
114
119 virtual const char* Summary() const=0;
120
125 virtual DotsC_TypeId GetTypeId() const=0;
126
131 virtual const char* GetName() const=0;
132
137 virtual const ExceptionDescription* GetBaseClass() const=0;
138 };
139
144 {
145 public:
147 virtual ~ParameterDescription() = default;
148
153 virtual const char* Summary() const=0;
154
159 virtual const char* GetName() const=0; //get the parameter name, no namespace and class name: MyParameter
160
165 virtual DotsC_TypeId GetClassTypeId() const=0;
166
171 virtual const char* GetQualifiedName() const=0;
172
177 virtual DotsC_MemberType GetMemberType() const=0;
178
184 virtual DotsC_TypeId GetTypeId() const=0;
185
190 virtual DotsC_CollectionType GetCollectionType() const=0;
191
196 virtual DotsC_MemberType GetKeyType() const=0; //only valid if collectionType is Dictionary
197
203 virtual DotsC_TypeId GetKeyTypeId() const=0;
204
209 virtual int GetNumberOfValues() const=0;
210
216 virtual bool IsHidden() const=0;
217
218 //Get parameter values - depending on actual type of the parameter
219 //For entityId use GetInt64Value for typeId and GetHashedValue for instanceId
220
226 virtual DotsC_Int32 GetInt32Value(int index) const=0; //int32, enum
227
233 virtual DotsC_Int64 GetInt64Value(int index) const=0; //int64, typeId
234
240 virtual DotsC_Float32 GetFloat32Value(int index) const=0; //float32, si32
241
247 virtual DotsC_Float64 GetFloat64Value(int index) const=0; //float64, si64
248
254 virtual bool GetBoolValue(int index) const=0;
255
261 virtual const char* GetStringValue(int index) const=0;
262
268 virtual std::pair<const char*, DotsC_Int32> GetObjectValue(int index) const=0;
269
275 virtual std::pair<const char*, DotsC_Int32> GetBinaryValue(int index) const=0;
276
282 virtual std::pair<DotsC_Int64, const char*> GetHashedValue(int index) const=0; //instanceId, channelId, handlerId
283
289 virtual DotsC_Int32 GetInt32Key(int index) const=0;
290
296 virtual DotsC_Int64 GetInt64Key(int index) const=0;
297
303 virtual const char* GetStringKey(int index) const=0;
304
310 virtual std::pair<DotsC_Int64, const char*> GetHashedKey(int index) const=0; //instanceId, channelId, handlerId
311
317 virtual int GetIndexByUnifiedKey(DotsC_Int64 unifiedKey) const=0;
318
324 virtual const std::map<DotsC_Int64, int>& UnifiedKeyToIndexMap() const=0;
325 };
326
331 {
332 public:
334 virtual ~EnumDescription() = default;
335
340 virtual const char* FileName() const=0;
341
346 virtual const char* Summary() const=0;
347
352 virtual DotsC_TypeId GetTypeId() const=0;
353
358 virtual const char* GetName() const=0;
359
364 virtual DotsC_TypeId GetChecksum() const=0;
365
370 virtual int GetNumberOfValues() const=0;
371
377 virtual const char* GetValueName(DotsC_EnumerationValue val) const=0;
378
384 virtual int GetIndexOfValue(const std::string& valueName) const=0;
385 };
386
391 {
392 public:
394 virtual ~MemberDescription() = default;
395
400 virtual const char* Summary() const=0;
401
407 virtual DotsC_TypeId GetTypeId() const=0;
408
413 virtual const char* GetName() const=0;
414
419 virtual DotsC_MemberType GetMemberType() const=0;
420
425 virtual DotsC_CollectionType GetCollectionType() const=0;
426
431 virtual DotsC_MemberType GetKeyType() const=0; //only valid if collectionType is Dictionary
432
438 virtual DotsC_TypeId GetKeyTypeId() const=0;
439
444 virtual int GetArraySize() const=0;
445
451 virtual int GetMaxLength() const=0;
452 };
453
458 {
459 public:
461 virtual ~MemberMappingDescription() = default;
462
467 virtual DotsC_PropertyMappingKind GetMappingKind() const=0;
468
474 virtual std::pair<const ParameterDescription*, int /*paramIndex*/> GetParameter() const=0;
475
476 //if mapped to member
483 virtual int MemberReferenceDepth() const=0;
484
491 virtual std::pair<DotsC_MemberIndex, DotsC_Int32> GetMemberReference(int depth) const=0;
492 };
493
498 {
499 public:
501 virtual ~PropertyMappingDescription() = default;
502
507 virtual const char* FileName() const=0;
508
513 virtual const char* Summary() const=0;
514
519 virtual const PropertyDescription* GetProperty() const=0;
520
525 virtual const ClassDescription* GetClass() const=0;
526
532 virtual const MemberMappingDescription* GetMemberMapping(int propertyMemberIndex) const=0;
533 };
534
539 {
540 public:
542 virtual ~CreateRoutineDescription() = default;
543
548 virtual const char* Summary() const=0;
549
554 virtual const char* GetName() const=0;
555
560 virtual int GetNumberOfInParameters() const=0;
561
567 virtual const MemberDescription* GetInParameterMember(int index) const=0;
568
573 virtual int GetNumberOfDefaultValues() const=0;
574
580 virtual const MemberDescription* GetDefaultValueMember(int index) const=0;
581
587 virtual std::pair<const ParameterDescription*, int /*paramIndex*/> GetDefaultValue(int index) const=0;
588 };
589
594 {
595 public:
597 virtual ~ClassDescription() = default;
598
603 virtual const char* FileName() const=0;
604
609 virtual const char* Summary() const=0;
610
615 virtual DotsC_TypeId GetTypeId() const=0;
616
621 virtual const char* GetName() const=0;
622
627 virtual const ClassDescription* GetBaseClass() const=0;
628
633 virtual int GetNumberOfDescendants() const=0;
634
640 virtual const ClassDescription* GetDescendant(int index) const=0;
641
646 virtual int GetNumberOfMembers() const=0;
647
652 virtual int GetNumberOfOwnMembers() const=0;
653
658 virtual int GetNumberOfInheritedMembers() const=0;
659
665 virtual DotsC_MemberIndex GetMemberIndex(const std::string& memberName) const=0;
666
672 virtual const MemberDescription* GetMember(DotsC_MemberIndex index) const=0;
673
678 virtual int GetNumberOfParameters() const=0;
679
684 virtual int GetNumberOfOwnParameters() const=0;
685
690 virtual int GetNumberOfInheritedParameters() const=0;
691
697 virtual const ParameterDescription* GetParameter(DotsC_ParameterIndex index) const=0;
698
703 virtual void GetPropertyIds(std::set<DotsC_TypeId>& propertyIds) const=0;
704
711 virtual const PropertyMappingDescription* GetPropertyMapping(DotsC_TypeId propertyTypeId, bool& isInherited) const=0;
712
717 virtual int GetNumberOfCreateRoutines() const=0;
718
724 virtual const CreateRoutineDescription* GetCreateRoutine(int index) const=0;
725
730 virtual DotsC_TypeId GetChecksum() const=0;
731 };
732
737 {
738 public:
739
741 virtual ~TypeRepository() = default;
742
743 //-----------------
744 // Enumerations
745 //-----------------
751 virtual const EnumDescription* GetEnum(DotsC_TypeId typeId) const=0;
752
757 virtual int GetNumberOfEnums() const=0;
758
763 virtual void GetAllEnumTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
764
765 //-----------------
766 // Properties
767 //-----------------
773 virtual const PropertyDescription* GetProperty(DotsC_TypeId typeId) const=0;
774
779 virtual int GetNumberOfProperties() const=0;
780
785 virtual void GetAllPropertyTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
786
787 //-----------------
788 // Classes
789 //-----------------
795 virtual const ClassDescription* GetClass(DotsC_TypeId typeId) const=0;
796
801 virtual int GetNumberOfClasses() const=0;
802
807 virtual void GetAllClassTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
808
809 //-----------------
810 // Exceptions
811 //-----------------
817 virtual const ExceptionDescription* GetException(DotsC_TypeId typeId) const=0;
818
823 virtual int GetNumberOfExceptions() const=0;
824
829 virtual void GetAllExceptionTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
830 };
831
848}
849}
850}
851} //end namespace Safir::Dob::Typesystem::Internal
852
853#endif
This namespace contains all the functionality and definitions of the SAFIR SDK.
Definition Backdoor.h:31
Description of a property type.
Definition TypeRepository.h:50
virtual const char * GetName() const =0
Get qualified name of the property type.
virtual const MemberDescription * GetMember(DotsC_MemberIndex index) const =0
Get a member description.
virtual DotsC_MemberIndex GetMemberIndex(const std::string &memberName) const =0
Get index of a named member.
virtual DotsC_TypeId GetTypeId() const =0
Get the typeId of this property.
virtual const char * Summary() const =0
Get a summary about this property.
virtual const char * FileName() const =0
Get dou file path as a string.
virtual int GetNumberOfMembers() const =0
Get the number of members contained by this property.
Description of an exception type.
Definition TypeRepository.h:104
virtual DotsC_TypeId GetTypeId() const =0
Get the typeId of this exception.
virtual const char * FileName() const =0
Get dou file path as a string.
virtual const char * Summary() const =0
Get a summary about this exception.
virtual const char * GetName() const =0
Get qualified name of the exception type.
virtual const ExceptionDescription * GetBaseClass() const =0
Get the base class description of this exception.
Description of a parameter.
Definition TypeRepository.h:144
virtual std::pair< DotsC_Int64, const char * > GetHashedKey(int index) const =0
Get hashed key.
virtual DotsC_Int64 GetInt64Value(int index) const =0
Get int64 parameter value.
virtual DotsC_Float32 GetFloat32Value(int index) const =0
Get float32 parameter value.
virtual DotsC_MemberType GetMemberType() const =0
Get member type of this parameter value.
virtual std::pair< DotsC_Int64, const char * > GetHashedValue(int index) const =0
Get hashed parameter value.
virtual int GetIndexByUnifiedKey(DotsC_Int64 unifiedKey) const =0
GetIndexByUnifiedKey - Get corresponding index to a dictionary key.
virtual const char * Summary() const =0
Get a summary about this parameter.
virtual DotsC_TypeId GetTypeId() const =0
If this parameter has MemberType Enumeration or Object, the specific typeId of that type can be retri...
virtual const std::map< DotsC_Int64, int > & UnifiedKeyToIndexMap() const =0
UnifiedKeyToIndexMap - FOR INTERNAL USAGE ONLY.
virtual const char * GetName() const =0
Get the name of the parameter.
virtual DotsC_TypeId GetClassTypeId() const =0
Get the TypeId of the class that the parameter belongs to.
virtual DotsC_MemberType GetKeyType() const =0
Get key type of this parameter.
virtual DotsC_CollectionType GetCollectionType() const =0
Get the collection type of this parameter.
virtual int GetNumberOfValues() const =0
Get the number of values this parameter holds.
virtual const char * GetStringKey(int index) const =0
Get string key.
virtual DotsC_Float64 GetFloat64Value(int index) const =0
Get float64 parameter value.
virtual std::pair< const char *, DotsC_Int32 > GetBinaryValue(int index) const =0
Get binary parameter value.
virtual const char * GetStringValue(int index) const =0
Get string parameter value.
virtual DotsC_TypeId GetKeyTypeId() const =0
If this parameter has CollectionType Dictionary and KeyType Enumeration, the specific typeId of that ...
virtual DotsC_Int32 GetInt32Key(int index) const =0
Get int32 or enum key.
virtual bool GetBoolValue(int index) const =0
Get bool parameter value.
virtual DotsC_Int64 GetInt64Key(int index) const =0
Get int64 or typeId key.
virtual const char * GetQualifiedName() const =0
Get fully qualified parameter name.
virtual DotsC_Int32 GetInt32Value(int index) const =0
Get int32 parameter value.
virtual bool IsHidden() const =0
Check if this is a normal parameter defined explicitly in a dou-file or if it is a special hidden par...
virtual std::pair< const char *, DotsC_Int32 > GetObjectValue(int index) const =0
Get object parameter value.
Description of an enumeration type.
Definition TypeRepository.h:331
virtual int GetIndexOfValue(const std::string &valueName) const =0
Get index (ordinal) for a named enumeration value.
virtual const char * GetName() const =0
Get qualified name of the enumeration type.
virtual int GetNumberOfValues() const =0
Get number of enumeration values.
virtual const char * Summary() const =0
Get a summary about this enumeration.
virtual DotsC_TypeId GetChecksum() const =0
Get checksum of this enum type.
virtual const char * GetValueName(DotsC_EnumerationValue val) const =0
Get name of a enumeration value.
virtual DotsC_TypeId GetTypeId() const =0
Get the typeId of this enumeration.
virtual const char * FileName() const =0
Get dou file path as a string.
Description of a member.
Definition TypeRepository.h:391
virtual DotsC_MemberType GetKeyType() const =0
Get key type of this member.
virtual DotsC_TypeId GetTypeId() const =0
If this member has MemberType Enumeration or Object, the specific typeId of that type can be retrieve...
virtual const char * Summary() const =0
Get a summary about this member.
virtual DotsC_MemberType GetMemberType() const =0
Get type of this member.
virtual DotsC_CollectionType GetCollectionType() const =0
Get the collection type of this member.
virtual DotsC_TypeId GetKeyTypeId() const =0
If this member has CollectionType Dictionary and KeyType Enumeration, the specific typeId of that enu...
virtual const char * GetName() const =0
Get member name.
virtual int GetArraySize() const =0
Get the array size of this member.
virtual int GetMaxLength() const =0
If member type is String this method returns the maximum allowed string length.
Description of a property member mapping.
Definition TypeRepository.h:458
virtual DotsC_PropertyMappingKind GetMappingKind() const =0
Get type of property member mapping.
virtual int MemberReferenceDepth() const =0
If this property mapping is of type MappedToMember, use GetMappingKind() to check that,...
virtual std::pair< DotsC_MemberIndex, DotsC_Int32 > GetMemberReference(int depth) const =0
If this property mapping is of type MappedToMember, use GetMappingKind() to check that,...
virtual std::pair< const ParameterDescription *, int > GetParameter() const =0
If this property mapping is of type MappedToParameter, use GetMappingKind() to check that,...
Description of a property mapping.
Definition TypeRepository.h:498
virtual const ClassDescription * GetClass() const =0
Get the class this property mapping refers to.
virtual const char * Summary() const =0
Get a summary about this property mapping.
virtual const PropertyDescription * GetProperty() const =0
Get the property this property mapping refers to.
virtual const MemberMappingDescription * GetMemberMapping(int propertyMemberIndex) const =0
Get member mapping for a specific property member.
virtual const char * FileName() const =0
Get dou file path as a string.
Description of a create routine.
Definition TypeRepository.h:539
virtual int GetNumberOfInParameters() const =0
Get the number of in parameters for this create routine.
virtual const char * Summary() const =0
Get a summary about this create routine.
virtual const char * GetName() const =0
Get create routine name.
virtual const MemberDescription * GetDefaultValueMember(int index) const =0
Get member description for a default value.
virtual int GetNumberOfDefaultValues() const =0
Get number of default values that this create routine will set.
virtual std::pair< const ParameterDescription *, int > GetDefaultValue(int index) const =0
Get parameter description for a default value.
virtual const MemberDescription * GetInParameterMember(int index) const =0
Get member description for an in parameter.
Description of a class type.
Definition TypeRepository.h:594
virtual int GetNumberOfDescendants() const =0
Get the number of classes that inherits from this class.
virtual const char * GetName() const =0
Get qualified name of the class type.
virtual void GetPropertyIds(std::set< DotsC_TypeId > &propertyIds) const =0
Get a set of all properties in this class.
virtual DotsC_TypeId GetChecksum() const =0
Get checksum of this class.
virtual int GetNumberOfInheritedParameters() const =0
Get the number of inherited parameters.
virtual DotsC_MemberIndex GetMemberIndex(const std::string &memberName) const =0
Get index of a named member.
virtual const MemberDescription * GetMember(DotsC_MemberIndex index) const =0
Get a member description.
virtual int GetNumberOfOwnMembers() const =0
Get the number of members defined by this class.
virtual int GetNumberOfMembers() const =0
Get the total number of members contained by this class including inherited members.
virtual const char * FileName() const =0
Get dou file path as a string.
virtual const PropertyMappingDescription * GetPropertyMapping(DotsC_TypeId propertyTypeId, bool &isInherited) const =0
Get property mapping description for a specific property that describes how it is mapped for this cla...
virtual const ClassDescription * GetDescendant(int index) const =0
Get descendant class.
virtual const ParameterDescription * GetParameter(DotsC_ParameterIndex index) const =0
Get parameter description.
virtual DotsC_TypeId GetTypeId() const =0
Get the typeId of this class.
virtual int GetNumberOfOwnParameters() const =0
Get the number of parameters defined by this class.
virtual int GetNumberOfInheritedMembers() const =0
Get the number of inherited members.
virtual int GetNumberOfParameters() const =0
Get the total number of parameters contained by this class including inherited parameters.
virtual const char * Summary() const =0
Get a summary about this class.
virtual const ClassDescription * GetBaseClass() const =0
Get the base class description of this class.
virtual int GetNumberOfCreateRoutines() const =0
Get the number of create routines in this class.
virtual const CreateRoutineDescription * GetCreateRoutine(int index) const =0
Get a create routine description.
The TypeRepository class is the baseclass of any TypeRepository implementation.
Definition TypeRepository.h:737
virtual const EnumDescription * GetEnum(DotsC_TypeId typeId) const =0
Get enumeration description by typeId.
virtual const ExceptionDescription * GetException(DotsC_TypeId typeId) const =0
Get exception description by typeId.
virtual int GetNumberOfProperties() const =0
Get number of property types.
virtual void GetAllExceptionTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
Get a set of all typeIds that represent exception types.
virtual void GetAllClassTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
Get a set of all typeIds that represent class types.
virtual int GetNumberOfExceptions() const =0
Get number of exception types.
virtual const ClassDescription * GetClass(DotsC_TypeId typeId) const =0
Get class description by typeId.
virtual int GetNumberOfEnums() const =0
Get number of enumeration types.
virtual void GetAllEnumTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
Get a set of all typeIds that represent enumeration types.
virtual void GetAllPropertyTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
Get a set of all typeIds that represent property types.
virtual const PropertyDescription * GetProperty(DotsC_TypeId typeId) const =0
Get property description by typeId.
virtual int GetNumberOfClasses() const =0
Get number of class types.
ClassDescription ClassDescriptionType
Definition TypeRepository.h:838
MemberDescription MemberDescriptionType
Definition TypeRepository.h:839
ParameterDescription ParameterDescriptionType
Definition TypeRepository.h:842
CreateRoutineDescription CreateRoutineDescriptionType
Definition TypeRepository.h:846
EnumDescription EnumDescriptionType
Definition TypeRepository.h:843
PropertyDescription PropertyDescriptionType
Definition TypeRepository.h:840
ExceptionDescription ExceptionDescriptionType
Definition TypeRepository.h:841
MemberMappingDescription MemberMappingDescriptionType
Definition TypeRepository.h:844
PropertyMappingDescription PropertyMappingDescriptionType
Definition TypeRepository.h:845