SapFeature.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. #ifndef _SAPFEATURE_H_
  2. #define _SAPFEATURE_H_
  3. // SapFeature.h : header file
  4. //
  5. #include "SapClassBasicDef.h"
  6. //
  7. // SapFeature class declaration
  8. //
  9. class SAPCLASSBASIC_CLASS SapFeature : public SapManager
  10. {
  11. public:
  12. // Enumerations
  13. enum Type // Data Types
  14. {
  15. TypeUndefined = CORFEATURE_VAL_TYPE_UNDEFINED,
  16. TypeInt32 = CORFEATURE_VAL_TYPE_INT32,
  17. TypeInt64 = CORFEATURE_VAL_TYPE_INT64,
  18. TypeFloat = CORFEATURE_VAL_TYPE_FLOAT,
  19. TypeDouble = CORFEATURE_VAL_TYPE_DOUBLE,
  20. TypeBool = CORFEATURE_VAL_TYPE_BOOL,
  21. TypeEnum = CORFEATURE_VAL_TYPE_ENUM,
  22. TypeString = CORFEATURE_VAL_TYPE_STRING,
  23. TypeBuffer = CORFEATURE_VAL_TYPE_BUFFER,
  24. TypeLut = CORFEATURE_VAL_TYPE_LUT,
  25. TypeArray = CORFEATURE_VAL_TYPE_ARRAY
  26. };
  27. enum AccessMode // Access Modes
  28. {
  29. AccessUndefined = CORFEATURE_VAL_ACCESS_MODE_UNDEFINED,
  30. AccessRW = CORFEATURE_VAL_ACCESS_MODE_RW, // Read and Write
  31. AccessRO = CORFEATURE_VAL_ACCESS_MODE_RO, // Read Only
  32. AccessWO = CORFEATURE_VAL_ACCESS_MODE_WO, // Write Only
  33. AccessNP = CORFEATURE_VAL_ACCESS_MODE_NP, // Not present
  34. AccessNE = CORFEATURE_VAL_ACCESS_MODE_NE // Not enabled
  35. };
  36. enum Representation // Data Representations (for float and integer)
  37. {
  38. RepresentationUndefined = CORFEATURE_VAL_REPRESENTATION_UNDEFINED,
  39. RepresentationLinear = CORFEATURE_VAL_REPRESENTATION_LINEAR,
  40. RepresentationLogarithmic = CORFEATURE_VAL_REPRESENTATION_LOGARITHMIC,
  41. RepresentationBoolean = CORFEATURE_VAL_REPRESENTATION_BOOLEAN,
  42. RepresentationPureNumber = CORFEATURE_VAL_REPRESENTATION_PURENUMBER,
  43. RepresentationHexNumber = CORFEATURE_VAL_REPRESENTATION_HEXNUMBER,
  44. RepresentationIPV4Address = CORFEATURE_VAL_REPRESENTATION_IPV4ADDRESS,
  45. RepresentationMACAddress = CORFEATURE_VAL_REPRESENTATION_MACADDR
  46. };
  47. enum Sign // Data Sign
  48. {
  49. SignUndefined = CORFEATURE_VAL_SIGN_UNDEFINED,
  50. Signed = CORFEATURE_VAL_SIGN_SIGNED,
  51. Unsigned = CORFEATURE_VAL_SIGN_UNSIGNED
  52. };
  53. enum WriteMode // Write mode when access mode is read-write or write only
  54. {
  55. WriteUndefined = CORFEATURE_VAL_WRITE_MODE_UNDEFINED, // Undefined
  56. WriteAlways = CORFEATURE_VAL_WRITE_MODE_ALWAYS, // Always writable
  57. WriteNotAcquiring = CORFEATURE_VAL_WRITE_MODE_NOT_ACQUIRING, // Writable when not acquiring
  58. WriteNotConnected = CORFEATURE_VAL_WRITE_MODE_NOT_CONNECTED // Writable when not connected
  59. };
  60. enum Visibility // Visibility Types
  61. {
  62. VisibilityUndefined = CORFEATURE_VAL_VISIBILITY_UNDEFINED, // Undefined
  63. VisibilityBeginner = CORFEATURE_VAL_VISIBILITY_BEGINNER, // Always visible
  64. VisibilityExpert = CORFEATURE_VAL_VISIBILITY_EXPERT, // Visible for experts or Gurus
  65. VisibilityGuru = CORFEATURE_VAL_VISIBILITY_GURU, // Visible for Gurus
  66. VisibilityInvisible = CORFEATURE_VAL_VISIBILITY_INVISIBLE // Not Visible
  67. };
  68. enum IncrementType // Increment Types
  69. {
  70. IncrementUndefined = CORFEATURE_VAL_INCREMENT_TYPE_UNDEFINED, // Undefined
  71. IncrementNone = CORFEATURE_VAL_INCREMENT_TYPE_NONE, // Feature has no increment
  72. IncrementLinear = CORFEATURE_VAL_INCREMENT_TYPE_LINEAR, // Increment by a fixed value
  73. IncrementList = CORFEATURE_VAL_INCREMENT_TYPE_LIST, // Valid values are provided in a list
  74. };
  75. enum FloatNotation // Display Notation Types
  76. {
  77. FloatNotationUndefined = CORFEATURE_VAL_FLOAT_NOTATION_UNDEFINED, // Undefined
  78. FloatNotationFixed = CORFEATURE_VAL_FLOAT_NOTATION_FIXED, // GUI should use fixed notation, i.e. 123.4
  79. FloatNotationScientific = CORFEATURE_VAL_FLOAT_NOTATION_SCIENTIFIC // GUI should use scientific notation, i.e. 1.234e-2
  80. };
  81. public:
  82. // Constructor/Destructor
  83. SapFeature(SapLocation location = SapLocation::ServerSystem);
  84. SapFeature(const SapFeature &feature);
  85. virtual ~SapFeature();
  86. SapFeature &operator= (const SapFeature &feature);
  87. // Creation/destruction
  88. virtual BOOL Create();
  89. virtual BOOL Destroy();
  90. // Attributes
  91. SapLocation GetLocation() const { return m_Location; }
  92. CORHANDLE GetHandle() const { return m_Handle; }
  93. BOOL SetLocation(SapLocation location);
  94. // General Parameters
  95. BOOL GetName(char *name, int nameSize);
  96. BOOL GetType(Type *type);
  97. BOOL IsStandard(BOOL *isStandard);
  98. BOOL GetAccessMode(AccessMode *accessMode);
  99. BOOL GetPollingTime(int *pollingTime);
  100. BOOL GetToolTip(char *tooltip, int tooltipSize);
  101. BOOL GetDescription(char *description, int descriptionSize);
  102. BOOL GetDisplayName(char *displayName, int displayNameSize);
  103. BOOL GetRepresentation(Representation *representation);
  104. BOOL GetSign(Sign *sign);
  105. BOOL GetSiUnit(char *unit, int unitSize);
  106. BOOL GetCategory(char *category, int categorySize);
  107. BOOL GetWriteMode(WriteMode *writeMode);
  108. BOOL IsSavedToConfigFile(BOOL *savedToConfigFile);
  109. BOOL GetSiToNativeExp10(int *exponent);
  110. BOOL GetVisibility(Visibility *visibility);
  111. BOOL GetArrayLength(int *arrayLength);
  112. BOOL GetIncrementType(IncrementType *incrementType);
  113. BOOL GetValidValueCount(int *validValueCount);
  114. BOOL GetFloatPrecision(INT64 *precision);
  115. BOOL GetFloatNotation(FloatNotation *notation);
  116. BOOL SetSavedToConfigFile(BOOL savedToConfigFile);
  117. // Integer/float-specific Parameters
  118. BOOL GetMin(INT32 *minValue);
  119. BOOL GetMin(UINT32 *minValue);
  120. BOOL GetMin(INT64 *minValue);
  121. BOOL GetMin(UINT64 *minValue);
  122. BOOL GetMin(float *minValue);
  123. BOOL GetMin(double *minValue);
  124. BOOL GetMax(INT32 *maxValue);
  125. BOOL GetMax(UINT32 *maxValue);
  126. BOOL GetMax(INT64 *maxValue);
  127. BOOL GetMax(UINT64 *maxValue);
  128. BOOL GetMax(float *maxValue);
  129. BOOL GetMax(double *maxValue);
  130. BOOL GetInc(INT32 *incValue);
  131. BOOL GetInc(UINT32 *incValue);
  132. BOOL GetInc(INT64 *incValue);
  133. BOOL GetInc(UINT64 *incValue);
  134. BOOL GetInc(float *incValue);
  135. BOOL GetInc(double *incValue);
  136. BOOL GetValidValue(int validValueIndex, INT32 *validValue);
  137. BOOL GetValidValue(int validValueIndex, UINT32 *validValue);
  138. BOOL GetValidValue(int validValueIndex, INT64 *validValue);
  139. BOOL GetValidValue(int validValueIndex, UINT64 *validValue);
  140. BOOL GetValidValue(int validValueIndex, float *validValue);
  141. BOOL GetValidValue(int validValueIndex, double *validValue);
  142. // Enumeration-specific Parameters
  143. BOOL GetEnumCount(int *enumCount);
  144. BOOL GetEnumString(int enumIndex, char *enumString, int enumStringSize);
  145. BOOL GetEnumValue(int enumIndex, int *enumValue);
  146. BOOL IsEnumEnabled(int enumIndex, BOOL *enabled);
  147. BOOL GetEnumStringFromValue(int enumValue, char *enumString, int enumStringSize);
  148. BOOL GetEnumValueFromString(const char *enumString, int *enumValue);
  149. // Selector-specific Parameters
  150. BOOL IsSelector(BOOL *isSelector);
  151. // Gets the number of features that are selected by this one, i.e. "Child feature"
  152. BOOL GetSelectedFeatureCount(int *selectedCount);
  153. // Gets the name or index of a specific feature that is selected by this one.
  154. BOOL GetSelectedFeatureName(int selectedIndex, char *featureName, int featureNameSize);
  155. BOOL GetSelectedFeatureIndex(int selectedIndex, int *featureIndex);
  156. // Gets the number of features that select this feature, i.e. "Parent feature"
  157. BOOL GetSelectingFeatureCount(int *selectingCount);
  158. // Gets the name or index of a specific feature that selects this one.
  159. BOOL GetSelectingFeatureName(int selectingIndex, char *featureName, int featureNameSize);
  160. BOOL GetSelectingFeatureIndex(int selectingIndex, int *featureIndex);
  161. // Utility methods
  162. void SetValid(BOOL isValid = TRUE) { m_IsValid = isValid; }
  163. protected:
  164. // Utility methods
  165. void Construct(SapLocation location, CORFEATURE handle, BOOL isValid);
  166. BOOL IsParameterValid(int param);
  167. BOOL GetMin(void *minValue, int minValueSize);
  168. BOOL GetMax(void *maxValue, int maxValueSize);
  169. BOOL GetInc(void *incValue, int incValueSize);
  170. BOOL GetValidValue(int validValueIndex, void *validValue, int validValueSize);
  171. protected:
  172. SapLocation m_Location;
  173. CORFEATURE m_Handle;
  174. // TRUE after a call to SapAcqDevice::GetFeatureInfo, means that the feature has meaningful content
  175. BOOL m_IsValid;
  176. };
  177. #endif // _SAPFEATURE_H_