SomCheckVersion: Difference between revisions
Created page with "{{DISPLAYTITLE:somCheckVersion}} This method checks a class for compatibility with the specified major and minor version numbers. Not generally overridden. '''Note:''' For ba..." |
mNo edit summary |
||
Line 4: | Line 4: | ||
'''Note:''' For backward compatibility, this method does not take an Environment parameter. | '''Note:''' For backward compatibility, this method does not take an Environment parameter. | ||
; Original Class : [[SOMClass]] | ;Original Class : [[SOMClass]] | ||
==Syntax== | ==Syntax== | ||
Line 10: | Line 10: | ||
==Parameters== | ==Parameters== | ||
; | ;receiver (SOMClass) : A pointer to the SOM class whose version information should be checked. | ||
;majorVersion (long) : This value usually changes only when a significant enhancement or incompatible change is made to a class. | |||
; majorVersion (long) : This value usually changes only when a significant enhancement or incompatible change is made to a class. | ;minorVersion (long) : This value changes whenever minor enhancements or fixes are made to a class. Class implementors usually maintain downward compatibility across changes in the minorVersion number. | ||
; minorVersion (long) : This value changes whenever minor enhancements or fixes are made to a class. Class implementors usually maintain downward compatibility across changes in the minorVersion number. | |||
==Return Code== | ==Return Code== | ||
; | ;rc (boolean) : | ||
* Returns 1 (true) if the implementation of this class is compatible with the specified major and minor version number. | |||
* Returns 1 (true) if the implementation of this class is compatible with the specified major and minor version number. | * Returns 0 (false) if the implementation of this class is not compatible with the specified major and minor version number. | ||
* Returns 0 (false) if the implementation of this class is not compatible with the specified major and minor version number. | |||
==Remarks== | ==Remarks== | ||
This method checks the receiving class for compatibility with the specified major and minor version numbers. An implementation is compatible with the specified version numbers if it has the same major version number and a minor version number that is equal to or greater than minorVersion. The version number pair (0,0) is considered to match any version. | This method checks the receiving class for compatibility with the specified major and minor version numbers. An implementation is compatible with the specified version numbers if it has the same major version number and a minor version number that is equal to or greater than minorVersion. The version number pair (0,0) is considered to match any version. | ||
This method is called automatically after creating a class object to verify that a dynamically loaded class definition is compatible with a client application. | This method is called automatically after creating a class object to verify that a dynamically loaded class definition is compatible with a client application. | ||
==Example Code== | ==Example Code== | ||
Line 50: | Line 47: | ||
Animal IS compatible with 0.0 | Animal IS compatible with 0.0 | ||
Animal IS NOT compatible with 1.1 | Animal IS NOT compatible with 1.1 | ||
[[Category:SOMClassMgr]] | [[Category:SOMClassMgr]] |
Latest revision as of 18:26, 12 October 2022
This method checks a class for compatibility with the specified major and minor version numbers. Not generally overridden.
Note: For backward compatibility, this method does not take an Environment parameter.
- Original Class
- SOMClass
Syntax
boolean somCheckVersion (SOMClass receiver, long majorVersion, long minorVersion)
Parameters
- receiver (SOMClass)
- A pointer to the SOM class whose version information should be checked.
- majorVersion (long)
- This value usually changes only when a significant enhancement or incompatible change is made to a class.
- minorVersion (long)
- This value changes whenever minor enhancements or fixes are made to a class. Class implementors usually maintain downward compatibility across changes in the minorVersion number.
Return Code
- rc (boolean)
- Returns 1 (true) if the implementation of this class is compatible with the specified major and minor version number.
- Returns 0 (false) if the implementation of this class is not compatible with the specified major and minor version number.
Remarks
This method checks the receiving class for compatibility with the specified major and minor version numbers. An implementation is compatible with the specified version numbers if it has the same major version number and a minor version number that is equal to or greater than minorVersion. The version number pair (0,0) is considered to match any version.
This method is called automatically after creating a class object to verify that a dynamically loaded class definition is compatible with a client application.
Example Code
#include <animal.h>main() { Animal myAnimal; myAnimal = AnimalNew(); if (_somCheckVersion(_Animal, 0, 0)) somPrintf("Animal IS compatible with 0.0\n"); else somPrintf("Animal IS NOT compatible with 0.0\n"); if (_somCheckVersion(_Animal, 1, 1)) somPrintf("Animal IS compatible with 1.1\n"); else somPrintf("Animal IS NOT compatible with 1.1\n"; _somFree(myAnimal); }
Assuming that the implementation of Animal is version 1.0, this program produces the following output:
Animal IS compatible with 0.0 Animal IS NOT compatible with 1.1