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>
29 #include <Safir/Dob/Typesystem/LanguageInterfaceDefs.h>
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  //forward declarations
41  template <class T> struct TypeRepositoryTraits;
42  class ClassDescription;
43  class MemberDescription;
44 
49  {
50  public:
55  virtual const char* FileName() const=0;
56 
61  virtual const char* Summary() const=0;
62 
67  virtual DotsC_TypeId GetTypeId() const=0;
68 
73  virtual const char* GetName() const=0;
74 
79  virtual int GetNumberOfMembers() const=0;
80 
86  virtual DotsC_MemberIndex GetMemberIndex(const std::string& memberName) const=0;
87 
93  virtual const MemberDescription* GetMember(DotsC_MemberIndex index) const=0;
94  };
95 
100  {
101  public:
106  virtual const char* FileName() const=0;
107 
112  virtual const char* Summary() const=0;
113 
118  virtual DotsC_TypeId GetTypeId() const=0;
119 
124  virtual const char* GetName() const=0;
125 
130  virtual const ExceptionDescription* GetBaseClass() const=0;
131  };
132 
137  {
138  public:
143  virtual const char* Summary() const=0;
144 
149  virtual const char* GetName() const=0; //get the parameter name, no namespace and class name: MyParameter
150 
155  virtual const char* GetQualifiedName() const=0;
156 
161  virtual DotsC_MemberType GetMemberType() const=0;
162 
168  virtual DotsC_TypeId GetTypeId() const=0;
169 
174  virtual bool IsArray() const=0;
175 
180  virtual int GetArraySize() const=0;
181 
187  virtual bool IsHidden() const=0;
188 
189  //Get parameter values - depending on actual type of the parameter
190  //For entityId use GetInt64Value for typeId and GetHashedValue for instanceId
191 
197  virtual boost::int32_t GetInt32Value(int index) const=0; //int32, enum
198 
204  virtual boost::int64_t GetInt64Value(int index) const=0; //int64, typeId
205 
211  virtual float GetFloat32Value(int index) const=0; //float32, si32
212 
218  virtual double GetFloat64Value(int index) const=0; //float64, si64
219 
225  virtual bool GetBoolValue(int index) const=0;
226 
232  virtual const char* GetStringValue(int index) const=0;
233 
239  virtual std::pair<const char*, size_t> GetObjectValue(int index) const=0;
240 
246  virtual std::pair<const char*, size_t> GetBinaryValue(int index) const=0;
247 
253  virtual std::pair<boost::int64_t, const char*> GetHashedValue(int index) const=0; //instanceId, channelId, handlerId
254  };
255 
260  {
261  public:
266  virtual const char* FileName() const=0;
267 
272  virtual const char* Summary() const=0;
273 
278  virtual DotsC_TypeId GetTypeId() const=0;
279 
284  virtual const char* GetName() const=0;
285 
290  virtual DotsC_TypeId GetCheckSum() const=0;
291 
296  virtual int GetNumberOfValues() const=0;
297 
303  virtual const char* GetValueName(DotsC_EnumerationValue val) const=0;
304 
310  virtual int GetIndexOfValue(const std::string& valueName) const=0;
311  };
312 
317  {
318  public:
323  virtual const char* Summary() const=0;
324 
330  virtual DotsC_TypeId GetTypeId() const=0;
331 
336  virtual const char* GetName() const=0;
337 
342  virtual DotsC_MemberType GetMemberType() const=0;
343 
348  virtual const bool IsArray() const=0;
349 
354  virtual int GetArraySize() const=0;
355 
361  virtual int GetMaxLength() const=0;
362  };
363 
368  {
369  public:
374  virtual DotsC_PropertyMappingKind GetMappingKind() const=0;
375 
381  virtual std::pair<const ParameterDescription*, int /*paramIndex*/> GetParameter() const=0;
382 
383  //if mapped to member
390  virtual int MemberReferenceDepth() const=0;
391 
398  virtual std::pair<DotsC_MemberIndex, DotsC_ArrayIndex> GetMemberReference(int depth) const=0;
399  };
400 
405  {
406  public:
411  virtual const char* FileName() const=0;
412 
417  virtual const char* Summary() const=0;
418 
423  virtual const PropertyDescription* GetProperty() const=0;
424 
429  virtual const ClassDescription* GetClass() const=0;
430 
436  virtual const MemberMappingDescription* GetMemberMapping(int propertyMemberIndex) const=0;
437  };
438 
443  {
444  public:
449  virtual const char* Summary() const=0;
450 
455  virtual const char* GetName() const=0;
456 
461  virtual int GetNumberOfInParameters() const=0;
462 
468  virtual const MemberDescription* GetInParameterMember(int index) const=0;
469 
474  virtual int GetNumberOfDefaultValues() const=0;
475 
481  virtual const MemberDescription* GetDefaultValueMember(int index) const=0;
482 
488  virtual std::pair<const ParameterDescription*, int /*paramIndex*/> GetDefaultValue(int index) const=0;
489  };
490 
495  {
496  public:
501  virtual const char* FileName() const=0;
502 
507  virtual const char* Summary() const=0;
508 
513  virtual DotsC_TypeId GetTypeId() const=0;
514 
519  virtual const char* GetName() const=0;
520 
525  virtual const ClassDescription* GetBaseClass() const=0;
526  virtual int GetNumberOfDescendants() const=0;
527  virtual const ClassDescription* GetDescendant(int index) const=0;
528 
533  virtual int GetNumberOfMembers() const=0;
534 
539  virtual int GetNumberOfOwnMembers() const=0;
540 
545  virtual int GetNumberOfInheritedMembers() const=0;
546 
552  virtual DotsC_MemberIndex GetMemberIndex(const std::string& memberName) const=0;
553 
559  virtual const MemberDescription* GetMember(DotsC_MemberIndex index) const=0;
560 
565  virtual int GetNumberOfParameters() const=0;
566 
571  virtual int GetNumberOfOwnParameters() const=0;
572 
577  virtual int GetNumberOfInheritedParameters() const=0;
578 
584  virtual const ParameterDescription* GetParameter(DotsC_ParameterIndex index) const=0;
585 
590  virtual void GetPropertyIds(std::set<DotsC_TypeId>& propertyIds) const=0;
591 
598  virtual const PropertyMappingDescription* GetPropertyMapping(DotsC_TypeId propertyTypeId, bool& isInherited) const=0;
599 
604  virtual int GetNumberOfCreateRoutines() const=0;
605 
611  virtual const CreateRoutineDescription* GetCreateRoutine(int index) const=0;
612 
617  virtual int InitialSize() const=0;
618 
623  virtual int OwnSize() const=0;
624  };
625 
630  {
631  public:
632 
633  //-----------------
634  // Enumerations
635  //-----------------
641  virtual const EnumDescription* GetEnum(DotsC_TypeId typeId) const=0;
642 
647  virtual int GetNumberOfEnums() const=0;
648 
653  virtual void GetAllEnumTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
654 
655  //-----------------
656  // Properties
657  //-----------------
663  virtual const PropertyDescription* GetProperty(DotsC_TypeId typeId) const=0;
664 
669  virtual int GetNumberOfProperties() const=0;
670 
675  virtual void GetAllPropertyTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
676 
677  //-----------------
678  // Classes
679  //-----------------
685  virtual const ClassDescription* GetClass(DotsC_TypeId typeId) const=0;
686 
691  virtual int GetNumberOfClasses() const=0;
692 
697  virtual void GetAllClassTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
698 
699  //-----------------
700  // Exceptions
701  //-----------------
707  virtual const ExceptionDescription* GetException(DotsC_TypeId typeId) const=0;
708 
713  virtual int GetNumberOfExceptions() const=0;
714 
719  virtual void GetAllExceptionTypeIds(std::set<DotsC_TypeId>& typeIds) const=0;
720  };
721 
726  {
737  };
738 }
739 }
740 }
741 } //end namespace Safir::Dob::Typesystem::Internal
742 
743 #endif
virtual bool GetBoolValue(int index) const =0
Get bool parameter value.
ExceptionDescription ExceptionDescriptionType
Definition: TypeRepository.h:731
virtual int GetNumberOfInheritedParameters() const =0
Get the number of inherited parameters.
virtual const char * GetName() const =0
Get create routine name.
virtual int GetNumberOfEnums() const =0
Get number of enumeration types.
virtual std::pair< const char *, size_t > GetObjectValue(int index) const =0
Get object parameter value.
virtual int GetNumberOfProperties() const =0
Get number of property types.
virtual int GetArraySize() const =0
Get the array size of this member.
virtual std::pair< DotsC_MemberIndex, DotsC_ArrayIndex > GetMemberReference(int depth) const =0
If this property mapping is of type MappedToMember, use GetMappingKind() to check that...
virtual int OwnSize() const =0
Get size needed by members defined in this class, not including inherited members.
virtual const ExceptionDescription * GetException(DotsC_TypeId typeId) const =0
Get exception description by typeId.
virtual int GetNumberOfOwnParameters() const =0
Get the number of parameters defined by this class.
Description of a member.
Definition: TypeRepository.h:316
virtual const char * Summary() const =0
Get a summary about this create routine.
virtual const ClassDescription * GetClass() const =0
Get the class this property mapping refers to.
virtual const char * GetName() const =0
Get member name.
virtual int GetNumberOfOwnMembers() const =0
Get the number of members defined by this class.
virtual const char * GetName() const =0
Get qualified name of the enumeration type.
virtual const CreateRoutineDescription * GetCreateRoutine(int index) const =0
Get a create routine description.
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 const MemberDescription * GetMember(DotsC_MemberIndex index) const =0
Get a member description.
Description of a property member mapping.
Definition: TypeRepository.h:367
virtual int GetNumberOfDefaultValues() const =0
Get number of default values that this create routine will set.
virtual const char * Summary() const =0
Get a summary about this enumeration.
Description of an exception type.
Definition: TypeRepository.h:99
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 char * GetName() const =0
Get the name of the parameter.
virtual int GetNumberOfMembers() const =0
Get the number of members contained by this property.
virtual int MemberReferenceDepth() const =0
If this property mapping is of type MappedToMember, use GetMappingKind() to check that...
virtual void GetPropertyIds(std::set< DotsC_TypeId > &propertyIds) const =0
Get a set of all properties in this class.
virtual const char * GetValueName(DotsC_EnumerationValue val) const =0
Get name of a enumeration value.
virtual float GetFloat32Value(int index) const =0
Get float32 parameter value.
virtual const ClassDescription * GetBaseClass() const =0
Get the base class description of this class.
ParameterDescription ParameterDescriptionType
Definition: TypeRepository.h:732
virtual int InitialSize() const =0
Get the minimum size that a blob of this class can be.
virtual boost::int64_t GetInt64Value(int index) const =0
Get int64 parameter value.
virtual const PropertyDescription * GetProperty(DotsC_TypeId typeId) const =0
Get property description by typeId.
virtual const char * FileName() const =0
Get dou file path as a string.
The TypeRepository class is the baseclass of any TypeRepository implementation.
Definition: TypeRepository.h:629
virtual int GetIndexOfValue(const std::string &valueName) const =0
Get index (ordinal) for a named enumeration value.
PropertyDescription PropertyDescriptionType
Definition: TypeRepository.h:730
virtual int GetNumberOfExceptions() const =0
Get number of exception types.
virtual const ParameterDescription * GetParameter(DotsC_ParameterIndex index) const =0
Get parameter description.
virtual void GetAllEnumTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
Get a set of all typeIds that represent enumeration types.
virtual DotsC_MemberIndex GetMemberIndex(const std::string &memberName) const =0
Get index of a named member.
virtual DotsC_MemberType GetMemberType() const =0
Get member type of this parameter value.
virtual const char * GetStringValue(int index) const =0
Get string parameter value.
virtual const char * Summary() const =0
Get a summary about this property.
virtual const char * GetName() const =0
Get qualified name of the class type.
virtual int GetMaxLength() const =0
If member type is String this method returns the maximum allowed string length.
EnumDescription EnumDescriptionType
Definition: TypeRepository.h:733
MemberMappingDescription MemberMappingDescriptionType
Definition: TypeRepository.h:734
virtual DotsC_TypeId GetTypeId() const =0
Get the typeId of this property.
virtual const char * FileName() const =0
Get dou file path as a string.
virtual DotsC_TypeId GetCheckSum() const =0
Get checksum of this enum type.
virtual const MemberDescription * GetInParameterMember(int index) const =0
Get member description for an in parameter.
virtual std::pair< const ParameterDescription *, int > GetParameter() const =0
If this property mapping is of type MappedToParameter, use GetMappingKind() to check that...
PropertyMappingDescription PropertyMappingDescriptionType
Definition: TypeRepository.h:735
ClassDescription ClassDescriptionType
Definition: TypeRepository.h:728
Description of a class type.
Definition: TypeRepository.h:494
virtual std::pair< const char *, size_t > GetBinaryValue(int index) const =0
Get binary parameter value.
virtual const char * Summary() const =0
Get a summary about this member.
virtual const char * FileName() const =0
Get dou file path as a string.
virtual std::pair< boost::int64_t, const char * > GetHashedValue(int index) const =0
Get hashed parameter value.
TypeRepository RepositoryType
Definition: TypeRepository.h:727
Description of a property mapping.
Definition: TypeRepository.h:404
virtual const ClassDescription * GetDescendant(int index) const =0
virtual const EnumDescription * GetEnum(DotsC_TypeId typeId) const =0
Get enumeration description by typeId.
virtual const char * Summary() const =0
Get a summary about this property mapping.
virtual int GetNumberOfClasses() const =0
Get number of class types.
virtual const char * GetQualifiedName() const =0
Get fully qualified parameter name.
virtual void GetAllExceptionTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
Get a set of all typeIds that represent exception types.
virtual std::pair< const ParameterDescription *, int > GetDefaultValue(int index) const =0
Get parameter description for a default value.
virtual const char * FileName() const =0
Get dou file path as a string.
virtual DotsC_TypeId GetTypeId() const =0
If this parameter has MemberType Enumeration or Object, the specific typeId of that type can be retri...
virtual double GetFloat64Value(int index) const =0
Get float64 parameter value.
virtual int GetNumberOfMembers() const =0
Get the total number of members contained by this class including inherited members.
virtual DotsC_TypeId GetTypeId() const =0
If this member has MemberType Enumeration or Object, the specific typeId of that type can be retrieve...
virtual boost::int32_t GetInt32Value(int index) const =0
Get int32 parameter value.
virtual const ExceptionDescription * GetBaseClass() const =0
Get the base class description of this exception.
virtual int GetNumberOfCreateRoutines() const =0
Get the number of create routines in this class.
virtual const char * Summary() const =0
Get a summary about this class.
virtual const char * Summary() const =0
Get a summary about this exception.
virtual DotsC_MemberIndex GetMemberIndex(const std::string &memberName) const =0
Get index of a named member.
MemberDescription MemberDescriptionType
Definition: TypeRepository.h:729
virtual int GetNumberOfInheritedMembers() const =0
Get the number of inherited members.
virtual const char * Summary() const =0
Get a summary about this parameter.
virtual bool IsArray() const =0
Check if this parameter is an array.
virtual void GetAllClassTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
Get a set of all typeIds that represent class types.
virtual const char * GetName() const =0
Get qualified name of the property type.
virtual const MemberMappingDescription * GetMemberMapping(int propertyMemberIndex) const =0
Get member mapping for a specific property member.
virtual int GetNumberOfParameters() const =0
Get the total number of parameters contained by this class including inherited parameters.
virtual const ClassDescription * GetClass(DotsC_TypeId typeId) const =0
Get class description by typeId.
virtual DotsC_TypeId GetTypeId() const =0
Get the typeId of this enumeration.
Description of a parameter.
Definition: TypeRepository.h:136
virtual DotsC_PropertyMappingKind GetMappingKind() const =0
Get type of property member mapping.
virtual const bool IsArray() const =0
Check if this member is an array.
virtual const char * GetName() const =0
Get qualified name of the exception type.
virtual void GetAllPropertyTypeIds(std::set< DotsC_TypeId > &typeIds) const =0
Get a set of all typeIds that represent property types.
virtual const MemberDescription * GetDefaultValueMember(int index) const =0
Get member description for a default value.
virtual DotsC_TypeId GetTypeId() const =0
Get the typeId of this exception.
Description of a property type.
Definition: TypeRepository.h:48
virtual DotsC_TypeId GetTypeId() const =0
Get the typeId of this class.
virtual int GetNumberOfInParameters() const =0
Get the number of in parameters for this create routine.
Description of a create routine.
Definition: TypeRepository.h:442
virtual int GetArraySize() const =0
Get the array size of this parameter.
virtual const MemberDescription * GetMember(DotsC_MemberIndex index) const =0
Get a member description.
CreateRoutineDescription CreateRoutineDescriptionType
Definition: TypeRepository.h:736
virtual const PropertyDescription * GetProperty() const =0
Get the property this property mapping refers to.
Description of an enumeration type.
Definition: TypeRepository.h:259
virtual const char * FileName() const =0
Get dou file path as a string.
virtual DotsC_MemberType GetMemberType() const =0
Get type of this member.
virtual int GetNumberOfValues() const =0
Get number of enumeration values.