// **********************************************************************
//
// Generated by the ORBacus IDL-to-C++ Translator
//
// Copyright (c) 1999
// Object Oriented Concepts, Inc.
// Billerica, MA, USA
//
// All Rights Reserved
//
// **********************************************************************

// Version: 3.2
// License: non-commercial

#include <OB/CORBA.h>
#include <OB/TemplateI.h>
#include <OB/PolicyManager.h>

#ifndef OB_INTEGER_VERSION
#   error No ORBacus version defined!
#endif

#ifndef OB_NO_VERSION_CHECK
#   if (OB_INTEGER_VERSION != 3020000L)
#       error ORBacus version mismatch!
#   endif
#endif

//
// IDL:omg.org/CORBA/BAD_POLICY:1.0
//
const CORBA_PolicyErrorCode CORBA_BAD_POLICY = 0;

//
// IDL:omg.org/CORBA/UNSUPPORTED_POLICY:1.0
//
const CORBA_PolicyErrorCode CORBA_UNSUPPORTED_POLICY = 1;

//
// IDL:omg.org/CORBA/BAD_TYPE:1.0
//
const CORBA_PolicyErrorCode CORBA_BAD_TYPE = 2;

//
// IDL:omg.org/CORBA/BAD_VALUE:1.0
//
const CORBA_PolicyErrorCode CORBA_BAD_VALUE = 4;

//
// IDL:omg.org/CORBA/UNSUPPORTED_VALUE:1.0
//
const CORBA_PolicyErrorCode CORBA_UNSUPPORTED_VALUE = 3;

//
// IDL:omg.org/CORBA/PolicyError:1.0
//
#ifdef OB_CLEAR_MEM
CORBA_PolicyError::CORBA_PolicyError()
{
    memset(&reason, 0, sizeof(reason));
}
#endif

CORBA_PolicyError::CORBA_PolicyError(const CORBA_PolicyError& _ob_a)
    : CORBA_UserException(_ob_a),
      reason(_ob_a.reason)
{
}

CORBA_PolicyError::CORBA_PolicyError(CORBA_PolicyErrorCode _ob_a0)
    : reason(_ob_a0)
{
}

CORBA_PolicyError&
CORBA_PolicyError::operator=(const CORBA_PolicyError& _ob_a)
{
    if(this != &_ob_a)
    {
        reason = _ob_a.reason;
    }
    return *this;
}

CORBA_PolicyError*
CORBA_PolicyError::_narrow(CORBA_Exception* p)
{
#ifdef HAVE_NO_RTTI
    if(p)
        return (CORBA_PolicyError*)(p -> _OB_narrowHelp("IDL:omg.org/CORBA/PolicyError:1.0"));
    else
        return 0;
#else
    return dynamic_cast<CORBA_PolicyError*>(p);
#endif
}

#ifdef HAVE_NO_RTTI
void*
CORBA_PolicyError::_OB_narrowHelp(const char* _ob_id) const
{
    if(strcmp("IDL:omg.org/CORBA/PolicyError:1.0", _ob_id) == 0)
        return (void*)this;
    else
        return CORBA_UserException::_OB_narrowHelp(_ob_id);
}
#endif

const char*
CORBA_PolicyError::_OB_typeId() const
{
    return "IDL:omg.org/CORBA/PolicyError:1.0";
}

CORBA_Exception*
CORBA_PolicyError::_OB_clone() const
{
    return new CORBA_PolicyError(*this);
}

//
// IDL:omg.org/CORBA/PolicyManager:1.0
//
#ifndef HAVE_NO_EXPLICIT_TEMPLATES
template class OBObjVar< CORBA_PolicyManager >;
template class OBObjForSeq< CORBA_PolicyManager >;
#else
#ifdef HAVE_PRAGMA_DEFINE
#pragma define(OBObjVar< CORBA_PolicyManager >)
#pragma define(OBObjForSeq< CORBA_PolicyManager >)
#endif
#endif

void
OBDuplicate(CORBA_PolicyManager_ptr p)
{
    if(p)
        p -> _OB_incRef();
}

