📄 cmpimacs.h
字号:
//%2006//////////////////////////////////////////////////////////////////////////// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation, The Open Group.// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; Symantec Corporation; The Open Group.//// Permission is hereby granted, free of charge, to any person obtaining a copy// of this software and associated documentation files (the "Software"), to// deal in the Software without restriction, including without limitation the// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or// sell copies of the Software, and to permit persons to whom the Software is// furnished to do so, subject to the following conditions:// // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.////==============================================================================////%/////////////////////////////////////////////////////////////////////////////#ifndef _CMPIMACS_H_# define _CMPIMACS_H_# ifndef DOC_ONLY# include "cmpidt.h"# include "cmpift.h"# endif# ifdef DOC_ONLY# define CMPI_INLINE# endif# ifdef DOC_ONLY /** This macro builds a CMPIStatus object with <rc> as return code and returns to the CIMOM. @param rc the CMPI return code @return This macro contains a return statement and leaves the function. */noReturn CMReturn (CMPIrc rc);# else# define CMReturn(rc) \ { CMPIStatus stat={(rc),NULL}; \ return stat; }# endif# ifdef DOC_ONLY /** This macro builds a CMPIStatus object with <rc> as return code and <str> as message and returns to the Broker. @param rc the CMPI return code @param str the message as String object @return This macro contains a return statement and leaves the function. */noReturn CMReturnWithString (CMPIrc rc, CMPIString * str);# else# define CMReturnWithString(rc_,str_) \ do \ { \ CMPIStatus stat;\ stat.rc=rc_;\ stat.msg=str_; \ return stat; \ } \ while (0)# endif# ifdef DOC_ONLY /** This macro builds a CMPIStatus object with <rc> as return code and <msg> as message and returns to the Broker. @param mb Broker this pointer @param rc the CMPI return code @param msg the message as character string @return This macro contains a return statement and leaves the function. */noReturn CMReturnWithChars (const CMPIBroker * mb, CMPIrc rc, char *msg);# else# define CMReturnWithChars(b,rc,chars) \ { CMPIStatus stat={(rc),NULL}; \ stat.msg=(b)->eft->newString((b),(chars),NULL); \ return stat; }# endif# ifdef CMPI_INLINE /** Initializes status object with <rc> and NULL message. @param st Address of status object @param rcp CMPI return code */inline static voidCMSetStatus (CMPIStatus * st, CMPIrc rcp){ if (st) { (st)->rc = (rcp); (st)->msg = NULL; }}# else# define CMSetStatus(st,rcp) \ { (st)->rc=(rcp); (st)->msg=NULL; }# endif# ifdef CMPI_INLINE /** Initializes status object with rc and message. @param st Address of status object @param rcp CMPI return code @param string Message string */inline static voidCMSetStatusWithString (CMPIStatus * st, CMPIrc rcp, const CMPIString * string){ if (st) { (st)->rc = (rcp); (st)->msg = (string); }}# else# define CMSetStatusWithString(st,rcp,string) \ { (st)->rc=(rcp); (st)->msg=(string); }# endif# ifdef CMPI_INLINE /** Initializes status object with <rc> and message. @param mb Broker this pointer @param st Address of status object @param rcp CMPI return code @param chars Message character string */inline static voidCMSetStatusWithChars (const CMPIBroker * mb, CMPIStatus * st, CMPIrc rcp, const char *chars){ if (st && mb) { (st)->rc = (rcp); (st)->msg = (mb)->eft->newString ((mb), (chars), NULL); }}# else# define CMSetStatusWithChars(mb,st,rcp,chars) \ { (st)->rc=(rcp); \ (st)->msg=(mb)->eft->newString((mb),(chars),NULL); }# endif# ifdef CMPI_INLINE /** Tests for encapsulated NULL object. @param obj CMPI Object pointer */inline static CMPIBooleanCMIsNullObject (const void *obj){ return ((obj) == NULL || *((void **) (obj)) == NULL);}# else# define CMIsNullObject(o) ((o)==NULL || *((void**)(o))==NULL)# endif# ifdef CMPI_INLINE /** Tests for nullValue data item. @param val Value object */inline static CMPIBooleanCMIsNullValue (const CMPIData val){ return ((val.state) & CMPI_nullValue);}# else# define CMIsNullValue(v) ((v.state) & CMPI_nullValue)# endif# ifdef CMPI_INLINE /** Tests for keyValue data item. @param val Value object */inline static CMPIBooleanCMIsKeyValue (CMPIData val){ return ((val.state) & CMPI_keyValue);}# else# define CMIsKeyValue(v) ((v.state) & CMPI_keyValue)# endif# ifdef CMPI_INLINE /** Tests for keyValue data item. @param val Value object */inline static CMPIBooleanCMIsArray (const CMPIData val){ return ((val.type) & CMPI_ARRAY);}# else# define CMIsArray(v) ((v.type) & CMPI_ARRAY)# endif // Life-cycle macros# define CMClone(o,rc) ((o)->ft->clone((o),(rc)))# define CMRelease(o) ((o)->ft->release((o))) // CMPIBroker factory macros# ifdef CMPI_INLINE /** Instance factory service. @param mb Broker this pointer. @param op ObjectPath containing namespace and classname. @param rc Output: Service return status (suppressed when NULL). @return The newly created Instance. */inline static CMPIInstance *CMNewInstance (const CMPIBroker * mb, const CMPIObjectPath * op, CMPIStatus * rc){ return ((mb)->eft->newInstance ((mb), (op), (rc)));}# else# define CMNewInstance(b,c,rc) ((b)->eft->newInstance((b),(c),(rc)))# endif# ifdef CMPI_INLINE /** ObjectPath factory service. @param mb Broker this pointer. @param ns Namespace @param cn Classname. @param rc Output: Service return status (suppressed when NULL). @return The newly created ObjectPath. */inline static CMPIObjectPath *CMNewObjectPath (const CMPIBroker * mb, const char *ns, const char *cn, CMPIStatus * rc){ return ((mb)->eft->newObjectPath ((mb), (ns), (cn), (rc)));}# else# define CMNewObjectPath(b,n,c,rc) \ ((b)->eft->newObjectPath((b),(n),(c),(rc)))# endif# ifdef CMPI_INLINE /** String container factory service. @param mb Broker this pointer. @param data String data @param rc Output: Service return status (suppressed when NULL). @return The newly created String. */inline static CMPIString *CMNewString (const CMPIBroker * mb, const char *data, CMPIStatus * rc){ return ((mb)->eft->newString ((mb), (data), (rc)));}# else# define CMNewString(b,s,rc) ((b)->eft->newString((b),(s),(rc)))# endif# ifdef CMPI_INLINE /** Args container factory service. @param mb Broker this pointer. @param rc Output: Service return status (suppressed when NULL). @return The newly created Args container. */inline static CMPIArgs *CMNewArgs (const CMPIBroker * mb, CMPIStatus * rc){ return ((mb)->eft->newArgs ((mb), (rc)));}# else# define CMNewArgs(b,rc) ((b)->eft->newArgs((b),(rc)))# endif# ifdef CMPI_INLINE /** Array container factory service. @param mb Broker this pointer @param max Maximum number of elements @param type Element type @param rc Output: Service return status (suppressed when NULL). @return The newly created Array. */inline static CMPIArray *CMNewArray (const CMPIBroker * mb, CMPICount max, CMPIType type, CMPIStatus * rc){ return ((mb)->eft->newArray ((mb), (max), (type), (rc)));}# else# define CMNewArray(b,c,t,rc) ((b)->eft->newArray((b),(c),(t),(rc)))# endif# ifdef CMPI_INLINE /** DateTime factory service. Initialized with the time of day. @param mb Broker this pointer @param rc Output: Service return status (suppressed when NULL). @return The newly created DateTime. */inline static CMPIDateTime *CMNewDateTime (const CMPIBroker * mb, CMPIStatus * rc){ return ((mb)->eft->newDateTime ((mb), (rc)));}# else# define CMNewDateTime(b,rc) ((b)->eft->newDateTime((b),(rc)))# endif# ifdef CMPI_INLINE /** DateTime factory service. Initialized from <binTime>. @param mb Broker this pointer @param binTime Date/Time definition in binary format in microsecods starting since 00:00:00 GMT, Jan 1,1970. @param interval Wenn true, defines Date/Time definition to be an interval value @param rc Output: Service return status (suppressed when NULL). @return The newly created DateTime. */inline static CMPIDateTime *CMNewDateTimeFromBinary (const CMPIBroker * mb, CMPIUint64 binTime, CMPIBoolean interval, CMPIStatus * rc){ return ((mb)->eft-> newDateTimeFromBinary ((mb), (binTime), (interval), (rc)));}# else# define CMNewDateTimeFromBinary(b,d,i,rc) \ ((b)->eft->newDateTimeFromBinary((b),(d),(i),(rc)))# endif# ifdef CMPI_INLINE /** DateTime factory service. Is initialized from <utcTime>. @param mb Broker this pointer @param utcTime Date/Time definition in UTC format @param rc Output: Service return status (suppressed when NULL). @return The newly created DateTime. */inline static CMPIDateTime *CMNewDateTimeFromChars (const CMPIBroker * mb, const char *utcTime, CMPIStatus * rc){ return ((mb)->eft->newDateTimeFromChars ((mb), (utcTime), (rc)));}# else# define CMNewDateTimeFromChars(b,d,rc) \ ((b)->eft->newDateTimeFromChars((b),(d),(rc)))# endif# ifdef CMPI_INLINE /** SelectExp factory service. This structure encompasses queries and provides mechanism to operate on the query. @param mb Broker this pointer @param query The select expression. @param lang The query language. @param projection Output: Projection specification (suppressed when NULL). @param rc Output: Service return status (suppressed when NULL). @return The newly created SelectExp. */inline static CMPISelectExp *CMNewSelectExp (const CMPIBroker * mb, const char *query, const char *lang, CMPIArray ** projection, CMPIStatus * rc){ return ((mb)->eft-> newSelectExp ((mb), (query), (lang), (projection), (rc)));}# else# define CMNewSelectExp(b,q,l,p,rc) \ ((b)->eft->newSelectExp((b),(q),(l),(p),(rc)))# endif# ifdef CMPI_INLINE /** Function to determine whether a CIM class is of <type> or any of <type> subclasses. @param mb Broker this pointer @param op The class path (namespace and classname components). @param type The type to tested for. @param rc Output: Service return status (suppressed when NULL). @return True if test successful. */inline static CMPIBoolean CMClassPathIsA (const CMPIBroker * mb, const CMPIObjectPath * op, const char *type, CMPIStatus * rc){ return ((mb)->eft->classPathIsA ((mb), (op), (type), (rc)));}# else# define CMClassPathIsA(b,p,pn,rc) \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -