Jump to content

somCheckVersion

From EDM2
Revision as of 19:54, 12 October 2017 by Martini (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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. 0
  • 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

Related