/*  -*- mode: c++; c-basic-offset: 4; -*-
 *
 *  MICO --- a free CORBA implementation
 *  Copyright (C) 1999 Andreas Schultz
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Library General Public
 *  License as published by the Free Software Foundation; either
 *  version 2 of the License, or (at your option) any later version.
 *
 *  This library 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
 *  Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public
 *  License along with this library; if not, write to the Free
 *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *  Send comments and/or bug reports to:
 *                 mico@informatik.uni-frankfurt.de      
 *
 */

#ifndef __RT_CORBA_IMPL_H__
#define __RT_CORBA_IMPL_H__

#ifndef MICO_NO_TOPLEVEL_MODULES
MICO_NAMESPACE_DECL RT_CORBA {
#endif

#if !defined(MICO_NO_TOPLEVEL_MODULES) || defined(MICO_MODULE_RT_CORBA)

class Mutex;
typedef Mutex *Mutex_ptr;
typedef ObjVar<Mutex> Mutex_var;
// typedef Mutex_var Mutex_out;

class Mutex: public CORBA::ServerlessObject {
protected:
    MICOMT::Mutex _mutex;
public:
    Mutex();
    ~Mutex();

    #ifdef HAVE_TYPEDEF_OVERLOAD
    typedef Mutex_ptr _ptr_type;
    typedef Mutex_var _var_type;
    #endif

    void lock()   { _mutex.lock(); }
    void unlock() { _mutex.unlock(); };
    CORBA::Boolean try_lock( CORBA::ULongLong max_wait ) {
	return _mutex.trylock();
    };

    static Mutex_ptr _duplicate( Mutex_ptr _obj )
    {
	CORBA::ServerlessObject::_duplicate (_obj);
	return _obj;
    };
    
    static Mutex_ptr _nil()
    {
	return 0;
    };
};

class PriorityMapping {
public:
    virtual CORBA::Boolean to_native ( Priority, NativePriority & );
    virtual CORBA::Boolean to_CORBA  ( NativePriority, Priority & );
};

#ifndef MICO_CONF_NO_POA
class PriorityTransform {
public:
    virtual CORBA::Boolean inbound  ( Priority &, PortableServer::ObjectId );
    virtual CORBA::Boolean outbound ( Priority &, PortableServer::ObjectId );
};
#endif // MICO_CONF_NO_POA

#endif // !defined(MICO_NO_TOPLEVEL_MODULES) || defined(MICO_MODULE_RT_CORBA)

#ifndef MICO_NO_TOPLEVEL_MODULES
};
#endif


#endif // __RT_CORBA_IMPL_H__