void
OBRelease(CORBA_PolicyManager_ptr p)
{
    if(p)
        p -> _OB_decRef();
}

CORBA_PolicyManager_ptr
CORBA_PolicyManager::_narrow(CORBA_Object_ptr p)
{
    if(!CORBA_is_nil(p))
    {
        void* v = p -> _OB_narrowHelp("IDL:omg.org/CORBA/PolicyManager:1.0");

        if(v)
            return _duplicate((CORBA_PolicyManager_ptr)v);
    }

    return _nil();
}

void*
CORBA_PolicyManager::_OB_narrowHelp(const char* _ob_id) const
{
    if(strcmp("IDL:omg.org/CORBA/PolicyManager:1.0", _ob_id) == 0)
        return (void*)this;
    else
        return CORBA_Object::_OB_narrowHelp(_ob_id);
}

const char*
CORBA_PolicyManager::_OB_typeId() const
{
    return "IDL:omg.org/CORBA/PolicyManager:1.0";
}

//
// IDL:omg.org/CORBA/PolicyManager/InvalidPolicies:1.0
//
CORBA_PolicyManager::InvalidPolicies::InvalidPolicies(const CORBA_PolicyManager::InvalidPolicies& _ob_a)
    : CORBA_UserException(_ob_a),
      indices(_ob_a.indices)
{
}

CORBA_PolicyManager::InvalidPolicies::InvalidPolicies(const OBFixSeq< CORBA_UShort >& _ob_a0)
    : indices(_ob_a0)
{
}

CORBA_PolicyManager::InvalidPolicies&
CORBA_PolicyManager::InvalidPolicies::operator=(const InvalidPolicies& _ob_a)
{
    if(this != &_ob_a)
    {
        indices = _ob_a.indices;
    }
    return *this;
}

CORBA_PolicyManager::InvalidPolicies*
CORBA_PolicyManager::InvalidPolicies::_narrow(CORBA_Exception* p)
{
#ifdef HAVE_NO_RTTI
    if(p)
        return (InvalidPolicies*)(p -> _OB_narrowHelp("IDL:omg.org/CORBA/PolicyManager/InvalidPolicies:1.0"));
    else
        return 0;
#else
    return dynamic_cast<CORBA_PolicyManager::InvalidPolicies*>(p);
#endif
}

#ifdef HAVE_NO_RTTI
void*
CORBA_PolicyManager::InvalidPolicies::_OB_narrowHelp(const char* _ob_id) const
{
    if(strcmp("IDL:omg.org/CORBA/PolicyManager/InvalidPolicies:1.0", _ob_id) == 0)
        return (void*)this;
    else
        return CORBA_UserException::_OB_narrowHelp(_ob_id);
}
#endif

const char*
CORBA_PolicyManager::InvalidPolicies::_OB_typeId() const
{
    return "IDL:omg.org/CORBA/PolicyManager/InvalidPolicies:1.0";
}

CORBA_Exception*
CORBA_PolicyManager::InvalidPolicies::_OB_clone() const
{
    return new InvalidPolicies(*this);
}

//
// OBFixSeq< CORBA_UShort >
//
#ifdef OB_use_OBFixSeq_CORBA__UShort_from_PolicyManager_h

#endif

//
// OBObjSeq< CORBA_Policy >
//
#ifdef OB_use_OBObjSeq_CORBA__Policy_from_PolicyManager_h

#ifndef HAVE_NO_EXPLICIT_TEMPLATES
template class OBObjSeq< CORBA_Policy >;
template class OBSeqVar< OBObjSeq< CORBA_Policy > >;
#else
#ifdef HAVE_PRAGMA_DEFINE
#pragma define(OBObjSeq< CORBA_Policy >)
#pragma define(OBSeqVar< OBObjSeq< CORBA_Policy > >)
#endif
#endif

#endif

//
// OBFixSeq< CORBA_ULong >
//
#ifdef OB_use_OBFixSeq_CORBA__ULong_from_PolicyManager_h

#endif
