/****************************************************************************
|
| Copyright (c) 2006 Novell, Inc.
| All Rights Reserved.
|
| This program is free software; you can redistribute it and/or
| modify it under the terms of version 2 of the GNU General Public License as
| published by the Free Software Foundation.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| GNU General Public License for more details.
|
| You should have received a copy of the GNU General Public License
| along with this program; if not, contact Novell, Inc.
|
| To contact Novell about this file by physical or electronic mail,
| you may find current contact information at www.novell.com
|
|***************************************************************************
/**
@author Brad Nicholes
*/
#ifndef OMC_OMCCLPCOMMON_H_INCLUDE_GUARD_
#define OMC_OMCCLPCOMMON_H_INCLUDE_GUARD_
#include <iostream>
#include <stdarg.h>
#include "omcclpconf.h"
#include <openwbem/OW_config.h>
#include <openwbem/OW_CIMClient.hpp>
#include <openwbem/OW_CIMException.hpp>
#include <openwbem/OW_CIMObjectPath.hpp>
#include <openwbem/OW_String.hpp>
#include <openwbem/OW_Array.hpp>
#include <openwbem/OW_WBEMFlags.hpp>
using namespace OW_NAMESPACE;
using namespace OpenWBEM;
using namespace WBEMFlags;
using std::cerr;
using std::cin;
using std::cout;
//using std::endl;
extern void* addrgram__set_scan_string( const char *yy_str );
extern int addrgram_doparse (void *omcclp);
#define DISPLAY_ARRAY1(disparray,meth) \
for (int aaa=0; aaa<disparray.size(); aaa++) { \
cout << disparray[aaa].meth() << CLPENDL; }
#define STRIP_QUOTES(s) \
if (s.startsWith('"') && s.endsWith('"')) { \
s = s.substring(1); \
s = s.substring(0,s.length()-1); }
#define CLPENDL "\r\n"
#define PROMPT "-> "
#define CLPPROMPT "CLP"PROMPT
namespace OMCCLP {
class OMCCLPProgram;
String safeBack(StringArray sa);
String safeFront(StringArray sa);
CIMObjectPath safeFront(CIMObjectPathArray copa);
Int32 countOccurrance(char *str, char *pattern);
String stripUFiS(String ufit);
String getCIMClassName (OMCCLPProgram *clpSession, const String& ufit, Int32 *ufis=0);
String getUFcTFromCIMClassName (OMCCLPProgram* clpSession, const String& className);
CIMObjectPath getCIMObjectPathFromUFiT (OMCCLPProgram* clpSession, const String& ufit);
Int32 getUFiSFromObjectPath (const CIMObjectPath& cop);
String getCIMAssocClassName (OMCCLPProgram* clpSession, String ufct1, String ufct2);
String getCIMAssocClassName (OMCCLPProgram* clpSession, CIMObjectPath cop, String UFcT);
String getCIMAssocClassName (OMCCLPProgram* clpSession, String targetAssoc);
CIMObjectPathArray getCIMObjectPathsForTargetAssociation(OMCCLPProgram* clpSession, CIMObjectPath cop, String targetAssociation, String targetPathSecondary);
CIMObjectPathArray getCIMObjectPathsForEmbededAssociation(OMCCLPProgram* clpSession, CIMObjectPath cop, String targetAssociation, String targetPathSecondary);
CIMObjectPathArray getCIMObjectPathsFromUFiP (OMCCLPProgram* clpSession, const String& ufip);
CIMObjectPath getCIMObjectPathFromUFiP (OMCCLPProgram* clpSession, const String& ufip);
String getUFiPFromCIMObjectPath (OMCCLPProgram* clpSession, const CIMObjectPath& cop, String UFcT="", String UFiP="");
CIMObjectPath getAdminDomainCIMObjectPath (OMCCLPProgram* clpSession);
String getCIMClassFilter (OMCCLPProgram* clpSession, const String& ufit);
bool checkCIMClassFilter (OMCCLPProgram* clpSession, const CIMObjectPath& cop, const String& filter);
CIMInstance getCIMInstanceFromUFiP (OMCCLPProgram* clpSession, const String& ufip);
String getUFcTFromCIMObjectPath (OMCCLPProgram* clpSession, const CIMObjectPath& cop);
StringArray getUFcTsFromCIMObjectPath (OMCCLPProgram* clpSession, const CIMObjectPath& cop);
bool classIsDerivedFrom(OMCCLPProgram* clpSession, const String& derived, const String& super);
OW_DECLARE_EXCEPTION(OMCCLP);
}
using namespace OMCCLP;
#endif