KCMS CMM Reference Manual
  Rechercher uniquement dans ce livre
Télécharger cet ouvrage au format PDF

KcsStatus Class

10

This chapter describes the KCMS framework KcsStatus class. This class allows a representation of error and warning values, error text descriptions, error conversions to and from KcsStatusId, error comparisons, and external mappings through the C API.
To extend this class write your own version of findErrDesc and findWarningDesc. See the KCMS CMM Developer's Guide for more information on extending this class.
As you read this chapter, you will find it helpful to have access to the kcsstat.h header file.
This class does not have any protected members; the public members are described.

Public Members

The KcsStatus class has the following public members.
Table 10-1 KcsStatus
Public MemberDescription
void deleteDescription();Deletes the string that describes the status. Use this instead of delete(myDescription).
const long getCause() const;Gets the OS or internal cause of the status.
const char *getDescription() const;Returns a string valid only within the scope of the object; therefore, you must copy it to a separate location.
const KcsStatusId getId() const;Returns longs, ints, and KcsStatusIds. Set and gets the originating OS or platform-dependent cause., which are OS- and platform-related as well as device specific. Aplatform-specific application can map specific errors to native error conditions.
const long getIdLong() const;Returns a long that corresponds to this KcsStatus.
getlastStatus();Returns to the last non-KCS_SUCCESS status object.
const long getOwnerId() const;Returns the owner of the error message.
KcsStatus(const KcsStatus&);Constructor.
KcsStatus(const KcsStatusId thisId);Constructor.
KcsStatus(const KcsStausId anId, const char *aDescription);Constructor.
KcsStatus(const KcsStatusId thisId, const long aCause);Constructor.
KcsStaus(const int &thisId);Constructor.
KcsStatus(const int &thisId, const char *myDescription);Constructor.
KcsStatus(const long &thisId);Constructor.
KcsStatus(const long &thisId, const char *aDescription);Constructor.
KcsStatus& operator=(const KcsStatus&);Copy constructor.
KcsStatus& operator=(KcsStatusId);Copy constructor.
KcsStatus map();Takes an internal toolkit error and converts it to an API error.
Table 10-1 KcsStatus(Continued)
Public MemberDescription
void setCause(const long);Sets the OS or internal cause of the status.
void

setDescription(const char * description);

Sets the string that describes the status.
void setId(const KcsStatus anId);Resets the identifier from an int, long, KcsStatusId, or another KcsStatus object.

For example, when a method finds an error, it uses this method to indicate the actual error condition. Or, it can set it equal to since the Framework overrides the equal operator, you can set the object equal to KcsStatusId and the KcsStatus class does the rest. This is the most efficient way to assign KcsStatus objects to particular identifiers.

void setId(const long &anId);Sets the Id to a long.
void setId(const long,
const long &iOwnerId);
Allows other classes to add error strings.

External Loadable Interface

Use these KcsStatus external entry points to load your derivatives at runtime. See the DDK manual KCMS CMM Developer's Guide for more information on creating a KcsStatus derivative as an extension.
Table 10-2 KcsSolarisFile
Extern "C"Description
char *KcsFindErrDesc(KcsStatusId statId);Creates an instance of the function connecting the custom error codes with your string descriptions. Used in dgettext().
char *KcsFindWarningDesc(KcsStatusId statId);Creates an instance of the function connecting the custom warning codes with your string descriptions. Used in dgettext().
extern long KcsDLOpenStatCount;Holds a counter for the number of times this dynamically loadable module has been loaded.